/// <summary> /// 更新list里该 StyleNO的审批为True,SAP的更新状态。 /// </summary> /// <param name="sWorkflowNo"></param> /// <param name="sStyleNo"></param> /// <param name="isSuccess"></param> void UpdateItemStaus(string sWorkflowNo, string sStyleNo, bool isSuccess) { OSPCommon comm = new OSPCommon(); foreach (RepeaterItem item in RepeaterPOData.Items) { Label LabelStyleNO = item.FindControl("LabelStyleNO") as Label; if (sStyleNo == LabelStyleNO.Text.Trim()) { HiddenField HiddenFieldISSuccess = item.FindControl("HiddenFieldISSuccess") as HiddenField; comm.UpdateItemSapStatus(sWorkflowNo,sStyleNo, true, isSuccess);///更新list里该 StyleNO的审批为True,SAP的更新状态。 HiddenFieldISSuccess.Value = isSuccess ? "1" : "0"; } } }
/// <summary> /// 得到更新到 SAP的参数 ,并将审批不通过数据修改到list /// </summary> /// <returns></returns> DataTable GetUpdatePars() { DataTable dtUpdate = new DataTable(); dtUpdate.Columns.Add("StyleNO"); dtUpdate.Columns.Add("NewOSP"); foreach (RepeaterItem item in RepeaterPOData.Items) { DropDownList DropDownListApprove = item.FindControl("DropDownListApprove") as DropDownList; HiddenField HiddenFieldISSuccess = item.FindControl("HiddenFieldISSuccess") as HiddenField; if (HiddenFieldISSuccess.Value == "0")//没有更新成功 { bool IsApproved = DropDownListApprove.SelectedValue == "1" ? true : false; HiddenField HiddenFieldID = item.FindControl("HiddenFieldID") as HiddenField;///当前Item的 ID if (IsApproved)//审批通过,加入到要修改的集合中。 { Label LabelStyleNO = item.FindControl("LabelStyleNO") as Label; Label LabelNewOSP = item.FindControl("LabelNewOSP") as Label; DataRow dr = dtUpdate.NewRow(); dr["StyleNO"] = LabelStyleNO.Text; dr["NewOSP"] = LabelNewOSP.Text.Trim(); dtUpdate.Rows.Add(dr); } else//审批不通过 { OSPCommon comm = new OSPCommon(); comm.UpdateItemSapStatus(HiddenFieldID.Value, IsApproved, false);//将审批不通过修改到Item的状态 中 HiddenFieldISSuccess.Value = "1";//页面上标注为己经更新。 } } } return dtUpdate; }