//填充明细 public static DataTable GetPurchaseApplyDetail(string ID) { SqlCommand comm = PurchaseApplyDBHelper.GetPurchaseApplyDetail(ID); DataTable dt = SqlHelper.ExecuteSearch(comm); return(dt); }
public static DataTable SelectPurchaseApply(PurchaseApplyModel PurchaseApplyM, int pageIndex, int pageCount, string OrderBy, ref int totalCount) { try { DataTable dt = PurchaseApplyDBHelper.SelectPrimary(PurchaseApplyM, pageIndex, pageCount, OrderBy, ref totalCount); //dt.Columns.Add("IsCite"); //dt.Columns.Add("IsCiteName"); //for (int i = 0; i < dt.Rows.Count; i++) //{ // string ID = dt.Rows[i]["ID"].ToString(); // bool IsCite = PurchaseApplyBus.IsCitePurApply(ID); // dt.Rows[i]["IsCite"] = IsCite; // dt.Rows[i]["IsCiteName"] = IsCite ? '是' : '否'; //} return(dt); } catch (Exception ex) { throw ex; } }
public static bool ConcelCompletePurchaseApply(string ID) { try { //获取登陆用户信息 UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //定义返回变量 bool isSucc = false; /* * 定义日志内容变量 * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库 * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件 */ //执行插入操作 try { isSucc = PurchaseApplyDBHelper.ConcelCompletePurchaseApply(ID); } catch (Exception ex) { //输出日志 WriteSystemLog(userInfo, ex); } //定义变量 string remark; //成功时 if (isSucc) { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_SUCCESS; } else { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_FAILED; } LogInfoModel logModel = InitLogInfo(ID); //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空 logModel.Element = ConstUtil.LOG_PROCESS_CONCELCOMPLETE; //设置操作成功标识 logModel.Remark = remark; //登陆日志 LogDBHelper.InsertLog(logModel); return(isSucc); } catch (Exception ex) { throw ex; } }
public static bool IsCitePurApply(string ID) { try { return(PurchaseApplyDBHelper.IsCitePurApply(ID)); } catch { throw; } }
public static DataTable GetMaterialDetail(string CompanyCD, string ProductNo, string ProductName, string StartDate, string EndDate , int pageIndex, int pageCount, string OrderBy, string OrderByType, ref int totalCount) { try { return(PurchaseApplyDBHelper.GetMaterialDetail(CompanyCD, ProductNo, ProductName, StartDate, EndDate, pageIndex, pageCount, OrderBy, OrderByType, ref totalCount)); } catch (Exception ex) { throw ex; } }
public static DataTable SelectPurchaseApply(PurchaseApplyModel PurchaseApplyM, string OrderBy) { try { DataTable dt = PurchaseApplyDBHelper.SelectPrimary(PurchaseApplyM, OrderBy); return(dt); } catch (Exception ex) { throw ex; } }
private void BindApplyReason() { DataTable dt = PurchaseApplyDBHelper.GetApplyReason(); if (dt != null && dt.Rows.Count > 0) { ddlApplyReasonHidden.DataSource = dt; ddlApplyReasonHidden.DataTextField = "CodeName"; ddlApplyReasonHidden.DataValueField = "ID"; ddlApplyReasonHidden.DataBind(); } ddlApplyReasonHidden.Items.Insert(0, new ListItem("--请选择--", "")); }
//填充主表 public static DataTable GetPurchaseApply(string ID) { SqlCommand comm = PurchaseApplyDBHelper.GetPurchaseApply(ID); DataTable dt = SqlHelper.ExecuteSearch(comm); dt.Columns.Add("IsCite"); for (int i = 0; i < dt.Rows.Count; ++i) { //string ID = dt.Rows[i]["ID"].ToString(); bool IsCite = PurchaseApplyDBHelper.IsCitePurApply(ID); dt.Rows[i]["IsCite"] = IsCite; } return(dt); }
/*构造HTML*/ protected string CreateHtml(DataTable dt, ref decimal TotalCount) { /*读取原因*/ DataTable dtReason = PurchaseApplyDBHelper.GetApplyReason(); StringBuilder sbHtml = new StringBuilder(); sbHtml.AppendLine(" <table width=\"99%\" border=\"0\" id=\"dg_Log\" align=\"center\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"#999999\">"); sbHtml.AppendLine(" <tr>"); sbHtml.AppendLine(" <td bgcolor=\"#E6E6E6\" class=\"Blue\" width=\"50\" align=\"center\"> <input type=\"checkbox\" name=\"checkall\" id=\"checkall\" onclick=\"SelectAll()\" title=\"全选\" style=\"cursor: hand\" /> </td>"); sbHtml.AppendLine(" <td align=\"center\" bgcolor=\"#E6E6E6\" class=\"ListTitle\" valign=\"middle\"> 序号</td>"); sbHtml.AppendLine(" <td align=\"center\" bgcolor=\"#E6E6E6\" class=\"ListTitle\" valign=\"middle\"> 物品编号<span class=\"redbold\">*</span> </td>"); sbHtml.AppendLine(" <td align=\"center\" bgcolor=\"#E6E6E6\" class=\"ListTitle\" valign=\"middle\">物品名称<span class=\"redbold\">*</span> </td>"); sbHtml.AppendLine(" <td align=\"center\" bgcolor=\"#E6E6E6\" class=\"ListTitle\" valign=\"middle\">规格 </td>"); sbHtml.AppendLine(" <td align=\"center\" bgcolor=\"#E6E6E6\" class=\"ListTitle\" valign=\"middle\">颜色 </td>"); sbHtml.AppendLine(" <td align=\"center\" bgcolor=\"#E6E6E6\" class=\"ListTitle\" valign=\"middle\"> <span id=\"spUnitID\">单位</span> <span class=\"redbold\">*</span> </td>"); sbHtml.AppendLine(" <td align=\"center\" bgcolor=\"#E6E6E6\" class=\"ListTitle\" valign=\"middle\" style=\"width:3%; display:none \" id=\"spUsedUnitID\">单位 </td>"); sbHtml.AppendLine(" <td align=\"center\" bgcolor=\"#E6E6E6\" class=\"ListTitle\" style=\"width:3%\"> <span id=\"SpProductCount\">需求数量</span><span class=\"redbold\" id=\"spCount\">*</span></td>"); sbHtml.AppendLine(" <td align=\"center\" bgcolor=\"#E6E6E6\" class=\"ListTitle\" valign=\"middle\" style=\"width:7%; display:none \" id=\"spUsedUnitCount\"> 需求数量 <span class=\"redbold\">*</span> </td>"); sbHtml.AppendLine(" <td align=\"center\" bgcolor=\"#E6E6E6\" class=\"ListTitle\" valign=\"middle\">需求日期<span class=\"redbold\">*</span></td>"); sbHtml.AppendLine(" <td align=\"center\" bgcolor=\"#E6E6E6\" class=\"ListTitle\" valign=\"middle\"> 申请原因 </td>"); sbHtml.AppendLine(" <td align=\"center\" bgcolor=\"#E6E6E6\" class=\"ListTitle\"> 源单编号 </td>"); sbHtml.AppendLine(" <td align=\"center\" bgcolor=\"#E6E6E6\" class=\"ListTitle\" > 源单序号</td>"); sbHtml.AppendLine(" </tr>"); txtTRLastIndex.Value = (Convert.ToInt32(txtTRLastIndex.Value) + dt.Rows.Count).ToString(); int i = 1; foreach (DataRow row in dt.Rows) { decimal ApplyCount1 = row["ApplyCount"] == null ? 0 : Convert.ToDecimal(row["ApplyCount"].ToString()); TotalCount += ApplyCount1; sbHtml.AppendLine("<tr id=\"Item_Row_" + i.ToString() + "\">"); sbHtml.AppendLine("<td class=\"cell\"><input name='chk' id='chk_Option_" + i.ToString() + "' value=\"0\" type='checkbox' onclick=\"ClearAllOption();\" /></td> "); sbHtml.AppendLine("<td class=\"cell\" ><input type=\"text\" id=\"TD_Text_SortNo_" + i.ToString() + "\" value=\"" + i.ToString() + " \" class=\"tdinput\" size=\"5\" disabled=\"disabled\" /></td>"); sbHtml.AppendLine("<td class=\"cell\" ><input type=\"text\" id=\"TD_Text_ProdNo_" + i.ToString() + "\" value=\"" + row["ProdNo"].ToString() + "\" class=\"tdinput\" size=\"8\" onclick=\"popTechObj.ShowList('" + i.ToString() + "');\" readonly=\"readonly\" /></td>"); sbHtml.AppendLine("<td class=\"cell\" ><input type=\"hidden\" id=\"Hidden_TD_Text_ProductID_" + i.ToString() + "\" value=\"" + row["ID"].ToString() + "\" /><input type=\"text\" id=\"TD_Text_ProductID_" + i.ToString() + "\" value=\"" + row["ProductName"].ToString() + "\" class=\"tdinput\" size=\"10\" onclick=\"popTechObj.ShowList('" + i.ToString() + "');\" readonly=\"readonly\" /></td>"); sbHtml.AppendLine("<td class=\"cell\" ><input type=\"text\" id=\"TD_Text_Specification_" + i.ToString() + "\" value=\"" + row["Specification"].ToString() + "\" class=\"tdinput\" size=\"8\" readonly=\"readonly\" /></td>"); sbHtml.AppendLine("<td class=\"cell\" ><input type=\"text\" id=\"DtlSColor" + i.ToString() + "\" value=\"" + row["ColorName"].ToString() + "\" class=\"tdinput\" size=\"8\" readonly=\"readonly\" /></td>"); if (!((UserInfoUtil)SessionUtil.Session["UserInfo"]).IsMoreUnit) { sbHtml.AppendLine("<td class=\"cell\" ><input type=\"hidden\" id='Hidden_TD_Text_UnitID_" + i.ToString() + "' value=\"" + row["UnitID"].ToString() + "\" /><input type=\"text\" id='TD_Text_UnitID_" + i.ToString() + "' value=\"" + row["CodeName"].ToString() + "\" class=\"tdinput\" size=\"6\" readonly=\"readonly\"/></td>"); decimal ApplyCount = decimal.Parse(row["ApplyCount"] == null ? "0" : row["ApplyCount"].ToString()); sbHtml.AppendLine("<td class=\"cell\" ><input type=\"text\" id='TD_Text_ProductCount_" + i.ToString() + "' class=\"tdinput\" size=\"10\" value=\"" + ApplyCount.ToString("F" + ((UserInfoUtil)SessionUtil.Session["UserInfo"]).SelPoint) + "\" onblur=\"fnCalculateTotal();\" /></td>"); } else { sbHtml.AppendLine("<td class=\"cell\" ><input type=\"hidden\" id='Hidden_TD_Text_UnitID_" + i.ToString() + "' value=\"" + row["UnitID"].ToString() + "\" /><input type=\"text\" id='TD_Text_UnitID_" + i.ToString() + "' value=\"" + row["CodeName"].ToString() + "\" class=\"tdinput\" size=\"6\" readonly=\"readonly\"/></td>"); string unitHtml = ""; decimal tmpExRate = 1;/*换算率*/ /*计量单位HTML*/ unitHtml = XBase.Business.Common.UnitGroup.GetUnitGroupByProductId(row["ID"].ToString(), "InUnit", "SignItem_TD_UnitID_Select" + i.ToString(), "ChangeUnit(this," + i.ToString() + ")", "", ref tmpExRate); decimal ApplyCount = decimal.Parse(row["ApplyCount"] == null ? "0" : row["ApplyCount"].ToString()); decimal usedCount = 0; if (tmpExRate != 0) { usedCount = ApplyCount * tmpExRate; } string us = usedCount.ToString("F" + ((UserInfoUtil)SessionUtil.Session["UserInfo"]).SelPoint); sbHtml.AppendLine("<td class=\"cell\"><div id=\"unitdiv" + i.ToString() + "\">" + unitHtml + "</div></td>"); sbHtml.AppendLine("<td class=\"cell\" ><input type=\"text\" id='TD_Text_ProductCount_" + i.ToString() + "' class=\"tdinput\" size=\"10\" value=\"" + us + "\" onblur=\"fnCalculateTotal();\" /></td>"); sbHtml.AppendLine("<td class=\"cell\" ><input id='UsedUnitCount" + i.ToString() + "' type='text' class=\"tdinput\" value=\"" + ApplyCount.ToString("F" + ((UserInfoUtil)SessionUtil.Session["UserInfo"]).SelPoint) + "\" style='width:90%;' onblur=\"Number_round(this," + ((UserInfoUtil)SessionUtil.Session["UserInfo"]).SelPoint + "); ChangeUnit(this.id," + i.ToString() + ")\" /></td>"); } sbHtml.AppendLine("<td class=\"cell\" ><input type=\"text\" id='TD_Text_StartDate_" + i.ToString() + "' value=\"" + row["ApplyDate"].ToString() + "\" class=\"tdinput\" onclick=\"WdatePicker({dateFmt:'yyyy-MM-dd',el:$dp.$('TD_Text_StartDate_" + i.ToString() + "')})\" size=\"10\" onpropertychange =\"fnCalculateTotal();\"/></td>"); sbHtml.AppendLine("<td class=\"cell\" >" + CreateSelectForReason(dtReason, i.ToString()) + " </td>"); sbHtml.AppendLine("<td class=\"cell\" ><input type=\"text\" id='TD_Text_FromBillNo_" + i.ToString() + "' value=\"\" class=\"tdinput\" size=\"10\" readonly=\"readonly\" disabled=\"disabled\" /><input type=\"hidden\" id='TD_Text_FromBillID_" + i.ToString() + "' value=\"0\" class=\"tdinput\" size=\"10\" /></td>"); sbHtml.AppendLine("<td class=\"cell\" ><input type=\"text\" id='TD_Text_FromLineNo_" + i.ToString() + "' value=\"\" class=\"tdinput\" size=\"5\" readonly=\"readonly\" disabled=\"disabled\" /></td>"); sbHtml.AppendLine("</tr>"); i++; } sbHtml.AppendLine(" </table> "); return(sbHtml.ToString()); }
/*构造HTML*/ protected string CreateHtml(DataTable dt, ref int TotalCount) { /*读取原因*/ DataTable dtReason = PurchaseApplyDBHelper.GetApplyReason(); StringBuilder sbHtml = new StringBuilder(); sbHtml.AppendLine("<table width=\"99%\" border=\"0\" id=\"DetailSTable\" align=\"center\" cellpadding=\"0\" cellspacing=\"1\" "); sbHtml.AppendLine("bgcolor=\"#999999\"> "); sbHtml.AppendLine("<tr> "); sbHtml.AppendLine(" <td bgcolor=\"#E6E6E6\" width=\"50\" align=\"center\"> "); sbHtml.AppendLine(" 全选<input type=\"checkbox\" id=\"checkall\" onclick=\"fnSelectAll();\" title=\"全选\" /> "); sbHtml.AppendLine(" </td> "); sbHtml.AppendLine(" <td align=\"center\" bgcolor=\"#E6E6E6\" class=\"ListTitle\" align=\"center\"> "); sbHtml.AppendLine(" 序号 "); sbHtml.AppendLine(" </td> "); sbHtml.AppendLine(" <td align=\"center\" bgcolor=\"#E6E6E6\" class=\"ListTitle\" valign=\"middle\"> "); sbHtml.AppendLine(" 商品编号<span class=\"redbold\">*</span> "); sbHtml.AppendLine(" <uc6:MaterialChoose ID=\"MaterialChoose1\" runat=\"server\" /> "); sbHtml.AppendLine(" </td> "); sbHtml.AppendLine(" <td align=\"center\" bgcolor=\"#E6E6E6\" class=\"ListTitle\" valign=\"middle\"> "); sbHtml.AppendLine(" 商品名称<span class=\"redbold\">*</span> "); sbHtml.AppendLine(" </td> "); sbHtml.AppendLine(" <td align=\"center\" bgcolor=\"#E6E6E6\" class=\"ListTitle\"> "); sbHtml.AppendLine(" 规格<span class=\"redbold\">*</span> "); sbHtml.AppendLine(" </td> "); sbHtml.AppendLine(" <td align=\"center\" bgcolor=\"#E6E6E6\" class=\"ListTitle\" valign=\"middle\"> "); sbHtml.AppendLine(" 单位<span class=\"redbold\">*</span> "); sbHtml.AppendLine(" </td> "); sbHtml.AppendLine(" <td align=\"center\" bgcolor=\"#E6E6E6\" class=\"ListTitle\"> "); sbHtml.AppendLine(" 需求数量<span class=\"redbold\">*</span> "); sbHtml.AppendLine(" </td> "); sbHtml.AppendLine(" <td align=\"center\" bgcolor=\"#E6E6E6\" class=\"ListTitle\"> "); sbHtml.AppendLine(" 需求日期<span class=\"redbold\">*</span> "); sbHtml.AppendLine(" </td> "); sbHtml.AppendLine(" <td align=\"center\" bgcolor=\"#E6E6E6\" class=\"ListTitle\" style=\"width: 7%\"> "); sbHtml.AppendLine(" 申请原因 "); sbHtml.AppendLine(" </td> "); sbHtml.AppendLine(" <td align=\"center\" bgcolor=\"#E6E6E6\" class=\"ListTitle\"> "); sbHtml.AppendLine(" 源单编号 "); sbHtml.AppendLine(" </td> "); sbHtml.AppendLine(" <td align=\"center\" bgcolor=\"#E6E6E6\" class=\"ListTitle\" > "); sbHtml.AppendLine(" 源单序号 "); sbHtml.AppendLine(" </td> "); sbHtml.AppendLine(" </tr> "); int i = 1; foreach (DataRow row in dt.Rows) { TotalCount += Convert.ToInt32(row["ApplyCount"].ToString()); sbHtml.AppendLine("<tr id=\"SignItem" + i.ToString() + "\">"); sbHtml.AppendLine("<td style=\"display:none;\"><input id='DtlSFromBillID" + i.ToString() + "' type='text' class=\"tdinput\" style='width:90%;' /><input id='DtlSFromLineNo" + i.ToString() + "' type='text' class=\"tdinput\" style='width:90%;' disabled/><input id='DtlSRemark" + i.ToString() + "' SpecialWorkCheck='明细来源备注' type='text' class=\"tdinput\" style='width:90%;' /></td>"); sbHtml.AppendLine("<td class=\"cell\"><input name='chk' id='chk" + i.ToString() + "' onclick=\"IfSelectAll('chk','checkall')\" value=" + i.ToString() + " type='checkbox' size='20' /></td><input id='DtlSProdID" + i.ToString() + "' type='hidden' class=\"tdinput\" style='width:90%;' value=\"" + row["ID"].ToString() + "\"/>"); sbHtml.AppendLine("<td class=\"cell\" id=\"DtlSSortNo" + i.ToString() + "\">" + i.ToString() + "</td>"); sbHtml.AppendLine("<td class=\"cell\"><input id='DtlSProdNo" + i.ToString() + "'readonly onclick=\"fnGetProduct(" + i.ToString() + ");\" type='text' class=\"tdinput\" style='width:90%;' value=\"" + row["ProdNo"].ToString() + "\"/></td>"); sbHtml.AppendLine("<td class=\"cell\"><input id='DtlSProdName" + i.ToString() + "'onclick=\"fnGetProduct(" + i.ToString() + ");\" value=\"" + row["ProductName"].ToString() + "\" type='text' class=\"tdinput\" style='width:90%;' disabled /></td>"); sbHtml.AppendLine("<td class=\"cell\"><input id='DtlSSpecification" + i.ToString() + "' type='text' class=\"tdinput\" value=\"" + row["Specification"].ToString() + "\" style='width:90%;' disabled /><input id='DtlSUnitID" + i.ToString() + "' type='hidden' style='width:90%;' value=\"" + row["UnitID"].ToString() + "\" /></td>"); sbHtml.AppendLine("<td class=\"cell\"><input id='DtlSUnitName" + i.ToString() + "' type='text' class=\"tdinput\" style='width:90%;' disabled value=\"" + row["CodeName"].ToString() + "\" /></td>"); sbHtml.AppendLine("<td class=\"cell\"><input id='DtlSPlanCount" + i.ToString() + "'onblur=\"Number_round(this,2);fnCalculateTotal();\" type='text' class=\"tdinput\" style='width:90%;' value=\"" + row["ApplyCount"].ToString() + "\" /></td>"); sbHtml.AppendLine("<td class=\"cell\"><input id='DtlSPlanTakeDate" + i.ToString() + "' onclick=\"WdatePicker()\" onchange=\"fnCalculateTotal();\" type='text' class=\"tdinput\" style='width:90%;' value=\"" + row["ApplyDate"].ToString() + "\" /><input id='DtlSFromBillID" + i.ToString() + "' type='hidden' class=\"tdinput\" style='width:90%;' /></td>"); sbHtml.AppendLine("<td class=\"cell\">" + CreateSelectForReason(dtReason, i.ToString()) + "</td>"); sbHtml.AppendLine("<td class=\"cell\"><input id='DtlSFromBillNO" + i.ToString() + "' type='text' class=\"tdinput\" style='width:90%;' disabled /></td>"); sbHtml.AppendLine("<td class=\"cell\"><input id='DtlSFromLineNo" + i.ToString() + "' type='text' class=\"tdinput\" style='width:90%;' disabled/></td>"); sbHtml.AppendLine("</tr>"); i++; } sbHtml.AppendLine(" </table> "); return(sbHtml.ToString()); }
public static bool CancelConfirm(string ID, string No) { try { ////已经被引用的采购申请不能取消确认 //if (IsCitePurApply(ID)) //{ // return false; //} ArrayList lstCancelConfirm = new ArrayList(); //更改主表 lstCancelConfirm.Add(PurchaseApplyDBHelper.CancelConfirm(ID)); //获取登陆用户信息 UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //撤销审批 string CompanyCD = userInfo.CompanyCD; string BillTypeFlag = ConstUtil.CODING_RULE_PURCHASE; string BillTypeCode = ConstUtil.CODING_RULE_PURCHASE_APPLY; string strUserID = userInfo.UserID;; DataTable dt = FlowDBHelper.GetFlowInstanceInfo(CompanyCD, Convert.ToInt32(BillTypeFlag), Convert.ToInt32(BillTypeCode), Convert.ToInt32(ID)); if (dt.Rows.Count > 0) { string FlowInstanceID = dt.Rows[0]["FlowInstanceID"].ToString(); string FlowStatus = dt.Rows[0]["FlowStatus"].ToString(); string FlowNo = dt.Rows[0]["FlowNo"].ToString(); lstCancelConfirm.Add(FlowDBHelper.CancelConfirmHis(CompanyCD, FlowInstanceID, FlowNo, BillTypeFlag, BillTypeCode, strUserID)); lstCancelConfirm.Add(FlowDBHelper.CancelConfirmTsk(CompanyCD, FlowInstanceID, strUserID)); lstCancelConfirm.Add(FlowDBHelper.CancelConfirmIns(CompanyCD, FlowNo, BillTypeFlag, BillTypeCode, ID, strUserID)); } //定义返回变量 bool isSucc = false; /* * 定义日志内容变量 * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库 * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件 */ //执行插入操作 try { isSucc = SqlHelper.ExecuteTransWithArrayList(lstCancelConfirm); } catch (Exception ex) { //输出日志 WriteSystemLog(userInfo, ex); } //定义变量 string remark; //成功时 if (isSucc) { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_SUCCESS; } else { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_FAILED; } LogInfoModel logModel = InitLogInfo(No); //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空 logModel.Element = ConstUtil.LOG_PROCESS_UNCONFIRM; //设置操作成功标识 logModel.Remark = remark; //登陆日志 LogDBHelper.InsertLog(logModel); return(isSucc); } catch (Exception ex) { throw ex; } }
public static bool DeleteApply(string ApplyNos, string IDs) { ArrayList lstDel = new ArrayList(); //删除主表 SqlCommand DelPri = PurchaseApplyDBHelper.DeletePurchaseApply(IDs); lstDel.Add(DelPri); //删除明细来源 SqlCommand DelDtlS = PurchaseApplyDBHelper.DeleteDtlS(ApplyNos); lstDel.Add(DelDtlS); //删除明细 SqlCommand DelDtl = PurchaseApplyDBHelper.DeleteDtl(ApplyNos); lstDel.Add(DelDtl); //获取登陆用户信息 UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //定义返回变量 bool isSucc = false; /* * 定义日志内容变量 * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库 * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件 */ //执行删除操作 try { isSucc = SqlHelper.ExecuteTransWithArrayList(lstDel); } catch (Exception ex) { //输出日志 WriteSystemLog(userInfo, ex); } //定义变量 string remark; //成功时 if (isSucc) { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_SUCCESS; } else { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_FAILED; } //获取删除的编号列表 string[] noList = ApplyNos.Split(','); //遍历所有编号,登陆操作日志 for (int i = 0; i < noList.Length; i++) { //获取编号 string no = noList[i]; //替换两边的 ' no = no.Replace("'", string.Empty); //操作日志 LogInfoModel logModel = InitLogInfo(no); //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空 logModel.Element = ConstUtil.LOG_PROCESS_DELETE; //设置操作成功标识 logModel.Remark = remark; //登陆日志 LogDBHelper.InsertLog(logModel); } return(isSucc); }
public static bool InsertPurchaseApply(PurchaseApplyModel PurchaseApplyM, List <PurchaseApplyDetailSourceModel> PurchaseApplyDetailSourceMList , List <PurchaseApplyDetailModel> PurchaseApplyDetailMList, out int IndexIDentity, Hashtable htExtAttr) { ArrayList lstAdd = new ArrayList(); //插入主表 SqlCommand AddPri = PurchaseApplyDBHelper.InsertPrimary(PurchaseApplyM); lstAdd.Add(AddPri); string ApplyNo = PurchaseApplyM.ApplyNo; foreach (PurchaseApplyDetailSourceModel PurchaseApplyDetailSourceM in PurchaseApplyDetailSourceMList) { SqlCommand AddDtlS = PurchaseApplyDBHelper.InsertDtlS(PurchaseApplyDetailSourceM, ApplyNo); lstAdd.Add(AddDtlS); } foreach (PurchaseApplyDetailModel PurchaseApplyDetailM in PurchaseApplyDetailMList) { SqlCommand AddDtl = PurchaseApplyDBHelper.InsertDtl(PurchaseApplyDetailM, ApplyNo); lstAdd.Add(AddDtl); } #region 拓展属性 SqlCommand cmd = new SqlCommand(); GetExtAttrCmd(PurchaseApplyM, htExtAttr, cmd); if (htExtAttr.Count > 0) { lstAdd.Add(cmd); } #endregion //获取登陆用户信息 UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //定义返回变量 bool isSucc = false; /* * 定义日志内容变量 * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库 * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件 */ //执行插入操作 try { isSucc = SqlHelper.ExecuteTransWithArrayList(lstAdd); } catch (Exception ex) { //输出日志 WriteSystemLog(userInfo, ex); } //定义变量 string remark; //成功时 if (isSucc) { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_SUCCESS; IndexIDentity = int.Parse(((SqlCommand)AddPri).Parameters["@IndexID"].Value.ToString()); } else { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_FAILED; IndexIDentity = 0; } LogInfoModel logModel = InitLogInfo(ApplyNo); //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空 logModel.Element = ConstUtil.LOG_PROCESS_INSERT; //设置操作成功标识 logModel.Remark = remark; //登陆日志 LogDBHelper.InsertLog(logModel); return(isSucc); }
/// <summary> /// 修改采购申请 /// </summary> /// <param name="PurchaseApplyM">主表</param> /// <param name="str">明细来源</param> /// <param name="start"></param> /// <param name="end">从start--end需要更新,end以后要插入</param> /// <param name="str2">明细信息</param> /// <param name="ApplyNo"></param> /// <returns></returns> public static bool UpdatePurchaseApply(PurchaseApplyModel PurchaseApplyM, List <PurchaseApplyDetailSourceModel> PurchaseApplyDetailSourceMList , List <PurchaseApplyDetailModel> PurchaseApplyDetailMList, Hashtable htExtAttr) { try { ArrayList lstUpdate = new ArrayList(); //更新主表 SqlCommand UpdatePri = PurchaseApplyDBHelper.UpdatePrimary(PurchaseApplyM); lstUpdate.Add(UpdatePri); string ApplyNo = PurchaseApplyM.ApplyNo; string FromType = PurchaseApplyM.FromType; #region 拓展属性 SqlCommand cmd = new SqlCommand(); GetExtAttrCmd(PurchaseApplyM, htExtAttr, cmd); if (htExtAttr.Count > 0) { lstUpdate.Add(cmd); } #endregion //删除原来明细来源 SqlCommand DelDtlS = PurchaseApplyDBHelper.DeleteDtlS(ApplyNo); lstUpdate.Add(DelDtlS); //插入现在的明细来源 foreach (PurchaseApplyDetailSourceModel PurchaseApplyDetailSourceM in PurchaseApplyDetailSourceMList) { SqlCommand AddDtlS = PurchaseApplyDBHelper.InsertDtlS(PurchaseApplyDetailSourceM, ApplyNo); lstUpdate.Add(AddDtlS); } //删除原来明细 SqlCommand DelDtl = PurchaseApplyDBHelper.DeleteDtl(ApplyNo); lstUpdate.Add(DelDtl); //插入现在的明细 foreach (PurchaseApplyDetailModel PurchaseApplyDetailM in PurchaseApplyDetailMList) { SqlCommand AddDtl = PurchaseApplyDBHelper.InsertDtl(PurchaseApplyDetailM, ApplyNo); lstUpdate.Add(AddDtl); } //获取登陆用户信息 UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //定义返回变量 bool isSucc = false; /* * 定义日志内容变量 * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库 * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件 */ //执行插入操作 try { isSucc = SqlHelper.ExecuteTransWithArrayList(lstUpdate); } catch (Exception ex) { //输出日志 WriteSystemLog(userInfo, ex); } //定义变量 string remark; //成功时 if (isSucc) { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_SUCCESS; } else { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_FAILED; } LogInfoModel logModel = InitLogInfo(ApplyNo); //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空 logModel.Element = ConstUtil.LOG_PROCESS_UPDATE; //设置操作成功标识 logModel.Remark = remark; //登陆日志 LogDBHelper.InsertLog(logModel); return(isSucc); } catch (Exception ex) { throw ex; } }