public static int UpdateDriver(Entity.Driver entity) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(DAL.Config.con); IDbTransaction trans = thelper.StartTransaction(); try { IDbDataParameter[] prams = { dbFactory.MakeInParam("@ID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.ID.GetType().ToString()), entity.ID, 32), dbFactory.MakeInParam("@RealName", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.RealName.GetType().ToString()), entity.RealName, 20), dbFactory.MakeInParam("@CarNumber", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.CarNumber.GetType().ToString()), entity.CarNumber, 20), dbFactory.MakeInParam("@UpdateUser", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.UpdateUser.GetType().ToString()), entity.UpdateUser, 50), dbFactory.MakeInParam("@UpdateDate", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.UpdateDate.GetType().ToString()), entity.UpdateDate, 0), dbFactory.MakeInParam("@IsStop", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.IsStop.GetType().ToString()), entity.IsStop, 4) }; iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_Driver_Update", prams); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
public static int UpdateAnalysisItem(Entity.AnalysisItem entity) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(DAL.Config.con); IDbTransaction trans = thelper.StartTransaction(); try { //IDbDataParameter[] prams = { // dbFactory.MakeInParam("@ItemID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.ItemID.GetType().ToString()),entity.ItemID,32), // dbFactory.MakeInParam("@ItemCode", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.ItemCode.GetType().ToString()),entity.ItemCode,20), // dbFactory.MakeInParam("@ItemName", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.ItemName.GetType().ToString()),entity.ItemName,50), // dbFactory.MakeInParam("@OrderID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.OrderID.GetType().ToString()),entity.OrderID,32), // dbFactory.MakeInParam("@IsShow", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.IsShow.GetType().ToString()),entity.IsShow,32), // dbFactory.MakeInParam("@Unit", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Unit.GetType().ToString()),entity.Unit,20) //}; //iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_AnalysisItem_Update", prams); iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Update [AnalysisItem] set ItemCode='"+ entity.ItemCode + "',ItemName='" + entity.ItemName + "',OrderID='" + entity.OrderID + "',IsShow='" + entity.IsShow + "',Unit='" + entity.Unit + "'where ItemID='" + entity.ItemID + "'", null); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
/// <summary> /// /// </summary> /// <param name="DetailID"> </param> /// <returns></returns> public static int DeleteProductDetail(int DetailID) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(DAL.Config.con); IDbTransaction trans = thelper.StartTransaction(); try { iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Delete from [ProductDetail] where DetailID='" + DetailID + "'", null); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
/// <summary> /// /// </summary> /// <param name="DealID"> </param> /// <param name="Status"> </param> /// <returns></returns> public static int UpdateFinalWasteLogEx(Entity.FinalWasteLog entity) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(DAL.Config.con); IDbTransaction trans = thelper.StartTransaction(); try { iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Update [FinalWasteLog] set UpdateDate='"+ entity.UpdateDate + "',UpdateUser='******',Status='" + entity.Status + "'where LogID='" + entity.LogID + "'", null); iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Update [FinalWaste] set Status='"+ entity.Status + "' where LogID='" + entity.LogID + "'", null); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
public static int UpdateArea(Entity.Area entity) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(DAL.Config.con); IDbTransaction trans = thelper.StartTransaction(); try { IDbDataParameter[] prams = { dbFactory.MakeInParam("@ID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.ID.GetType().ToString()), entity.ID, 32), dbFactory.MakeInParam("@AreaCode", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.AreaCode.GetType().ToString()), entity.AreaCode, 32), dbFactory.MakeInParam("@FullName", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.FullName.GetType().ToString()), entity.FullName, 20), dbFactory.MakeInParam("@LetterCode", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.LetterCode.GetType().ToString()), entity.LetterCode, 10), dbFactory.MakeInParam("@ShortName", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.ShortName.GetType().ToString()), entity.ShortName, 20), dbFactory.MakeInParam("@IsDelete", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.IsDelete.GetType().ToString()), entity.IsDelete, 32), dbFactory.MakeInParam("@OrderID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.OrderID.GetType().ToString()), entity.OrderID, 32) }; iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_Area_Update", prams); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
public static int AddPosition(Entity.Position entity) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(DAL.Config.con); IDbTransaction trans = thelper.StartTransaction(); try { iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Insert into [Position]([Name],[OrderID],[IsShow]) values ('" + entity.Name + "','" + entity.OrderID + "','" + entity.IsShow + "')", null); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
public static int UpdateMenu(Entity.Menu entity) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(DAL.Config.con); IDbTransaction trans = thelper.StartTransaction(); try { IDbDataParameter[] prams = { dbFactory.MakeInParam("@ID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.ID.GetType().ToString()), entity.ID, 32), dbFactory.MakeInParam("@FatherID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.FatherID.GetType().ToString()), entity.FatherID, 32), dbFactory.MakeInParam("@MenuName", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.MenuName.GetType().ToString()), entity.MenuName, 50), dbFactory.MakeInParam("@ImageUrl", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.ImageUrl.GetType().ToString()), entity.ImageUrl, 0), dbFactory.MakeInParam("@MenuUrl", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.MenuUrl.GetType().ToString()), entity.MenuUrl, 50), dbFactory.MakeInParam("@MenuOrder", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.MenuOrder.GetType().ToString()), entity.MenuOrder, 32), dbFactory.MakeInParam("@MenuFile", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.MenuFile.GetType().ToString()), entity.MenuFile, 50) }; iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_Menu_Update", prams); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
/// <summary> /// /// </summary> /// <param name="UserID"> </param> /// <param name="RoleID"> </param> /// <returns></returns> public static int AddUserRole(Entity.UserRole userRole) { int iReturn = 0; int i = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(Config.con); IDbTransaction trans = thelper.StartTransaction(); try { iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Insert into [User]([UserName],[PassWord],[GUID],[RealName],[PwdChgDate],[CreateUser],[CreateDate],[UpdateUser],[UpdateDate],[IsStop]) values ('" + userRole.user.UserName + "','" + userRole.user.PassWord + "','" + userRole.user.GUID + "','" + userRole.user.RealName + "','" + userRole.user.PwdChgDate + "','" + userRole.user.CreateUser + "','" + userRole.user.CreateDate + "','" + userRole.user.UpdateUser + "','" + userRole.user.UpdateDate + "','" + userRole.user.IsStop + "')", null); foreach (Entity.Role role in userRole.role) { iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Insert into [UserRole]([UGuid],[RoleID]) values ('" + userRole.user.GUID + "','" + role.ID + "')", null); } thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
public static int UpdateAnalysisResult(Entity.AnalysisResult entity) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(DAL.Config.con); IDbTransaction trans = thelper.StartTransaction(); try { IDbDataParameter[] prams = { dbFactory.MakeInParam("@ResultID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.ResultID.GetType().ToString()), entity.ResultID, 32), dbFactory.MakeInParam("@BillNumber", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.BillNumber.GetType().ToString()), entity.BillNumber, 20), dbFactory.MakeInParam("@ItemCode", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.ItemCode.GetType().ToString()), entity.ItemCode, 20), dbFactory.MakeInParam("@Result", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Result.GetType().ToString()), entity.Result, 10) }; iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_AnalysisResult_Update", prams); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
/// <summary> /// /// </summary> /// <param name="DealID"> </param> /// <param name="Status"> </param> /// <returns></returns> public static int PassWasteToProduct(Entity.WasteToProduct entity, decimal Used, List <Entity.ProductDetail> lists) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(DAL.Config.con); IDbTransaction trans = thelper.StartTransaction(); try { //lists中的成品Amount存罐池使用量 iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Update [WasteToProduct] set Status='"+ entity.Status + "' where DealID='" + entity.DealID + "'", null); iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Insert into [PondUsed]([PondID],[Used],[SourceType],[TypeName],[CreateUser],[CreateDate]) values ('" + entity.FromPondID + "','" + Used + "','2','废酸出库','" + entity.CreateUser + "','" + entity.CreateDate + "')", null); foreach (Entity.ProductDetail list in lists) { iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Update [ProductDetail] set Status=2 where DetailID='"+ list.DetailID + "'", null); iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Insert into [PondUsed]([PondID],[Used],[SourceType],[TypeName],[CreateUser],[CreateDate]) values ('" + list.PondID + "','" + list.Amount + "','3','成品入库','" + entity.CreateUser + "','" + entity.CreateDate + "')", null); iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Update [Pond] set Used='"+ list.Amount + "'where PondID='" + list.PondID + "'", null); } thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
public static int AddPondUsed(Entity.PondUsed entity) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(DAL.Config.con); IDbTransaction trans = thelper.StartTransaction(); try { iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Insert into [PondUsed]([PondID],[Used],[SourceType],[TypeName],[CreateUser],[CreateDate]) values ('" + entity.PondID + "','" + entity.Used + "','" + entity.SourceType + "','" + entity.TypeName + "','" + entity.CreateUser + "','" + entity.CreateDate + "')", null); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
/// <summary> /// 删除用户-ID /// </summary> /// <param name="ID"></param> /// <returns>int</returns> public int DeleteUsers(int ID) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(Config.constr); IDbTransaction trans = thelper.StartTransaction(); try { IDbDataParameter[] prams = { dbFactory.MakeInParam("@ID", DBTypeConverter.ConvertCsTypeToOriginDBType(ID.GetType().ToString()), ID, 0) }; iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_User_Delete", prams); db.ExecuteNonQueryTrans(trans, CommandType.Text, "delete from t_R_UserArea where UserID='" + ID + "'", prams); thelper.CommitTransaction(trans); } catch (Exception ex) { iReturn = 0; thelper.RollTransaction(trans); Comm.EsbLogger.Log(ex.GetType().ToString(), ex.Message.ToString(), 0, ErrorLevel.Fatal); } finally { db.Conn.Close(); } return(iReturn); }
/// <summary> /// /// </summary> /// <param name="StorageID"> </param> /// <param name="UpdateDate"> </param> /// <param name="UpdateUser"> </param> /// <param name="Status"> </param> /// <returns></returns> public static int UpdateWasteStorageStatus(int StorageID, DateTime UpdateDate, string UpdateUser, int Status) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(DAL.Config.con); IDbTransaction trans = thelper.StartTransaction(); try { iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Update [WasteStorage] set UpdateDate='"+ UpdateDate + "',UpdateUser='******',Status='" + Status + "'where StorageID='" + StorageID + "'", null); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
public static int PassWasteStorage(Entity.WasteStorage entity, decimal Used) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(DAL.Config.con); IDbTransaction trans = thelper.StartTransaction(); try { iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Update [WasteStorage] set UpdateDate='"+ entity.UpdateDate + "',UpdateUser='******',Status='" + entity.Status + "'where StorageID='" + entity.StorageID + "'", null); iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Insert into [PondUsed]([PondID],[Used],[SourceType],[TypeName],[CreateUser],[CreateDate]) values ('" + entity.PondID + "','" + Used + "','1','废酸入库','" + entity.CreateUser + "','" + entity.CreateDate + "')", null); iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Update [Pond] set Used='"+ Used + "'where PondID='" + entity.PondID + "'", null); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
/// <summary> /// SetUserMenuRight /// </summary> /// <param name="id"></param> /// <returns></returns> public int InsertUserMenuRight(int UserID, string MenuID, string NuMenuID) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(Config.constr); IDbTransaction trans = thelper.StartTransaction(); try { IDbDataParameter[] prams = { }; string[] list = MenuID.Split(','); for (int i = 0; i < list.Length; i++) { if (list[i] != "") { db.ExecuteNonQueryTrans(trans, CommandType.Text, String.Format("Insert into [t_R_User_IsWrite] (userid,menuid, isWrite,createdate) values('{0}',{1},'{2}',getdate())", UserID, list[i], '1'), prams); } } thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); Comm.EsbLogger.Log(ex.GetType().ToString(), ex.Message.ToString(), 0, ErrorLevel.Fatal); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
public static int AddFinalWaste(Entity.FinalWaste entity) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(DAL.Config.con); IDbTransaction trans = thelper.StartTransaction(); try { IDbDataParameter[] prams = { dbFactory.MakeInParam("@LogID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.LogID.GetType().ToString()), entity.LogID, 32), dbFactory.MakeInParam("@ItemCode", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.ItemCode.GetType().ToString()), entity.ItemCode, 20), dbFactory.MakeInParam("@Result", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Result.GetType().ToString()), entity.Result, 10), dbFactory.MakeInParam("@Status", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Status.GetType().ToString()), entity.Status, 32), dbFactory.MakeOutReturnParam() }; iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_FinalWaste_Add", prams); iReturn = int.Parse(prams[4].Value.ToString()); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
public static int UpdatePosition(Entity.Position entity) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(DAL.Config.con); IDbTransaction trans = thelper.StartTransaction(); try { iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Update [Position] set Name='"+ entity.Name + "',OrderID='" + entity.OrderID + "',IsShow='" + entity.IsShow + "'where ID='" + entity.ID + "'", null); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
public static int PassMonitor(Entity.Monitor entity) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(DAL.Config.con); IDbTransaction trans = thelper.StartTransaction(); try { //IDbDataParameter[] prams = { // dbFactory.MakeInParam("@AnalysisID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.AnalysisID.GetType().ToString()),entity.AnalysisID,32), // dbFactory.MakeInParam("@Status", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Status.GetType().ToString()),entity.Status,32) //}; //iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_Analysis_UpdateStatus", prams); iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Update [Monitor] set Status='"+ entity.Status + "',UpdateDate='" + entity.UpdateDate + "',UpdateUser='******'where MonitorID='" + entity.MonitorID + "'", null); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
public static int UpdatePond(Entity.Pond entity) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(DAL.Config.con); IDbTransaction trans = thelper.StartTransaction(); try { IDbDataParameter[] prams = { dbFactory.MakeInParam("@PondID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.PondID.GetType().ToString()), entity.PondID, 32), dbFactory.MakeInParam("@Name", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Name.GetType().ToString()), entity.Name, 20), dbFactory.MakeInParam("@Capacity", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Capacity.GetType().ToString()), entity.Capacity, 10), dbFactory.MakeInParam("@Stores", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Stores.GetType().ToString()), entity.Stores, 20), dbFactory.MakeInParam("@Number", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Number.GetType().ToString()), entity.Number, 32), //dbFactory.MakeInParam("@Remain", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Remain.GetType().ToString()),entity.Remain,10), dbFactory.MakeInParam("@IsDelete", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.IsDelete.GetType().ToString()), entity.IsDelete, 32) }; iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_Pond_Update", prams); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
/// <summary> /// /// </summary> /// <param name="AnalysisID"> </param> /// <returns></returns> public static int DeleteMonitor(int MonitorID) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(DAL.Config.con); IDbTransaction trans = thelper.StartTransaction(); try { iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Delete from [Monitor] where MonitorID='" + MonitorID + "'", null); //string BillNumber = DAL.Analysis.GetAnalysisByID(AnalysisID).BillNumber; iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Delete from [MonitorResult] where MonitorID='" + MonitorID + "'", null); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
public static int UpdateFinalWasteLog(Entity.FinalWasteLog entity) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(DAL.Config.con); IDbTransaction trans = thelper.StartTransaction(); try { IDbDataParameter[] prams = { dbFactory.MakeInParam("@LogID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.LogID.GetType().ToString()), entity.LogID, 32), dbFactory.MakeInParam("@DateTime", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.DateTime.GetType().ToString()), entity.DateTime, 0), dbFactory.MakeInParam("@UserID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.UserID.GetType().ToString()), entity.UserID, 32), dbFactory.MakeInParam("@UpdateDate", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.UpdateDate.GetType().ToString()), entity.UpdateDate, 0), dbFactory.MakeInParam("@UpdateUser", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.UpdateUser.GetType().ToString()), entity.UpdateUser, 50), dbFactory.MakeInParam("@Status", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Status.GetType().ToString()), entity.Status, 32) }; iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_FinalWasteLog_Update", prams); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
public static int AddPondLog(Entity.PondLog entity, decimal U1, decimal R1, decimal U2, decimal R2) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(DAL.Config.con); IDbTransaction trans = thelper.StartTransaction(); try { IDbDataParameter[] prams = { dbFactory.MakeInParam("@SourceID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.SourceID.GetType().ToString()), entity.SourceID, 32), dbFactory.MakeInParam("@ToID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.ToID.GetType().ToString()), entity.ToID, 32), dbFactory.MakeInParam("@CreateDate", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.CreateDate.GetType().ToString()), entity.CreateDate, 0), dbFactory.MakeInParam("@CreateUser", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.CreateUser.GetType().ToString()), entity.CreateUser, 50), dbFactory.MakeInParam("@Amount", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Amount.GetType().ToString()), entity.Amount, 10) }; iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_PondLog_Add", prams); iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Update [Pond] set Used='"+ U1 + "',Remain='" + R1 + "' where PondID='" + entity.SourceID + "'", null); iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Update [Pond] set Used='"+ U2 + "',Remain='" + R2 + "' where PondID='" + entity.ToID + "'", null); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
/// <summary> /// /// </summary> /// <param name="PlanID"> </param> /// <param name="StatusID"> </param> /// <returns></returns> public static int UpdateTransferPlanStatus(int PlanID, int StatusID) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(DAL.Config.con); IDbTransaction trans = thelper.StartTransaction(); try { iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Update [TransferPlan] set StatusID='"+ StatusID + "' where PlanID='" + PlanID + "'", null); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
public static int AddWaste(Entity.Waste entity) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(DAL.Config.con); IDbTransaction trans = thelper.StartTransaction(); try { IDbDataParameter[] prams = { dbFactory.MakeInParam("@WasteCode", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.WasteCode.GetType().ToString()), entity.WasteCode, 20), dbFactory.MakeInParam("@WasteName", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.WasteName.GetType().ToString()), entity.WasteName, 50), dbFactory.MakeInParam("@List", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.List.GetType().ToString()), entity.List, 50), dbFactory.MakeInParam("@Type", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Type.GetType().ToString()), entity.Type, 32), dbFactory.MakeInParam("@Unit", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Unit.GetType().ToString()), entity.Unit, 20), dbFactory.MakeInParam("@OrderID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.OrderID.GetType().ToString()), entity.OrderID, 32), dbFactory.MakeInParam("@IsShow", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.IsShow.GetType().ToString()), entity.IsShow, 32) }; iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_Waste_Add", prams); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
public int DeleteRole(int RoleID) { string sqlstr = @"Delete from t_R_Role where RoleID='" + RoleID + "'"; string sqlstr2 = @"Delete from t_R_RoleMenu where roleid='" + RoleID + "'"; int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(Config.constr); IDbTransaction trans = thelper.StartTransaction(); try { IDbDataParameter[] prams = { }; db.ExecuteNonQueryTrans(trans, CommandType.Text, sqlstr, prams); db.ExecuteNonQueryTrans(trans, CommandType.Text, sqlstr2, prams); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { iReturn = 0; thelper.RollTransaction(trans); Comm.EsbLogger.Log(ex.GetType().ToString(), ex.Message.ToString(), 0, ErrorLevel.Fatal); } finally { db.Conn.Close(); } return(iReturn); }
/// <summary> /// /// </summary> /// <param name="OutID"> </param> /// <param name="Status"> </param> /// <returns></returns> public static int UpdateProductOutStatus(int OutID, int Status) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(DAL.Config.con); IDbTransaction trans = thelper.StartTransaction(); try { IDbDataParameter[] prams = { dbFactory.MakeInParam("@OutID", DBTypeConverter.ConvertCsTypeToOriginDBType(OutID.GetType().ToString()), OutID, 32), dbFactory.MakeInParam("@Status", DBTypeConverter.ConvertCsTypeToOriginDBType(Status.GetType().ToString()), Status, 32) }; iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_ProductOut_UpdateStatus", prams); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
public static int UpdateProductDetail(Entity.ProductDetail entity) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(DAL.Config.con); IDbTransaction trans = thelper.StartTransaction(); try { IDbDataParameter[] prams = { dbFactory.MakeInParam("@DetailID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.DetailID.GetType().ToString()), entity.DetailID, 32), dbFactory.MakeInParam("@ItemCode", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.ItemCode.GetType().ToString()), entity.ItemCode, 20), dbFactory.MakeInParam("@PondID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.PondID.GetType().ToString()), entity.PondID, 32), dbFactory.MakeInParam("@Status", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Status.GetType().ToString()), entity.Status, 32), dbFactory.MakeInParam("@Amount", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Amount.GetType().ToString()), entity.Amount, 10) }; iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_ProductDetail_Update", prams); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
/// <summary> /// /// </summary> /// <param name="OutID"> </param> /// <param name="Status"> </param> /// <returns></returns> public static int PassProductOut(Entity.ProductOut entity, decimal Used) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(DAL.Config.con); IDbTransaction trans = thelper.StartTransaction(); try { IDbDataParameter[] prams = { dbFactory.MakeInParam("@OutID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.OutID.GetType().ToString()), entity.OutID, 32), dbFactory.MakeInParam("@Status", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Status.GetType().ToString()), entity.Status, 32) }; iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_ProductOut_UpdateStatus", prams); iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Insert into [PondUsed]([PondID],[Used],[SourceType],[TypeName],[CreateUser],[CreateDate]) values ('" + entity.PondID + "','" + Used + "','4','成品出库','" + entity.CreateUser + "','" + entity.CreateDate + "')", null); iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Update [Pond] set Used='"+ Used + "'where PondID='" + entity.PondID + "'", null); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
/// <summary> /// /// </summary> /// <param name="ResultID"> </param> /// <returns></returns> public static int DeleteMonitorResult(int ResultID) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(DAL.Config.con); IDbTransaction trans = thelper.StartTransaction(); try { IDbDataParameter[] prams = { dbFactory.MakeInParam("@ResultID", DBTypeConverter.ConvertCsTypeToOriginDBType(ResultID.GetType().ToString()), ResultID, 32) }; iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_MonitorResult_Delete", prams); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
public static int AddMonitorItem(Entity.MonitorItem entity) { int iReturn = 0; DBOperatorBase db = new DataBase(); IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory(); SqlTransactionHelper thelper = new SqlTransactionHelper(DAL.Config.con); IDbTransaction trans = thelper.StartTransaction(); try { //IDbDataParameter[] prams = { // dbFactory.MakeInParam("@ItemCode", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.ItemCode.GetType().ToString()),entity.ItemCode,20), // dbFactory.MakeInParam("@ItemName", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.ItemName.GetType().ToString()),entity.ItemName,50), // dbFactory.MakeInParam("@OrderID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.OrderID.GetType().ToString()),entity.OrderID,32), // dbFactory.MakeInParam("@IsShow", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.IsShow.GetType().ToString()),entity.IsShow,32) //}; //iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_AnalysisItem_Add", prams); iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Insert into [MonitorItem]([ItemCode],[ItemName],[OrderID],[IsShow],[Unit]) values ('" + entity.ItemCode + "','" + entity.ItemName + "','" + entity.OrderID + "','" + entity.IsShow + "','" + entity.Unit + "')", null); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }