/// <summary> /// 响应“反封存”按钮的Click事件 /// </summary> private void tsButtonUnSeal_Click(object sender, EventArgs e) { /* 选中一行,若当前行为null,则直接返回 */ DataRow dr = wnGridSealManage.CurrRow; if (dr == null) { return; } /* 询问是否确定要进行反封存操作 */ if (DialogBox.AskYesNo(this.GetCurrLanguageContent("WnFormSealManage.AskUnSealData")) == DialogResult.No) { return; } //Content_CN:是否确定要进行反封存操作? /* 获取服务器的当前时间 */ object currTime = AppServer.GetDateTime(); if (currTime == null) { return; } /* 执行SQL语句,执行反封存操作 */ Hashtable htUnSeal = new Hashtable(); htUnSeal["DataSetName"] = "UnSealData"; htUnSeal["{Guid}"] = dr["Guid"].ToString(); htUnSeal["{EditUser}"] = AppInfo.UserName; htUnSeal["{EditTime}"] = ((DateTime)currTime).ToString("yyyy/MM/dd HH:mm:ss"); if (this.DataSource.ExecSql(htUnSeal)["IsSuccess"].Equals("0")) { return; } /* 标记进行了反封存操作 */ IsModify = true; /* 记录反封存日志 */ Hashtable htLog = new Hashtable(); htLog["{Year}"] = dr["Year"].ToString(); htLog["{Month}"] = dr["Month"].ToString(); htLog["{HdgsName}"] = dr["HdgsName"].ToString(); htLog["{Zyg}"] = dr["Zyg"].ToString(); htLog["{Mdg}"] = dr["Mdg"].ToString(); htLog["{Yfdj}"] = dr["Yfdj"].ToString(); htLog["{Dpfy}"] = dr["Dpfy"].ToString(); htLog["{Ysts}"] = dr["Ysts"].ToString(); AppServer.SaveModuleOpLog(this.ModuleId, "WnFormMain.UnSealLog", htLog); //Content_CN:反封存了年份为【{Year}】、月份为【{Month}】、货代公司名称为【{HdgsName}】、装运港为【{Zyg}】、目的港为【{Mdg}】、运费单价为【{Yfdj}】、单票费用为【{Dpfy}】、运输天数为【{Ysts}】的海运费用登记信息! /* 从界面上删除数据 */ wnGridSealManage.DeleteRow(dr); dr.AcceptChanges(); }
/// <summary> /// 响应“封存”按钮的Click事件 /// </summary> private void tsButtonSeal_Click(object sender, EventArgs e) { /* 保存按钮可用,检查是否有未保存的数据 */ if (tsButtonSave.Enabled && !SaveData(new List <Act> { Act.AskIsUpdate, Act.SaveData })) { return; } /* 若界面没有勾选行并且当前行不为空,则选中当前行,对当前行进行封存 */ if (wnGridMain.SelectedRowsArray.Length == 0) { if (wnGridMain.CurrRow == null) { return; } wnGridMain.SetRowSelected(wnGridMain.CurrRow); } /* 询问是否确定要进行封存操作 */ if (DialogBox.AskYesNo(this.GetCurrLanguageContent("WnFormMain.AskSealData")) == DialogResult.No) { return; } //Content_CN:是否确定要进行封存操作? /* 获取当前服务器时间 */ object currTime = AppServer.GetDateTime(); if (currTime == null) { return; } /* 遍历选中行,获取选中行的Guid、封存人、封存时间 */ List <string> listSeal = new List <string>(); List <string> listSealUser = new List <string>(); List <string> listSealTime = new List <string>(); foreach (DataRow datarow in wnGridMain.SelectedRowsArray) { /* 已审核的数据不允许封存,只封存未审核的行 */ if (!string.IsNullOrWhiteSpace(datarow["AuditUser"] + "")) { wnGridMain.SetRowUnSelected(datarow); continue; } /* 界面的新增行直接删除 */ if (datarow.RowState == DataRowState.Added) { wnGridMain.DeleteRow(datarow); continue; } /* 将符合条件的信息存入集合 */ listSeal.Add(datarow["Guid"].ToString()); listSealUser.Add(AppInfo.UserName); listSealTime.Add(Convert.ToDateTime(currTime).ToString("yyyy/MM/dd HH:mm:ss")); } /* 若集合中无数据,则直接返回 */ if (listSeal.Count == 0) { return; } /* 执行封存语句 */ Hashtable htSealData = new Hashtable(); htSealData["DataSetName"] = "SealData"; htSealData["{Guid}"] = listSeal; htSealData["{SealUser}"] = listSealUser; htSealData["{SealTime}"] = listSealTime; if (this.DataSource.ExecSql(htSealData)["IsSuccess"].Equals("0")) { return; } /* 记录日志,并删除界面上的数据 */ Hashtable htLog = new Hashtable(); foreach (DataRow dr in wnGridMain.SelectedRowsArray) { /* 记录封存日志 */ htLog["{Year}"] = dr["Year"].ToString(); htLog["{Month}"] = dr["Month"].ToString(); htLog["{HdgsName}"] = dr["HdgsName"].ToString(); htLog["{Zyg}"] = dr["Zyg"].ToString(); htLog["{Mdg}"] = dr["Mdg"].ToString(); htLog["{Yfdj}"] = dr["Yfdj"].ToString(); htLog["{Dpfy}"] = dr["Dpfy"].ToString(); htLog["{Ysts}"] = dr["Ysts"].ToString(); AppServer.SaveModuleOpLog(this.ModuleId, "WnFormMain.SealLog", htLog); //Content_CN:封存了年份为【{Year}】、月份为【{Month}】、货代公司名称为【{HdgsName}】、装运港为【{Zyg}】、目的港为【{Mdg}】、运费单价为【{Yfdj}】、单票费用为【{Dpfy}】、运输天数为【{Ysts}】的海运费用登记信息! wnGridMain.DeleteRow(dr); dr.AcceptChanges(); } }