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); }
public static int PassAnalysis(Entity.Analysis entity,int StorageID) { 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 [Analysis] set Status='" + entity.Status + "',UpdateDate='" + entity.UpdateDate + "',UpdateUser='******'where AnalysisID='" + entity.AnalysisID + "'", null); iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Update [WasteStorage] set Status='4' where StorageID='" + StorageID + "'", null); 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); }
/// <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); }
/// <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); }
/// <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); }
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> /// /// </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); }
///// <summary> ///// ///// </summary> ///// <param name="DealID"> </param> ///// <param name="Status"> </param> ///// <returns></returns> //public static int PassFinalWasteLog(Entity.FinalWasteLog 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 [FinalWasteLog] 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; //} /// <summary> /// /// </summary> /// <param name="DealID"> </param> /// <returns></returns> public static int DeleteFinalWasteLog(int LogID) { 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 [FinalWasteLog] where LogID='" + LogID + "'", null); iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Delete from [FinalWaste] where LogID='" + LogID + "'", null); thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
public static int AddWasteToProductEntity(Entity.WasteToProduct entity, List <Entity.ProductDetail> products) { 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("@FromPondID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.FromPondID.GetType().ToString()), entity.FromPondID, 32), dbFactory.MakeInParam("@FromWasteCode", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.FromWasteCode.GetType().ToString()), entity.FromWasteCode, 20), dbFactory.MakeInParam("@DateTime", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.DateTime.GetType().ToString()), entity.DateTime, 0), dbFactory.MakeInParam("@FromAmount", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.FromAmount.GetType().ToString()), entity.FromAmount, 10), dbFactory.MakeInParam("@HanderManID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.HanderManID.GetType().ToString()), entity.HanderManID, 32), dbFactory.MakeInParam("@ReceiverID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.ReceiverID.GetType().ToString()), entity.ReceiverID, 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("@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), dbFactory.MakeOutReturnParam() }; iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_WasteToProduct_Add", prams); iReturn = int.Parse(prams[11].Value.ToString()); int DealID = int.Parse(prams[11].Value.ToString()); foreach (Entity.ProductDetail product in products) { IDbDataParameter[] pramse = { dbFactory.MakeInParam("@WTPID", DBTypeConverter.ConvertCsTypeToOriginDBType(DealID.GetType().ToString()), DealID, 32), dbFactory.MakeInParam("@ItemCode", DBTypeConverter.ConvertCsTypeToOriginDBType(product.ItemCode.GetType().ToString()), product.ItemCode, 20), dbFactory.MakeInParam("@PondID", DBTypeConverter.ConvertCsTypeToOriginDBType(product.PondID.GetType().ToString()), product.PondID, 32), dbFactory.MakeInParam("@Status", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Status.GetType().ToString()), entity.Status, 32), dbFactory.MakeInParam("@Amount", DBTypeConverter.ConvertCsTypeToOriginDBType(product.Amount.GetType().ToString()), product.Amount, 10) }; iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_ProductDetail_Add", pramse); } //foreach (Entity.FinalWaste waste in wastes) //{ // iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Insert into [FinalWaste]([DealID],[ItemCode],[Result],[Status]) values ('" + DealID + "','" + waste.ItemCode + "','" + waste.Result + "','" + entity.Status + "')", null); //} thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
public static int UpdateFinalWasteLogEntity(Entity.FinalWasteLog entity, List <Entity.FinalWaste> Adds2, List <Entity.FinalWaste> Update2, List <Entity.FinalWaste> Delete2) { 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); foreach (Entity.FinalWaste add in Adds2) { iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Insert into [FinalWaste]([LogID],[ItemCode],[Result],[Status]) values ('" + entity.LogID + "','" + add.ItemCode + "','" + add.Result + "','" + add.Status + "')", null); } foreach (Entity.FinalWaste update in Update2) { IDbDataParameter[] pramsf = { dbFactory.MakeInParam("@FWID", DBTypeConverter.ConvertCsTypeToOriginDBType(update.FWID.GetType().ToString()), update.FWID, 32), dbFactory.MakeInParam("@LogID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.LogID.GetType().ToString()), entity.LogID, 32), dbFactory.MakeInParam("@ItemCode", DBTypeConverter.ConvertCsTypeToOriginDBType(update.ItemCode.GetType().ToString()), update.ItemCode, 20), dbFactory.MakeInParam("@Result", DBTypeConverter.ConvertCsTypeToOriginDBType(update.Result.GetType().ToString()), update.Result, 10), dbFactory.MakeInParam("@Status", DBTypeConverter.ConvertCsTypeToOriginDBType(update.Status.GetType().ToString()), update.Status, 32) }; iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_FinalWaste_Update", pramsf); } foreach (Entity.FinalWaste delete in Delete2) { iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Delete from [FinalWaste] where FWID='" + delete.FWID + "'", null); } thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
/// <summary> /// /// </summary> /// <param name="RoleID"> </param> /// <param name="MenuID"> </param> /// <returns></returns> public static int AddRoleMenu(Entity.RoleMenu roleMenu) { 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 { IDbDataParameter[] prams = { dbFactory.MakeInParam("@RoleName", DBTypeConverter.ConvertCsTypeToOriginDBType(roleMenu.role.RoleName.GetType().ToString()), roleMenu.role.RoleName, 20), dbFactory.MakeInParam("@Description", DBTypeConverter.ConvertCsTypeToOriginDBType(roleMenu.role.Description.GetType().ToString()), roleMenu.role.Description, 0), //dbFactory.MakeInParam("@IsAudit", DBTypeConverter.ConvertCsTypeToOriginDBType(roleMenu.role.IsAudit.GetType().ToString()),roleMenu.role.IsAudit,4), dbFactory.MakeOutReturnParam() }; iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_Role_Add", prams); i = int.Parse(prams[2].Value.ToString()); if (i > 0) { roleMenu.role.ID = i; } if (i == 0) { return(0); } for (int s = 0; s < roleMenu.menuList.Count; s++) { iReturn = db.ExecuteNonQueryTrans(trans, CommandType.Text, "Insert into [RoleMenu]([RoleID],[MenuID]) values ('" + roleMenu.role.ID + "','" + roleMenu.menuList[s].ID + "')", null); } thelper.CommitTransaction(trans); iReturn = 1; } catch (Exception ex) { thelper.RollTransaction(trans); iReturn = 0; } finally { db.Conn.Close(); } return(iReturn); }
public static int AddMonitorEntity(Entity.Monitor entity, List <Entity.MonitorResult> results) { 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("@PositionID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.PositionID.GetType().ToString()), entity.PositionID, 32), dbFactory.MakeInParam("@DateTime", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.DateTime.GetType().ToString()), entity.DateTime, 0), dbFactory.MakeInParam("@AnalysisManID", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.AnalysisManID.GetType().ToString()), entity.AnalysisManID, 32), dbFactory.MakeInParam("@Status", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.Status.GetType().ToString()), entity.Status, 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("@UpdateDate", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.UpdateDate.GetType().ToString()), entity.UpdateDate, 0), dbFactory.MakeInParam("@UpdateUser", DBTypeConverter.ConvertCsTypeToOriginDBType(entity.UpdateUser.GetType().ToString()), entity.UpdateUser, 50), dbFactory.MakeOutReturnParam() }; iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_Monitor_Add", prams); iReturn = int.Parse(prams[8].Value.ToString()); int MonitorID = int.Parse(prams[8].Value.ToString()); foreach (Entity.MonitorResult result in results) { IDbDataParameter[] pramse = { dbFactory.MakeInParam("@MonitorID", DBTypeConverter.ConvertCsTypeToOriginDBType(MonitorID.GetType().ToString()), MonitorID, 32), dbFactory.MakeInParam("@ItemCode", DBTypeConverter.ConvertCsTypeToOriginDBType(result.ItemCode.GetType().ToString()), result.ItemCode, 20), dbFactory.MakeInParam("@Result", DBTypeConverter.ConvertCsTypeToOriginDBType(result.Result.GetType().ToString()), result.Result, 10) }; iReturn = db.ExecuteNonQueryTrans(trans, CommandType.StoredProcedure, "proc_MonitorResult_Add", pramse); } 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); }
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 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 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 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); }
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); }
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); }
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); }
/// <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 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 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="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 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); }
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); }
/// <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); }
/// <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); }