protected void lbtnAdd_Click(object sender, EventArgs e) { FillInspectItemDic(); Controls_TextBox tbItemCode = (Controls_TextBox)((LinkButton)sender).Parent.FindControl("tbItemCode"); TextBox tbInspectQty = (TextBox)((LinkButton)sender).Parent.FindControl("tbInspectQty"); com.Sconit.Control.CodeMstrDropDownList tbDefectClassification = (com.Sconit.Control.CodeMstrDropDownList)((LinkButton)sender).Parent.FindControl("tbDefectClassification"); com.Sconit.Control.CodeMstrDropDownList tbDefectFactor = (com.Sconit.Control.CodeMstrDropDownList)((LinkButton)sender).Parent.FindControl("tbDefectFactor"); Item newItem = TheItemMgr.LoadItem(tbItemCode.Text.Trim()); IList <BomDetail> bomDetailList = TheBomDetailMgr.GetFlatBomDetail(tbItemCode.Text.Trim(), DateTime.Now); foreach (BomDetail bomDetail in bomDetailList) { if (bomDetail.CalculatedQty == 0) { continue; } if (bomDetail.BackFlushMethod != BusinessConstants.CODE_MASTER_BACKFLUSH_METHOD_VALUE_BATCH_FEED) { if (InspectItemDic.ContainsKey(bomDetail.Item.Code + "-" + bomDetail.Bom.Code + "-" + tbDefectClassification.Text.Trim())) { InspectItemDic[bomDetail.Item.Code + "-" + bomDetail.Bom.Code + "-" + tbDefectClassification.Text.Trim() + "-" + tbDefectFactor.Text.Trim()] += bomDetail.RateQty * decimal.Parse(tbInspectQty.Text.Trim()); } else { InspectItemDic.Add(bomDetail.Item.Code + "-" + bomDetail.Bom.Code + "-" + tbDefectClassification.Text.Trim() + "-" + tbDefectFactor.Text.Trim(), bomDetail.RateQty * decimal.Parse(tbInspectQty.Text.Trim())); } } } InitPageParameter(); }
private void FillInspectItemDic() { this.InspectItemDic.Clear(); for (int i = 0; i < this.GV_List.Rows.Count - 1; i++) { GridViewRow row = this.GV_List.Rows[i]; string itemCode = ((Label)row.FindControl("lblItemCode")).Text.Trim(); TextBox tbInspectQty = (TextBox)row.FindControl("tbInspectQty"); string fgCode = ((HiddenField)row.FindControl("hfFgCode")).Value; decimal inspectQty = tbInspectQty.Text.Trim() == string.Empty ? 0 : decimal.Parse(tbInspectQty.Text.Trim()); com.Sconit.Control.CodeMstrDropDownList tbDefectClassification = (com.Sconit.Control.CodeMstrDropDownList)row.FindControl("tbDefectClassification"); com.Sconit.Control.CodeMstrDropDownList tbDefectFactor = (com.Sconit.Control.CodeMstrDropDownList)row.FindControl("tbDefectFactor"); InspectItemDic.Add(itemCode + "-" + fgCode + "-" + tbDefectClassification.SelectedValue + "-" + tbDefectFactor.SelectedValue, inspectQty); } }