protected int Delete(Entry2Model model, UserInfo sysUser, string pkValue, string viewTitle) { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("styleId", pkValue); string sql = @"select * from AppLabelStyle where styleId=@styleId"; DataTable dt = AppMember.DbHelper.GetDataSet(sql, paras).Tables[0]; dt.TableName = "AppLabelStyle"; dt.Rows[0].Delete(); return(DbUpdate.Update(dt)); }
protected override int Delete(EntryViewModel model, UserInfo sysUser, string pkValue, string viewTitle) { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("purchaseTypeId", pkValue); string sql = @"select * from PurchaseType where purchaseTypeId=@purchaseTypeId"; DataTable dt = AppMember.DbHelper.GetDataSet(sql, paras).Tables[0]; dt.TableName = "PurchaseType"; dt.Rows[0].Delete(); return(DbUpdate.Update(dt)); }
protected virtual int UpdateAssetsState(string assetsId, string assetsState, string sysUser, string viewTitle) { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("assetsId", assetsId); string sql = @"select * from Assets where assetsId=@assetsId"; DataTable dtAssets = AppMember.DbHelper.GetDataSet(sql, paras, DbUpdate.cmd).Tables[0]; dtAssets.TableName = "Assets"; dtAssets.Rows[0]["assetsState"] = assetsState; Update5Field(dtAssets, sysUser, viewTitle); return(DbUpdate.Update(dtAssets)); }
protected override int Delete(EntryViewModel model, UserInfo sysUser, string pkValue, string viewTitle) { Dictionary<string, object> paras = new Dictionary<string, object>(); paras.Add("AssetsSplitId", pkValue); string sql = @"select * from AssetsSplit where AssetsSplitId=@AssetsSplitId"; DataTable dt = AppMember.DbHelper.GetDataSet(sql, paras, DbUpdate.cmd).Tables[0]; dt.TableName = "AssetsSplit"; dt.Rows[0].Delete(); DbUpdate.Update(dt); DeleteDetail(pkValue, sysUser, viewTitle); DeleteApproveData("AssetsSplit", pkValue, sysUser.UserId); return 1; }
protected override int Add(EntryViewModel model, UserInfo sysUser, string viewTitle) { string sql = @"select * from AssetsCheck where 1<>1 "; DataTable dt = AppMember.DbHelper.GetDataSet(sql, DbUpdate.cmd).Tables[0]; dt.TableName = "AssetsCheck"; DataRow dr = dt.NewRow(); string assetsCheckId = IdGenerator.GetMaxId(dt.TableName); int retApprove = InitFirstApproveTask("AssetsCheck", "AssetsCheckId", assetsCheckId, viewTitle, "", sysUser.UserId); EntryModel myModel = model as EntryModel; dr["assetsCheckNo"] = myModel.AssetsCheckNo; dr["assetsCheckName"] = myModel.AssetsCheckName; dr["checkPeople"] = myModel.CheckPeople; string updateType = "Add"; if (retApprove != 0) { dr["approveState"] = "O"; updateType = "ApproveAdd"; } dr["AssetsCheckId"] = assetsCheckId; dr["setBooksId"] = sysUser.MySetBooks.SetBooksId; dt.Rows.Add(dr); Create5Field(dt, sysUser.UserId, viewTitle); DbUpdate.Update(dt); DataTable gridData = GetEntryGridSource(myModel); //List<AssetsCheck> gridData = JsonHelper.JSONStringToList<AssetsCheck>(DataConvert.ToString(myModel.EntryGridString)); //if (gridData.Count < 1) // throw new Exception(AppMember.AppText["NeedMoreThanOneAssets"]); if (gridData.Rows.Count < 1) { throw new Exception(AppMember.AppText["NeedMoreThanOneAssets"]); } foreach (DataRow assetsCheck in gridData.Rows) { AddDetail(assetsCheck, assetsCheckId, sysUser, viewTitle, updateType, DataConvert.ToString(myModel.CheckDate)); if (retApprove != 0) { UpdateChecking(DataConvert.ToString(assetsCheck["AssetsId"]), "I", sysUser.UserId, viewTitle); } else { UpdateChecking(DataConvert.ToString(assetsCheck["AssetsId"]), "Y", sysUser.UserId, viewTitle); } } return(1); }
/// <summary> /// 更新审批状态,如果为R(退回),将这条工作流的历史审批信息设为无效(isValid='N') /// 如果为非R,同一角色下有一人审批过,将其他人的审批信息设为无效(isValid='N') /// </summary> /// <param name="sysUser"></param> /// <param name="viewTitle"></param> /// <param name="tableName"></param> /// <param name="pkField"></param> /// <param name="pkValue"></param> /// <param name="approveState"></param> /// <param name="approveMind"></param> /// <param name="approveNode"></param> /// <param name="isEndNode"></param> /// <returns></returns> public int EditData(UserInfo sysUser, string viewTitle, string tableName, string pkField, string pkValue, string approveState, string approveMind, string approveNode, bool isEndNode = false) { Dictionary <string, object> paras = new Dictionary <string, object>(); string sql = ""; if (approveState == "R") { paras.Add("tableName", tableName); paras.Add("refId", pkValue); sql = @"select * from AppApprove where tableName=@tableName and refId=@refId "; } else { paras.Add("tableName", tableName); paras.Add("refId", pkValue); paras.Add("approver", sysUser.UserId); sql = @"select * from AppApprove where tableName=@tableName and refId=@refId and approver=@approver and isValid='Y'"; } DataTable dt = AppMember.DbHelper.GetDataSet(sql, paras, DbUpdate.cmd).Tables[0]; dt.TableName = "AppApprove"; foreach (DataRow dr in dt.Rows) { if (DataConvert.ToString(dr["approver"]) == sysUser.UserId && DataConvert.ToString(dr["isValid"]) == "Y") { dr["approveMind"] = approveMind; dr["approveTime"] = DateTime.Now; dr["approveState"] = approveState; } if (approveState == "R") { dr["isValid"] = "N"; } else { dr["isValid"] = "Y"; } } Update5Field(dt, sysUser.UserId, viewTitle); DbUpdate.Update(dt); if (approveState != "A") { if (approveState != "R") { UpdateSameNodeOtherApprove(sysUser, viewTitle, tableName, pkField, pkValue, approveState, approveMind, approveNode); } OverrideRefTable(tableName, pkField, pkValue, sysUser, viewTitle, approveState, isEndNode); } return(1); }
protected int Modified(Entry2Model model, UserInfo sysUser, string pkValue, string viewTitle) { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("styleId", pkValue); string sql = @"select * from AppLabelStyle where styleId=@styleId"; DataTable dt = AppMember.DbHelper.GetDataSet(sql, paras).Tables[0]; dt.TableName = "AppLabelStyle"; //dt.Rows[0]["styleName"] = model.BarcodeStyleName; dt.Rows[0]["xmlString"] = model.XmlString; Update5Field(dt, sysUser.UserId, viewTitle); return(DbUpdate.Update(dt)); }
protected override int Delete(EntryViewModel model, UserInfo sysUser, string pkValue, string viewTitle) { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("barcodeStyleId", pkValue); string sql = @"select * from BarcodeStyle where barcodeStyleId=@barcodeStyleId"; DataTable dt = AppMember.DbHelper.GetDataSet(sql, paras).Tables[0]; dt.TableName = "BarcodeStyle"; dt.Rows[0].Delete(); DeleteDetail(pkValue); DbUpdate.Update(dt); return(1); }
/// <summary> /// /// </summary> public void RemoveObsoleteEntryInfoInProtCID() { string[] obsEntries = GetBuCompEntriesNotInPdb(); string[] dbTables = GetDbTables(ProtCidSettings.buCompConnection); DbUpdate dbDelete = new DbUpdate(ProtCidSettings.buCompConnection); foreach (string tableName in dbTables) { foreach (string obsPdbId in obsEntries) { DeleteEntryInfoFromTable(obsPdbId, tableName, ProtCidSettings.buCompQuery, dbDelete); } } }
protected override int Add(EntryViewModel model, UserInfo sysUser, string viewTitle) { string sql = @"select * from AssetsTransfer where 1<>1 "; DataTable dt = AppMember.DbHelper.GetDataSet(sql, DbUpdate.cmd).Tables[0]; dt.TableName = "AssetsTransfer"; DataRow dr = dt.NewRow(); string assetsTransferId = IdGenerator.GetMaxId(dt.TableName); int retApprove = InitFirstApproveTask("AssetsTransfer", "assetsTransferId", assetsTransferId, viewTitle, "", sysUser.UserId); EntryModel myModel = model as EntryModel; myModel.AssetsTransferId = assetsTransferId; UpdateUser(myModel, sysUser, viewTitle); dr["assetsTransferNo"] = myModel.AssetsTransferNo; dr["assetsTransferName"] = myModel.AssetsTransferName; string updateType = "Add"; if (retApprove != 0) { dr["approveState"] = "O"; updateType = "ApproveAdd"; } dr["assetsTransferId"] = assetsTransferId; dr["setBooksId"] = sysUser.MySetBooks.SetBooksId; dt.Rows.Add(dr); Create5Field(dt, sysUser.UserId, viewTitle); DbUpdate.Update(dt); List <AssetsTransfer> gridData = JsonHelper.JSONStringToList <AssetsTransfer>(DataConvert.ToString(myModel.EntryGridString)); if (gridData.Count < 1) { throw new Exception(AppMember.AppText["NeedMoreThanOneAssets"]); } foreach (AssetsTransfer assetsTransfer in gridData) { AddDetail(assetsTransfer, myModel, assetsTransferId, sysUser, viewTitle, updateType); if (retApprove == 0) { UpdateAssets(assetsTransfer.AssetsId, DataConvert.ToString(myModel.DepartmentId), DataConvert.ToString(myModel.StoreSiteId), DataConvert.ToString(myModel.Keeper), DataConvert.ToString(myModel.UsePeople), sysUser.UserId, viewTitle, assetsTransfer.AssetsStateId); } else { UpdateAssetsState(assetsTransfer.AssetsId, "TI", sysUser.UserId, viewTitle); } } return(1); }
protected int DeleteDetail(string pkValue, UserInfo sysUser, string viewTitle) { Dictionary<string, object> paras = new Dictionary<string, object>(); paras.Add("AssetsSplitId", pkValue); string sql = @"select * from AssetsSplitDetail where AssetsSplitId=@AssetsSplitId"; DataTable dt = AppMember.DbHelper.GetDataSet(sql, paras).Tables[0]; dt.TableName = "AssetsSplitDetail"; foreach (DataRow dr in dt.Rows) { UpdateAssetsState(DataConvert.ToString(dr["assetsId"]), "A", sysUser.UserId, viewTitle); dr.Delete(); } return DbUpdate.Update(dt); }
protected override int Add(EntryViewModel model, UserInfo sysUser, string viewTitle) { string sql = @"select * from AssetsMerge where 1<>1 "; DataTable dt = AppMember.DbHelper.GetDataSet(sql, DbUpdate.cmd).Tables[0]; dt.TableName = "AssetsMerge"; DataRow dr = dt.NewRow(); string assetsMergeId = IdGenerator.GetMaxId(dt.TableName); int retApprove = InitFirstApproveTask("AssetsMerge", "AssetsMergeId", assetsMergeId, viewTitle, "", sysUser.UserId); EntryModel myModel = model as EntryModel; dr["assetsMergeNo"] = myModel.AssetsMergeNo; dr["assetsMergeName"] = myModel.AssetsMergeName; string updateType = "Add"; if (retApprove != 0) { dr["approveState"] = "O"; updateType = "ApproveAdd"; } dr["AssetsMergeId"] = assetsMergeId; dr["setBooksId"] = sysUser.MySetBooks.SetBooksId; dt.Rows.Add(dr); Create5Field(dt, sysUser.UserId, viewTitle); DbUpdate.Update(dt); List <AssetsMerge> gridData = JsonHelper.JSONStringToList <AssetsMerge>(DataConvert.ToString(myModel.EntryGridString)); AssetsMerge assetsMerge = gridData[0]; assetsMerge.AssetsId = IdGenerator.GetMaxId("Assets"); List <AssetsMerge> upGridData = JsonHelper.JSONStringToList <AssetsMerge>(DataConvert.ToString(myModel.UpEntryGridString)); foreach (AssetsMerge originalAssetsMerge in upGridData) { AddDetail(assetsMerge, originalAssetsMerge, assetsMergeId, sysUser, viewTitle, updateType); if (retApprove == 0) { UpdateAssetsState(originalAssetsMerge.AssetsId, "M", sysUser.UserId, viewTitle); } else { UpdateAssetsState(originalAssetsMerge.AssetsId, "MI", sysUser.UserId, viewTitle); } } if (retApprove == 0) { AddNewAssets(assetsMerge, sysUser, viewTitle); } return(1); }
protected override int Delete(EntryViewModel model, UserInfo sysUser, string pkValue, string viewTitle) { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("approveTable", pkValue); string sql = @"select * from AppWorkFlow where approveTable=@approveTable"; DataTable dt = AppMember.DbHelper.GetDataSet(sql, paras).Tables[0]; dt.TableName = "AppWorkFlow"; dt.Rows[0].Delete(); DeleteDetail(pkValue); DeletePath(pkValue); DbUpdate.Update(dt); return(1); }
protected int DeleteDetail(string pkValue, UserInfo sysUser, string viewTitle) { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("assetsPurchaseId", pkValue); string sql = @"select * from AssetsPurchaseDetail where assetsPurchaseId=@assetsPurchaseId"; DataTable dt = AppMember.DbHelper.GetDataSet(sql, paras).Tables[0]; dt.TableName = "AssetsPurchaseDetail"; foreach (DataRow dr in dt.Rows) { dr.Delete(); } return(DbUpdate.Update(dt)); }
protected override int Modified(EntryViewModel model, UserInfo sysUser, string pkValue, string viewTitle, string formMode) { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("equityOwnerId", pkValue); string sql = @"select * from EquityOwner where equityOwnerId=@equityOwnerId"; DataTable dt = AppMember.DbHelper.GetDataSet(sql, paras).Tables[0]; dt.TableName = "EquityOwner"; EntryModel myModel = model as EntryModel; SetDataRow(myModel, dt.Rows[0]); Update5Field(dt, sysUser.UserId, viewTitle); return(DbUpdate.Update(dt)); }
protected override int Add(EntryViewModel model, UserInfo sysUser, string viewTitle) { string sql = @"select * from EquityOwner where 1<>1 "; DataTable dt = AppMember.DbHelper.GetDataSet(sql).Tables[0]; dt.TableName = "EquityOwner"; DataRow dr = dt.NewRow(); EntryModel myModel = model as EntryModel; SetDataRow(myModel, dr); dr["equityOwnerId"] = IdGenerator.GetMaxId(dt.TableName); dt.Rows.Add(dr); Create5Field(dt, sysUser.UserId, viewTitle); return(DbUpdate.Update(dt)); }
protected int EditData(Test test, string sysUser, string viewTitle) { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("testId", test.TestId); string sql = @"select * from Test where testId=@testId"; DataTable dt = AppMember.DbHelper.GetDataSet(sql, paras).Tables[0]; dt.TableName = "Test"; dt.Rows[0]["userId"] = test.UserId; dt.Rows[0]["remark"] = test.Remark; dt.Rows[0]["createTime"] = test.CreateTime; Update5Field(dt, sysUser, viewTitle); return(DbUpdate.Update(dt)); }
protected int DeletePath(string pkValue) { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("approveTable", pkValue); string sql = @"select * from AppWorkFlowPath where tableName=@approveTable"; DataTable dt = AppMember.DbHelper.GetDataSet(sql, paras).Tables[0]; dt.TableName = "AppWorkFlowPath"; foreach (DataRow dr in dt.Rows) { dr.Delete(); } DbUpdate.Update(dt); return(1); }
protected int AddData(Test test, string sysUser, string viewTitle) { string sql = @"select * from Test where 1<>1 "; DataTable dt = AppMember.DbHelper.GetDataSet(sql).Tables[0]; dt.TableName = "Test"; DataRow dr = dt.NewRow(); dr["testId"] = IdGenerator.GetMaxId(dt.TableName); dr["userId"] = test.UserId; dr["remark"] = test.Remark; dr["createTime"] = test.CreateTime; dt.Rows.Add(dr); Create5Field(dt, sysUser, viewTitle); return(DbUpdate.Update(dt)); }
protected int DeleteDetail(string pkValue) { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("barcodeStyleId", pkValue); string sql = @"select * from BarcodeStyleDetail where barcodeStyleId=@barcodeStyleId"; DataTable dt = AppMember.DbHelper.GetDataSet(sql, paras).Tables[0]; dt.TableName = "BarcodeStyleDetail"; foreach (DataRow dr in dt.Rows) { dr.Delete(); } DbUpdate.Update(dt); return(1); }
protected int AddPath(string pkValue, string pathId, string pathText, string pathFrom, string pathTo) { string sql = @"select * from AppWorkFlowPath where 1<>1 "; DataTable dt = AppMember.DbHelper.GetDataSet(sql).Tables[0]; dt.TableName = "AppWorkFlowPath"; DataRow dr = dt.NewRow(); dr["tableName"] = pkValue; dr["pathId"] = pathId; dr["pathConditon"] = pathText; dr["pathFrom"] = pathFrom; dr["pathTo"] = pathTo; dt.Rows.Add(dr); return(DbUpdate.Update(dt)); }
protected int Add(Entry2Model model, UserInfo sysUser, string viewTitle) { string sql = @"select * from AppLabelStyle where 1<>1 "; DataTable dt = AppMember.DbHelper.GetDataSet(sql).Tables[0]; dt.TableName = "AppLabelStyle"; DataRow dr = dt.NewRow(); dr["styleId"] = IdGenerator.GetMaxId(dt.TableName); dr["styleName"] = model.BarcodeStyleName; dr["xmlString"] = model.XmlString; dr["labelType"] = model.LabelType; dt.Rows.Add(dr); Create5Field(dt, sysUser.UserId, viewTitle); return(DbUpdate.Update(dt)); }
protected override int Add(EntryViewModel model, UserInfo sysUser, string viewTitle) { string sql = @"select * from AssetsSplit where 1<>1 "; DataTable dt = AppMember.DbHelper.GetDataSet(sql, DbUpdate.cmd).Tables[0]; dt.TableName = "AssetsSplit"; DataRow dr = dt.NewRow(); string assetsSplitId = IdGenerator.GetMaxId(dt.TableName); int retApprove = InitFirstApproveTask("AssetsSplit", "AssetsSplitId", assetsSplitId, viewTitle, "", sysUser.UserId); EntryModel myModel = model as EntryModel; dr["assetsSplitNo"] = myModel.AssetsSplitNo; dr["assetsSplitName"] = myModel.AssetsSplitName; string updateType = "Add"; if (retApprove != 0) { dr["approveState"] = "O"; updateType = "ApproveAdd"; } dr["AssetsSplitId"] = assetsSplitId; dt.Rows.Add(dr); Create5Field(dt, sysUser.UserId, viewTitle); DbUpdate.Update(dt); List<AssetsSplit> gridData = JsonHelper.JSONStringToList<AssetsSplit>(DataConvert.ToString(myModel.EntryGridString)); Dictionary<string, object> paras = new Dictionary<string, object>(); paras.Add("assetsId", gridData[0].OriginalAssetsId); sql = @"select * from Assets where assetsId=@assetsId"; DataTable dtAssets = AppMember.DbHelper.GetDataSet(sql, paras, DbUpdate.cmd).Tables[0]; int rowIndex = 0; foreach (AssetsSplit assetsSplit in gridData) { assetsSplit.AssetsId = IdGenerator.GetMaxId("Assets"); AddDetail(assetsSplit, assetsSplitId, sysUser, viewTitle, updateType); if (retApprove == 0) { if (rowIndex == 0) UpdateAssetsState(assetsSplit.OriginalAssetsId, "S", sysUser.UserId, viewTitle); AddNewAssets(assetsSplit, dtAssets, sysUser, viewTitle); } else { if (rowIndex == 0) UpdateAssetsState(assetsSplit.OriginalAssetsId, "SI", sysUser.UserId, viewTitle); } rowIndex += 1; } return 1; }
protected int AddDetail(AssetsTransfer assetsTransfer, EntryModel model, string assetsTransferId, UserInfo sysUser, string viewTitle, string updateType) { string sql = @"select * from AssetsTransferDetail where 1<>1 "; DataTable dt = AppMember.DbHelper.GetDataSet(sql).Tables[0]; dt.TableName = "AssetsTransferDetail"; DataRow dr = dt.NewRow(); dr["assetsTransferId"] = assetsTransferId; dr["assetsId"] = DataConvert.ToDBObject(assetsTransfer.AssetsId); dr["originalDepartmentId"] = DataConvert.ToDBObject(assetsTransfer.OriginalDepartmentId); dr["originalStoreSiteId"] = DataConvert.ToDBObject(assetsTransfer.OriginalStoreSiteId); dr["originalKeeper"] = DataConvert.ToDBObject(assetsTransfer.OriginalKeeper); dr["originalUsePeople"] = DataConvert.ToDBObject(assetsTransfer.OriginalUsePeople); dr["newDepartmentId"] = DataConvert.ToDBObject(model.DepartmentId); dr["newStoreSiteId"] = DataConvert.ToDBObject(model.StoreSiteId); dr["newKeeper"] = DataConvert.ToDBObject(model.Keeper); dr["newUsePeople"] = DataConvert.ToDBObject(model.UsePeople); dr["transferDate"] = DataConvert.ToDBObject(model.TransferDate); dr["remark"] = assetsTransfer.Remark; dr["assetsState"] = assetsTransfer.AssetsStateId; dr["setBooksId"] = sysUser.MySetBooks.SetBooksId; dt.Rows.Add(dr); if (DataConvert.ToString(assetsTransfer.CreateId) != "") { if (updateType == "Reapply") { dr["approveState"] = "O"; } else { dr["approveState"] = assetsTransfer.ApproveState; } dr["createId"] = assetsTransfer.CreateId; dr["createTime"] = assetsTransfer.CreateTime; Update5Field(dt, sysUser.UserId, viewTitle); } else { if (updateType == "ApproveAdd") { dr["approveState"] = "O"; } Create5Field(dt, sysUser.UserId, viewTitle); } return(DbUpdate.Update(dt)); }
protected override int Add(EntryViewModel model, UserInfo sysUser, string viewTitle) { string sql = @"select * from AppDepartment where 1<>1 "; DataTable dt = AppMember.DbHelper.GetDataSet(sql).Tables[0]; dt.TableName = "AppDepartment"; DataRow dr = dt.NewRow(); EntryModel myModel = model as EntryModel; string pk = IdGenerator.GetMaxId(dt.TableName, "Company"); dr["departmentId"] = pk; myModel.DepartmentId = pk; SetDataRow(myModel, dr); dt.Rows.Add(dr); Create5Field(dt, sysUser.UserId, viewTitle); return(DbUpdate.Update(dt)); }
protected int AddDetail(string pkValue, string nodeId, string nodeType, string nodeText, string departmentId, string nodePost) { string sql = @"select * from AppWorkFolwDetail where 1<>1 "; DataTable dt = AppMember.DbHelper.GetDataSet(sql).Tables[0]; dt.TableName = "AppWorkFolwDetail"; DataRow dr = dt.NewRow(); dr["tableName"] = pkValue; dr["nodeId"] = nodeId; dr["nodeType"] = nodeType; dr["nodeText"] = nodeText; dr["departmentId"] = departmentId; dr["postId"] = nodePost; dt.Rows.Add(dr); return(DbUpdate.Update(dt)); }
protected int UpdateChecking(string assetsId, string checking, string sysUser, string viewTitle, string actualStoreSiteId = "") { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("assetsId", assetsId); string sql = @"select * from Assets where assetsId=@assetsId"; DataTable dtAssets = AppMember.DbHelper.GetDataSet(sql, paras, DbUpdate.cmd).Tables[0]; dtAssets.TableName = "Assets"; dtAssets.Rows[0]["checking"] = checking; if (DataConvert.ToString(actualStoreSiteId) != "") { dtAssets.Rows[0]["storeSiteId"] = actualStoreSiteId; } Update5Field(dtAssets, sysUser, viewTitle); return(DbUpdate.Update(dtAssets)); }
public int ModifiyPassword(EntryModel model, string userId) { if (DataConvert.ToString(model.NewPassword) != DataConvert.ToString(model.NewPassword2)) { return(0); } Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("userId", userId); string sql = @"select * from AppUser where userId=@userId"; DataTable dt = AppMember.DbHelper.GetDataSet(sql, paras).Tables[0]; dt.TableName = "AppUser"; dt.Rows[0]["userPwd"] = AppSecurity.Encryption.Encryt(model.NewPassword); Update5Field(dt, userId, model.ViewTitle); return(DbUpdate.Update(dt)); }
protected int AddDetail(AssetsCheck AssetsCheck, string AssetsCheckId, UserInfo sysUser, string viewTitle, string updateType) { string sql = @"select * from AssetsCheckDetail where 1<>1 "; DataTable dt = AppMember.DbHelper.GetDataSet(sql).Tables[0]; dt.TableName = "AssetsCheckDetail"; DataRow dr = dt.NewRow(); dr["AssetsCheckId"] = AssetsCheckId; dr["assetsId"] = AssetsCheck.AssetsId; dr["remark"] = AssetsCheck.Remark; dr["departmentId"] = AssetsCheck.DepartmentId; dr["storeSiteId"] = AssetsCheck.StoreSiteId; dr["actualDepartmentId"] = AssetsCheck.ActualDepartmentId; dr["actualStoreSiteId"] = AssetsCheck.ActualStoreSiteId; dr["isFinished"] = AssetsCheck.IsFinished; dr["checkResult"] = AssetsCheck.CheckResultId; dr["checkDate"] = DataConvert.ToDBObject(AssetsCheck.CheckDate); dr["actualCheckDate"] = DataConvert.ToDBObject(AssetsCheck.ActualCheckDate); dr["setBooksId"] = sysUser.MySetBooks.SetBooksId; dt.Rows.Add(dr); if (DataConvert.ToString(AssetsCheck.CreateId) != "") { if (updateType == "Reapply") { dr["approveState"] = "O"; } else { dr["approveState"] = AssetsCheck.ApproveState; } dr["createId"] = AssetsCheck.CreateId; dr["createTime"] = AssetsCheck.CreateTime; Update5Field(dt, sysUser.UserId, viewTitle); } else { if (updateType == "ApproveAdd") { dr["approveState"] = "O"; } Create5Field(dt, sysUser.UserId, viewTitle); } return(DbUpdate.Update(dt)); }
//protected int AddDetail(EntryModel model, UserInfo sysUser, string viewTitle, Dictionary<string, object> paras) //{ // DataTable dtAssets = GetGridDataSource(paras); // string sql = @"select * from AssetsDepreciation where 1<>1 "; // DataTable dt = AppMember.DbHelper.GetDataSet(sql).Tables[0]; // dt.TableName = "AssetsDepreciation"; // foreach (DataRow drAssets in dtAssets.Rows) // { // AssetsDepreciation assetsDepreciation = new AssetsDepreciation(); // assetsDepreciation.AssetsId = DataConvert.ToString(drAssets["assetsId"]); // assetsDepreciation.DepreciationAmount = DataConvert.ToString(drAssets["depreciationAmount"]); // DataRow dr = dt.NewRow(); // dr["assetsId"] = assetsDepreciation.AssetsId; // dr["fiscalYearId"] = model.FiscalYearId; // dr["fiscalPeriodId"] = model.FiscalPeriodId; // dr["depreciationAmount"] = assetsDepreciation.DepreciationAmount; // dr["setBooksId"] = "BK1503010001"; // UpdateAssets(assetsDepreciation, dr, sysUser, viewTitle); // dt.Rows.Add(dr); // } // Create5Field(dt, sysUser == null ? "" : sysUser.UserId, viewTitle); // DbUpdate.Update(dt); // return 1; //} //protected int UpdateAssets(AssetsDepreciation assetsDepreciation, DataRow drAssetsDepreciation, UserInfo sysUser, string viewTitle) //{ // Dictionary<string, object> paras = new Dictionary<string, object>(); // paras.Add("assetsId", assetsDepreciation.AssetsId); // string sql = @"select * from Assets where assetsId=@assetsId "; // DataTable dt = AppMember.DbHelper.GetDataSet(sql, paras, DbUpdate.cmd).Tables[0]; // dt.TableName = "Assets"; // double assetsNetValue = DataConvert.ToDouble(dt.Rows[0]["assetsNetValue"]) - DataConvert.ToDouble(assetsDepreciation.DepreciationAmount); // int remainMonth = DataConvert.ToInt32(dt.Rows[0]["remainMonth"]) - 1; // dt.Rows[0]["assetsNetValue"] = assetsNetValue; // dt.Rows[0]["remainMonth"] = remainMonth; // drAssetsDepreciation["assetsNetValue"] = assetsNetValue; // drAssetsDepreciation["remainMonth"] = remainMonth; // Update5Field(dt, sysUser.UserId, viewTitle); // return DbUpdate.Update(dt); //} protected int UpdateAssets(DataRow drAssetsDepreciation, UserInfo sysUser, string viewTitle) { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("assetsId", DataConvert.ToString(drAssetsDepreciation["AssetsId"])); string sql = @"select * from Assets where assetsId=@assetsId "; DataTable dt = AppMember.DbHelper.GetDataSet(sql, paras, DbUpdate.cmd).Tables[0]; dt.TableName = "Assets"; int remainMonth = DataConvert.ToInt32(drAssetsDepreciation["remainMonth"]); double assetsNetValue = DataConvert.ToDouble(dt.Rows[0]["assetsNetValue"]) - DataConvert.ToDouble(drAssetsDepreciation["DepreciationAmount"]); dt.Rows[0]["assetsNetValue"] = assetsNetValue; dt.Rows[0]["remainMonth"] = remainMonth; drAssetsDepreciation["assetsNetValue"] = assetsNetValue; Update5Field(dt, sysUser.UserId, viewTitle); return(DbUpdate.Update(dt)); }