You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
161 lines
5.4 KiB
161 lines
5.4 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using ICSSoft.Frame.Data.Entity;
|
|
using ICSSoft.Base.Config.AppConfig;
|
|
using System.Data;
|
|
using System.Data.Sql;
|
|
using System.Data.Linq;
|
|
using ICSSoft.Base.Config.DBHelper;
|
|
|
|
namespace ICSSoft.Frame.Data.DAL
|
|
{
|
|
public class ICSErrorHandleApplyDAL
|
|
{
|
|
#region Add
|
|
public static void Add(ICSErrorHandleApply info, string Appconstr)
|
|
{
|
|
FramDataContext db = new FramDataContext(Appconstr);
|
|
db.Connection.Open();
|
|
db.Transaction = db.Connection.BeginTransaction();
|
|
try
|
|
{
|
|
var line = new ICSErrorHandleApply();
|
|
line.ID = info.ID;
|
|
line.DocNo = info.DocNo;
|
|
line.ApplyDeptCode = info.ApplyDeptCode;
|
|
line.ApplyType = info.ApplyType;
|
|
line.ApplyDetail = info.ApplyDetail;
|
|
line.DocStatus = info.DocStatus;
|
|
line.Muser = info.Muser;
|
|
line.MuserName = info.MuserName;
|
|
line.MTIME = info.MTIME;
|
|
line.ApproveMuser = info.ApproveMuser;
|
|
line.ApproveMuserName = info.ApproveMuserName;
|
|
line.ApproveMTIME = info.ApproveMTIME;
|
|
line.WorkPoint = info.WorkPoint;
|
|
line.EATTRIBUTE1 = info.EATTRIBUTE1;
|
|
line.EATTRIBUTE2 = info.EATTRIBUTE2;
|
|
db.ICSErrorHandleApply.InsertOnSubmit(line);
|
|
|
|
db.SubmitChanges();
|
|
db.Transaction.Commit();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
db.Transaction.Rollback();
|
|
throw new Exception(ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 获取当天最新的单据号
|
|
public static string GetDocNo(string dsconn)
|
|
{
|
|
try
|
|
{
|
|
string DocNo = "";
|
|
string sql = @"select top 1 DocNo from ICSErrorHandleApply
|
|
WHERE WorkPoint='{0}'
|
|
ORDER BY MTIME DESC";
|
|
sql = string.Format(sql, AppConfig.WorkPointCode);
|
|
DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
|
|
if (dt.Rows.Count == 0)
|
|
{
|
|
DocNo = "";
|
|
}
|
|
else
|
|
{
|
|
DocNo = dt.Rows[0]["DocNo"].ToString();
|
|
}
|
|
return DocNo;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception(ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 删除
|
|
public static void deleteInfo(List<string> idList, string dsconn)
|
|
{
|
|
FramDataContext db = new FramDataContext(dsconn);
|
|
db.Connection.Open();
|
|
db.Transaction = db.Connection.BeginTransaction();
|
|
try
|
|
{
|
|
foreach (string id in idList)
|
|
{
|
|
var line = db.ICSErrorHandleApply.SingleOrDefault(a => a.ID == id);
|
|
db.ICSErrorHandleApply.DeleteOnSubmit(line);
|
|
}
|
|
db.SubmitChanges();
|
|
db.Transaction.Commit();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
db.Transaction.Rollback();
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 审核
|
|
public static void DocApprove(List<string> idList, string dsconn)
|
|
{
|
|
FramDataContext db = new FramDataContext(dsconn);
|
|
db.Connection.Open();
|
|
db.Transaction = db.Connection.BeginTransaction();
|
|
try
|
|
{
|
|
foreach (string id in idList)
|
|
{
|
|
var line = db.ICSErrorHandleApply.SingleOrDefault(a => a.ID == id);
|
|
line.DocStatus = "审核";
|
|
line.ApproveMuser = AppConfig.UserCode;
|
|
line.ApproveMuserName = AppConfig.UserName;
|
|
line.ApproveMTIME = DateTime.Now;
|
|
db.SubmitChanges();
|
|
}
|
|
db.SubmitChanges();
|
|
db.Transaction.Commit();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
db.Transaction.Rollback();
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 弃审
|
|
public static void DocCancelApprove(List<string> idList, string dsconn)
|
|
{
|
|
FramDataContext db = new FramDataContext(dsconn);
|
|
db.Connection.Open();
|
|
db.Transaction = db.Connection.BeginTransaction();
|
|
try
|
|
{
|
|
foreach (string id in idList)
|
|
{
|
|
var line = db.ICSErrorHandleApply.SingleOrDefault(a => a.ID == id);
|
|
line.DocStatus = "新增";
|
|
line.ApproveMuser = AppConfig.UserCode;
|
|
line.ApproveMuserName = AppConfig.UserName;
|
|
line.ApproveMTIME = DateTime.Now;
|
|
db.SubmitChanges();
|
|
}
|
|
db.SubmitChanges();
|
|
db.Transaction.Commit();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
db.Transaction.Rollback();
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
}
|