protected void ODS_PriceListDetail_Updating(object sender, ObjectDataSourceMethodEventArgs e) { string priceListCode = ((TextBox)(this.FV_PriceListDetail.FindControl("tbPriceList"))).Text.Trim(); string itemCode = ((TextBox)(this.FV_PriceListDetail.FindControl("tbItem"))).Text.Trim(); string currencyCode = ((Controls_TextBox)(this.FV_PriceListDetail.FindControl("tbCurrency"))).Text.Trim(); string uomCode = ((Controls_TextBox)(this.FV_PriceListDetail.FindControl("tbUom"))).Text.Trim(); string startDate = ((TextBox)(this.FV_PriceListDetail.FindControl("tbStartDate"))).Text.Trim(); string endDate = ((TextBox)(this.FV_PriceListDetail.FindControl("tbEndDate"))).Text.Trim(); priceListdetail = (PriceListDetail)e.InputParameters[0]; if (priceListdetail != null) { priceListdetail.PriceList = ThePriceListMgr.LoadPriceList(priceListCode); item = TheItemMgr.LoadItem(itemCode); priceListdetail.Item = item; priceListdetail.Currency = TheCurrencyMgr.LoadCurrency(currencyCode); //default uom if (uomCode == "") { priceListdetail.Uom = item.Uom; } else { priceListdetail.Uom = TheUomMgr.LoadUom(uomCode); } } }
protected void ODS_Bom_Inserting(object sender, ObjectDataSourceMethodEventArgs e) { string uom = ((Controls_TextBox)(this.FV_Bom.FindControl("tbUom"))).Text.Trim(); string region = ((Controls_TextBox)(this.FV_Bom.FindControl("tbRegion"))).Text.Trim(); bom = (Bom)e.InputParameters[0]; item = TheItemMgr.LoadItem(bom.Code); if (item != null) { //default description and uom if (bom.Description.Trim() == "") { bom.Description = item.Description; } if (uom.Trim() == "") { bom.Uom = item.Uom; } else { bom.Uom = TheUomMgr.LoadUom(uom); } } if (region == "") { bom.Region = null; } else { bom.Region = TheRegionMgr.LoadRegion(region); } }
protected void btnCreate_Click(object sender, EventArgs e) { try { string shelfCode = this.tbShelfCode.Text.Trim(); string itemCode = this.tbItem.Text.Trim(); if (!this.rfvItem.IsValid) { return; } ShelfItem shelfItem = new ShelfItem(); if (shelfItem != null) { shelfItem.Shelf = TheShelfMgr.LoadShelf(shelfCode); shelfItem.Item = TheItemMgr.LoadItem(itemCode); } TheShelfItemMgr.CreateShelfItem(shelfItem); ShowSuccessMessage("Mes.ShelfItem.Insert.Successfully"); if (CreateEvent != null) { CreateEvent(sender, e); } } catch (BusinessErrorException ex) { ShowErrorMessage(ex); } }
public void ShowTreeView(object sender) { string flowCode = ((object[])sender)[0].ToString(); string itemCode = ((object[])sender)[1].ToString(); if (TheFlowMgr.LoadFlow(flowCode) == null) { ShowErrorMessage("Common.Business.Warn.FlowInvalid"); return; } if (TheItemMgr.LoadItem(itemCode) == null) { ShowErrorMessage("Common.Business.Warn.ItemInvalid"); return; } supplyChain = TheSupplyChainMgr.GenerateSupplyChain(flowCode, itemCode)[0]; supplyChainDetailList = supplyChain.SupplyChainDetails; if (supplyChainDetailList != null && supplyChainDetailList.Count > 0) { MyOrgNode RootNode = new MyOrgNode(); GenChildOrgNode(RootNode); OrgChartTreeView.Node = RootNode; } }
public void InitPageParameter() { IList <InspectItem> inspectItemList = new List <InspectItem>(); foreach (string fgItemCode in this.InspectItemDic.Keys) { string[] fgItem = fgItemCode.Split('-'); string itemCode = fgItem[0]; string fgCode = fgItem[1]; string defectClassification = fgItem[2]; string defectFactor = fgItem[3]; InspectItem inspectItem = new InspectItem(); inspectItem.IsBlank = false; inspectItem.InspectQty = InspectItemDic[fgItemCode]; inspectItem.Item = TheItemMgr.LoadItem(itemCode); inspectItem.FinishGoods = TheItemMgr.LoadItem(fgCode); inspectItem.DefectClassification = defectClassification; inspectItem.DefectFactor = defectFactor; inspectItemList.Add(inspectItem); } //新行 InspectItem blankInspectItem = new InspectItem(); blankInspectItem.IsBlank = true; inspectItemList.Add(blankInspectItem); this.GV_List.DataSource = inspectItemList; this.GV_List.DataBind(); }
protected void btnSave_Click(object sender, EventArgs e) { decimal Qty = 0; try { Qty = Convert.ToDecimal(this.tbQty.Text.Trim()); } catch (Exception) { ShowErrorMessage("Common.Validator.Valid.Number"); return; } if (TheItemKitMgr.LoadItemKit(this.ParentItemCode, this.ChildItemCode) != null) { ItemKit itemKit = new ItemKit(); itemKit.ChildItem = TheItemMgr.LoadItem(this.ChildItemCode); itemKit.ParentItem = TheItemMgr.LoadItem(this.ParentItemCode); itemKit.IsActive = this.cbIsActive.Checked; itemKit.Qty = Qty; TheItemKitMgr.UpdateItemKit(itemKit); } else { ShowErrorMessage("Common.Code.Exist", ChildItemCode); } EditEvent(this, e); }
protected void btnSave_Click(object sender, EventArgs e) { string childerItemCode = this.tbCode.Text.Trim(); decimal Qty = 0; try { Qty = Convert.ToDecimal(this.tbQty.Text.Trim()); } catch (Exception) { ShowErrorMessage("Common.Validator.Valid.Number"); return; } if (TheItemKitMgr.LoadItemKit(this.ParentItemCode, childerItemCode) == null) { ItemKit itemKit = new ItemKit(); itemKit.ChildItem = TheItemMgr.LoadItem(childerItemCode); itemKit.ParentItem = TheItemMgr.LoadItem(this.ParentItemCode); itemKit.IsActive = this.cbIsActive.Checked; itemKit.Qty = Qty; TheItemKitMgr.CreateItemKit(itemKit); ShowSuccessMessage("MasterData.Item.AddItem.Successfully", childerItemCode); } else { ShowErrorMessage("Common.Code.Exist", childerItemCode); return; } NewEvent(this, e); }
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(); }
protected void btnCreate_Click(object sender, EventArgs e) { try { string orderNo = this.tbOrderNo.Text.Trim(); string itemCode = this.tbItem.Text.Trim(); string tagNo = this.tbTagNo.Text.Trim(); if (!this.rfvItem.IsValid || !this.rfvOrderNo.IsValid || !this.rfvTagNo.IsValid) { return; } ByMaterial byMaterial = new ByMaterial(); if (byMaterial != null) { byMaterial.Item = TheItemMgr.LoadItem(itemCode); byMaterial.OrderNo = orderNo; byMaterial.TagNo = tagNo; byMaterial.CreateDate = DateTime.Now; byMaterial.CreateUser = this.CurrentUser; } TheByMaterialMgr.CreateByMaterial(byMaterial); ShowSuccessMessage("Mes.ByMaterial.Insert.Successfully"); if (CreateEvent != null) { CreateEvent(byMaterial.Id, e); } } catch (BusinessErrorException ex) { ShowErrorMessage(ex); } }
private bool buildMiscOrderDetails(bool saveHead) { bool result = true; int rowCount = saveHead ? this.MiscOrderDetailsGV.Rows.Count - 1 : this.MiscOrderDetailsGV.Rows.Count; IList <MiscOrderDetail> miscOrderDetails = new List <MiscOrderDetail>(); for (int i = 0; i < rowCount; i++) { MiscOrderDetail miscOrderDetail = new MiscOrderDetail(); Controls_TextBox tbItemCode = this.MiscOrderDetailsGV.Rows[i].FindControl("tbItemCode") as Controls_TextBox; if (tbItemCode.Text.Length == 0) { Label lblItemCode = this.MiscOrderDetailsGV.Rows[i].FindControl("lblItemCode") as Label; if (lblItemCode.Text.Length == 0) { continue; } else { miscOrderDetail.Item = TheItemMgr.LoadItem(lblItemCode.Text); } } else { miscOrderDetail.Item = TheItemMgr.LoadItem(tbItemCode.Text); } TextBox tbGridQtyTextBox = this.MiscOrderDetailsGV.Rows[i].FindControl("tbQty") as TextBox; string gridRowInputQty = tbGridQtyTextBox.Text.Trim(); //int m; //if (!int.TryParse(gridRowInputQty, out m)) //{ // ShowErrorMessage("MasterData.MiscOrder.WarningMessage.InputNoIntegerValue"); // result = false; //} //decimal InputQty = decimal.Parse(gridRowInputQty); //if ((this.ModuleType.Equals(BusinessConstants.CODE_MASTER_MISC_ORDER_TYPE_VALUE_GI) // || this.ModuleType.Equals(BusinessConstants.CODE_MASTER_MISC_ORDER_TYPE_VALUE_GR)) && InputQty <= 0) //{ // ShowErrorMessage("MasterData.MiscOrder.WarningMessage.InputQtyMustThanZero"); // result = false; // return result; //} //if (this.ModuleType.Equals(BusinessConstants.CODE_MASTER_MISC_ORDER_TYPE_VALUE_ADJ) && InputQty == 0) //{ // ShowErrorMessage("MasterData.MiscOrder.WarningMessage.InputQtyDontEqualsZero"); // result = false; // return result; //} miscOrderDetail.Qty = decimal.Parse(tbGridQtyTextBox.Text.Trim()); miscOrderDetail.IsBlankDetail = false; miscOrderDetails.Add(miscOrderDetail); } MiscOrder.MiscOrderDetails = miscOrderDetails; return(result); }
protected void checkItemExists(object source, ServerValidateEventArgs args) { string code = ((TextBox)(this.FV_Item.FindControl("tbCode"))).Text; if (TheItemMgr.LoadItem(code) != null) { ShowErrorMessage("MasterData.Item.CodeExist", code); args.IsValid = false; } }
public override void UpdateView() { Item item = TheItemMgr.LoadItem(ParentItemCode); this.tbCode.Text = item.Code; this.tbDesc.Text = item.Description; this.tbUc.Text = item.UnitCount.ToString("0.########"); this.tbUom.Text = item.Uom.Code; this.GV_List.Execute(); }
protected void ODS_UomConversion_Inserting(object source, ObjectDataSourceMethodEventArgs e) { UomConversion uomConversion = (UomConversion)e.InputParameters[0]; string itemCode = ((Controls_TextBox)(this.FV_UomConversion.FindControl("tbItemCode"))).Text; string altUom = ((Controls_TextBox)(this.FV_UomConversion.FindControl("tbAltUom"))).Text; string baseUom = ((Controls_TextBox)(this.FV_UomConversion.FindControl("tbBaseUom"))).Text; itemMessage[0] = itemCode; itemMessage[1] = uomConversion.BaseQty.ToString(); itemMessage[2] = baseUom; itemMessage[3] = uomConversion.AlterQty.ToString(); itemMessage[4] = altUom; //if (itemCode == null || itemCode.Trim() == string.Empty) //{ // ShowWarningMessage("MasterData.UomConversion.Required.itemCode", ""); // e.Cancel = true; // return; //} if (altUom == null || altUom.Trim() == string.Empty) { ShowWarningMessage("MasterData.UomConversion.Required.altUom", ""); e.Cancel = true; return; } if (altUom == baseUom) { ShowWarningMessage("MasterData.UomConversion.Same.Uom", baseUom); e.Cancel = true; return; } if (baseUom == null || baseUom.Trim() == string.Empty) { ShowWarningMessage("MasterData.UomConversion.Required.baseUom", ""); e.Cancel = true; return; } if (TheUomConversionMgr.LoadUomConversion(itemCode, altUom, baseUom) == null && TheUomConversionMgr.LoadUomConversion(itemCode, baseUom, altUom) == null) { uomConversion.Item = TheItemMgr.LoadItem(itemCode); uomConversion.AlterUom = TheUomMgr.LoadUom(altUom); uomConversion.BaseUom = TheUomMgr.LoadUom(baseUom); ShowSuccessMessage("MasterData.UomConversion.AddUomConversion.Successfully", itemMessage); } else { e.Cancel = true; ShowErrorMessage("MasterData.UomConversion.AddUomConversion.Error", itemMessage); return; } }
protected void ODS_ShelfItem_Updating(object sender, ObjectDataSourceMethodEventArgs e) { string shelfCode = ((TextBox)(this.FV_ShelfItem.FindControl("tbShelf"))).Text.Trim(); string itemCode = ((TextBox)(this.FV_ShelfItem.FindControl("tbItem"))).Text.Trim(); ShelfItem shelfItem = (ShelfItem)e.InputParameters[0]; if (shelfItem != null) { shelfItem.Shelf = TheShelfMgr.LoadShelf(shelfCode); shelfItem.Item = TheItemMgr.LoadItem(itemCode); } }
private void ShowTabKit() { Item item = TheItemMgr.LoadItem(ItemCode); if (item.Type == BusinessConstants.CODE_MASTER_ITEM_TYPE_VALUE_K) { this.ucTabNavigator.ShowTabKit(true); //this.ucTabNavigator.Visible = true; } else { this.ucTabNavigator.ShowTabKit(false); //this.ucTabNavigator.Visible = false; } }
public void InitPageParameter(CycleCount cycleCount) { this.ItemList = new List <Item>(); if (cycleCount.Items != null && cycleCount.Items != string.Empty) { string[] itemArr = cycleCount.Items.Split('|'); foreach (string item in itemArr) { Item oldItem = TheItemMgr.LoadItem(item); this.ItemList.Add(oldItem); } } this.GV_List.Columns[4].Visible = cycleCount.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE; BindData(cycleCount.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE); }
protected void ODS_BomDetail_Inserting(object sender, ObjectDataSourceMethodEventArgs e) { string parcode = ((Controls_TextBox)(this.FV_BomDetail.FindControl("tbParCode"))).Text.Trim(); string compcode = ((Controls_TextBox)(this.FV_BomDetail.FindControl("tbCompCode"))).Text.Trim(); string uom = ((Controls_TextBox)(this.FV_BomDetail.FindControl("tbUom"))).Text.Trim(); string location = ((Controls_TextBox)(this.FV_BomDetail.FindControl("tbLocation"))).Text.Trim(); com.Sconit.Control.CodeMstrDropDownList ddlBackFlushMethod = (com.Sconit.Control.CodeMstrDropDownList) this.FV_BomDetail.FindControl("ddlBackFlushMethod"); bomdetail = (BomDetail)e.InputParameters[0]; bomdetail.Bom = TheBomMgr.LoadBom(parcode); item = TheItemMgr.LoadItem(compcode); bomdetail.Item = item; if (item != null) { //default compcode and uom if (uom.Trim() == "") { bomdetail.Uom = item.Uom; } else { bomdetail.Uom = TheUomMgr.LoadUom(uom); } } if (location == "") { bomdetail.Location = null; } else { bomdetail.Location = TheLocationMgr.LoadLocation(location); } if (ddlBackFlushMethod.SelectedIndex != -1) { bomdetail.BackFlushMethod = ddlBackFlushMethod.SelectedValue; } bomdetail.ScrapPercentage = bomdetail.ScrapPercentage / 100; if (TheBomDetailMgr.CheckUniqueExist(bomdetail.Bom.Code, bomdetail.Item.Code, bomdetail.Operation, bomdetail.Reference, bomdetail.StartDate)) { ShowWarningMessage("MasterData.BomDetail.WarningMessage.UniqueExistError"); e.Cancel = true; } }
public void ShowTreeView(object sender) { string itemCode = ((object[])sender)[0].ToString(); string date = ((object[])sender)[1].ToString(); string viewType = ((object[])sender)[2].ToString(); DateTime effDate = DateTime.Now; item = TheItemMgr.LoadItem(itemCode); if (item == null || item.Bom == null) { bom = TheBomMgr.LoadBom(itemCode); } else { bom = item.Bom; } if (bom == null) { ShowErrorMessage("MasterData.BomDetail.ErrorMessage.BomNotExist"); this.fld.Visible = false; return; } else { this.fld.Visible = true; } try { effDate = Convert.ToDateTime(date); } catch (Exception) { ShowWarningMessage("MasterData.BomView.WarningMessage.DateInvalid"); return; } bomDetailList = TheBomDetailMgr.GetTreeBomDetail(bom.Code, effDate); if (bomDetailList != null && bomDetailList.Count > 0) { MyOrgNode RootNode = new MyOrgNode(); GenChildOrgNode(RootNode); OrgChartBomTreeView.Node = RootNode; } }
protected void ODS_BomDetail_Updating(object sender, ObjectDataSourceMethodEventArgs e) { string parcode = ((TextBox)(this.FV_BomDetail.FindControl("tbParCode"))).Text.Trim(); string compcode = ((TextBox)(this.FV_BomDetail.FindControl("tbCompCode"))).Text.Trim(); string uom = ((Controls_TextBox)(this.FV_BomDetail.FindControl("tbUom"))).Text.Trim(); string location = ((Controls_TextBox)(this.FV_BomDetail.FindControl("tbLocation"))).Text.Trim(); string endTime = ((TextBox)(this.FV_BomDetail.FindControl("tbEndTime"))).Text.Trim(); com.Sconit.Control.CodeMstrDropDownList ddlBackFlushMethod = (com.Sconit.Control.CodeMstrDropDownList) this.FV_BomDetail.FindControl("ddlBackFlushMethod"); bomdetail = (BomDetail)e.InputParameters[0]; bomdetail.Bom = TheBomMgr.LoadBom(parcode); item = TheItemMgr.LoadItem(compcode); bomdetail.Item = item; if (item != null) { //default compcode and uom if (uom.Trim() == string.Empty) { bomdetail.Uom = item.Uom; } else { bomdetail.Uom = TheUomMgr.LoadUom(uom); } } if (location == string.Empty) { bomdetail.Location = null; } else { bomdetail.Location = TheLocationMgr.LoadLocation(location); } if (ddlBackFlushMethod.SelectedIndex != -1) { bomdetail.BackFlushMethod = ddlBackFlushMethod.SelectedValue; } if (endTime != string.Empty) { bomdetail.EndDate = DateTime.Parse(endTime); } bomdetail.ScrapPercentage = bomdetail.ScrapPercentage / 100; }
public void ListView(object sender) { string itemCode = ((object[])sender)[0].ToString(); string date = ((object[])sender)[1].ToString(); string viewType = ((object[])sender)[2].ToString(); DateTime effDate = DateTime.Now; item = TheItemMgr.LoadItem(itemCode); if (item == null) { ShowWarningMessage("MasterData.Bom.WarningMessage.CodeItem", itemCode); return; } try { effDate = Convert.ToDateTime(date); } catch (Exception) { ShowWarningMessage("MasterData.BomView.WarningMessage.DateInvalid"); return; } IList <BomDetail> bomDetailList = new List <BomDetail>(); if (viewType.ToLower() == "normal") { bomDetailList = TheBomDetailMgr.GetBomView_Nml(item, effDate); } else { bomDetailList = TheBomDetailMgr.GetBomView_Cost(itemCode, effDate); } this.GV_List.DataSource = this.ConvertListToDatatable(bomDetailList); this.GV_List.DataBind(); if (GV_List.Rows.Count > 0) { IDictionary <int, int[]> dicIndex = new Dictionary <int, int[]>(); dicIndex.Add(0, new int[] { 0, 1 }); GridViewHelper.GV_MergeTableCell(GV_List, dicIndex); } }
protected void CV_ServerValidate(object source, ServerValidateEventArgs args) { CustomValidator cv = (CustomValidator)source; switch (cv.ID) { case "cvCode": if (TheBomMgr.LoadBom(args.Value) != null) { ShowWarningMessage("MasterData.Bom.WarningMessage.CodeExist", args.Value); args.IsValid = false; } if (TheItemMgr.LoadItem(args.Value) == null) { ShowWarningMessage("MasterData.Bom.WarningMessage.CodeItem", args.Value); args.IsValid = false; } break; case "cvUom": if (TheUomMgr.LoadUom(args.Value) == null) { ShowWarningMessage("MasterData.Bom.WarningMessage.UomInvalid", args.Value); args.IsValid = false; } break; case "cvRegion": if (args.Value.Trim() != "") { if (TheRegionMgr.LoadRegion(args.Value) == null) { ShowWarningMessage("MasterData.Bom.WarningMessage.RegionInvalid", args.Value); args.IsValid = false; } } break; default: break; } }
protected void GV_List_RowUpdating(object sender, GridViewUpdateEventArgs e) { ItemReference itemReference = new ItemReference(); int id = (int)this.GV_List.DataKeys[e.RowIndex].Values[0]; string itemCode = ((Label)this.GV_List.Rows[e.RowIndex].FindControl("lblItemCode")).Text.Trim(); string partyCode = ((Label)this.GV_List.Rows[e.RowIndex].FindControl("lblPartyCode")).Text.Trim(); itemReference = TheItemReferenceMgr.LoadItemReference(id); itemReference.Item = TheItemMgr.LoadItem(itemCode); itemReference.Party = ThePartyMgr.LoadParty(partyCode); itemReference.ReferenceCode = ((Label)this.GV_List.Rows[e.RowIndex].FindControl("lblItemReferenceCode")).Text.Trim(); itemReference.Description = ((TextBox)this.GV_List.Rows[e.RowIndex].FindControl("tbDescription")).Text.Trim(); itemReference.Remark = ((TextBox)this.GV_List.Rows[e.RowIndex].FindControl("tbRemark")).Text.Trim(); itemReference.IsActive = ((CheckBox)this.GV_List.Rows[e.RowIndex].FindControl("cbActive")).Checked; TheItemReferenceMgr.UpdateItemReference(itemReference); this.GV_List.EditIndex = -1; this.GV_List.Execute(); ShowSuccessMessage("MasterData.ItemReference.UpdateItemReference.Successfully", itemReference.ReferenceCode); }
protected void lbtnDelete_Click(object sender, EventArgs e) { string code = ((LinkButton)sender).CommandArgument; try { string imageUrl = TheItemMgr.LoadItem(code).ImageUrl; if (File.Exists(Server.MapPath(imageUrl))) { File.Delete(Server.MapPath(imageUrl)); } TheItemMgr.DeleteItem(code); ShowSuccessMessage("MasterData.Item.DeleteItem.Successfully", code); UpdateView(); } catch (Castle.Facilities.NHibernateIntegration.DataException ex) { ShowErrorMessage("MasterData.Item.DeleteItem.Fail", code); } }
public void InitPageParameter() { IList <InspectItem> inspectItemList = new List <InspectItem>(); foreach (string itemCode in this.InspectItemDic.Keys) { InspectItem inspectItem = new InspectItem(); inspectItem.IsBlank = false; inspectItem.InspectQty = InspectItemDic[itemCode]; inspectItem.Item = TheItemMgr.LoadItem(itemCode); inspectItemList.Add(inspectItem); } //新行 InspectItem blankInspectItem = new InspectItem(); blankInspectItem.IsBlank = true; inspectItemList.Add(blankInspectItem); this.GV_List.DataSource = inspectItemList; this.GV_List.DataBind(); }
private IList <MaterialIn> GetMaterialInList() { IList <MaterialIn> materialInList = new List <MaterialIn>(); for (int i = 0; i < this.GV_List.Rows.Count; i++) { GridViewRow row = this.GV_List.Rows[i]; string itemCode = ((Label)row.FindControl("lblItemCode")).Text.Trim(); Label lblOperation = (Label)row.FindControl("lblOperation"); int? operation = null; if (lblOperation.Text.Trim() != string.Empty) { operation = int.Parse(lblOperation.Text.Trim()); } Label lblLocation = (Label)row.FindControl("lblLocation"); TextBox tbQty = (TextBox)row.FindControl("tbQty"); decimal qty = tbQty.Text.Trim() == string.Empty ? 0 : decimal.Parse(tbQty.Text.Trim()); MaterialIn materialIn = new MaterialIn(); materialIn.RawMaterial = TheItemMgr.LoadItem(itemCode); materialIn.Operation = operation; materialIn.Qty = qty; if (lblLocation.Text.Trim() != string.Empty) { materialIn.Location = TheLocationMgr.LoadLocation(lblLocation.Text.Trim()); } if (materialIn.Qty != 0) { materialInList.Add(materialIn); } } return(materialInList); }
protected void tbItemCode_TextChanged(object sender, EventArgs e) { string itemCode = ((TextBox)sender).Text.Trim(); GridViewRow row = (GridViewRow)((TextBox)sender).BindingContainer; TextBox tbInspectQty = (TextBox)row.FindControl("tbInspectQty"); decimal inspectQty = tbInspectQty.Text.Trim() == string.Empty ? 0 : decimal.Parse(tbInspectQty.Text.Trim()); if (itemCode != string.Empty) { Item item = TheItemMgr.LoadItem(itemCode); if (item != null) { if (InspectItemDic.ContainsKey(itemCode)) { ShowErrorMessage("MasterData.Production.Feed.Item.Exists", itemCode); return; } InspectItemDic.Add(itemCode, inspectQty); UpdateInspectItemDic(); this.InitPageParameter(); } } }
protected void lbtnAdd_Click(object sender, EventArgs e) { int rowIndex = ((GridViewRow)(((DataControlFieldCell)(((LinkButton)(sender)).Parent)).Parent)).RowIndex; GridViewRow row = this.MiscOrderDetailsGV.Rows[rowIndex]; RequiredFieldValidator rfvItemCode = (RequiredFieldValidator)row.FindControl("rfvItemCode"); if (rfvItemCode.IsValid) { UpdateMiscOrderDetails(); //int rowCount = this.MiscOrderDetailsGV.Rows.Count - 1; MiscOrderDetail miscOrderDetail = new MiscOrderDetail(); Controls_TextBox tbItemCode = row.FindControl("tbItemCode") as Controls_TextBox; miscOrderDetail.Item = TheItemMgr.LoadItem(tbItemCode.Text.Trim()); TextBox tbGridQtyTextBox = row.FindControl("tbQty") as TextBox; miscOrderDetail.Qty = decimal.Parse(tbGridQtyTextBox.Text.Trim()); miscOrderDetail.IsBlankDetail = false; this.MiscOrder.AddMiscOrderDetail(miscOrderDetail); BindMiscOrderDetails(true); } }
protected void ODS_ItemReference_Inserting(object source, ObjectDataSourceMethodEventArgs e) { ItemReference itemReference = (ItemReference)e.InputParameters[0]; string partyCode = ((Controls_TextBox)(this.FV_ItemReference.FindControl("tbPartyCode"))).Text; string referenceCode = ((TextBox)(this.FV_ItemReference.FindControl("tbReferenceCode"))).Text; if (ItemCode == null || ItemCode.Trim() == string.Empty) { ShowWarningMessage("MasterData.ItemReference.Required.ItemCode"); e.Cancel = true; return; } if (itemReference.ReferenceCode == null || itemReference.ReferenceCode.Trim() == string.Empty) { ShowWarningMessage("MasterData.ItemReference.Required.ReferenceCode"); e.Cancel = true; return; } itemReference.Item = TheItemMgr.LoadItem(ItemCode); itemReference.Party = ThePartyMgr.LoadParty(partyCode); ShowSuccessMessage("MasterData.ItemReference.AddItemReference.Successfully", itemReference.ReferenceCode); }
protected void lbtnAdd_Click(object sender, EventArgs e) { GridViewRow row = (GridViewRow)(((LinkButton)sender).Parent.Parent); string code = ((Controls_TextBox)row.FindControl("tbItemCode")).Text.Trim(); if (code == string.Empty) { ShowErrorMessage("MasterData.Order.OrderDetail.ItemCode.Required"); return; } var count = ItemList.Where(i => i.Code == code).Count(); if (count > 0) { ShowErrorMessage("Common.Business.Error.EntityExist", code); return; } Item item = TheItemMgr.LoadItem(code); this.ItemList.Add(item); BindData(true); }
protected void CV_ServerValidate(object source, ServerValidateEventArgs args) { CustomValidator cv = (CustomValidator)source; switch (cv.ID) { case "cvUom": if (TheUomMgr.LoadUom(args.Value) == null) { ShowWarningMessage("MasterData.PriceList.UomInvalid", args.Value); args.IsValid = false; } break; case "cvItem": if (TheItemMgr.LoadItem(args.Value) == null) { ShowWarningMessage("MasterData.Item.Code.NotExist"); args.IsValid = false; } break; case "cvPriceList": if (ThePriceListMgr.LoadPriceList(args.Value) == null) { ShowWarningMessage("MasterData.PriceList.Code.NotExist"); args.IsValid = false; } break; case "cvUnitPrice": try { Convert.ToDecimal(args.Value); } catch (Exception) { ShowWarningMessage("MasterData.PriceListDetail.UnitPrice.Error"); args.IsValid = false; } break; case "cvStartDate": try { Convert.ToDateTime(args.Value); } catch (Exception) { ShowWarningMessage("Common.Date.Error"); args.IsValid = false; } break; case "cvEndDate": try { if (args.Value.Trim() != "") { DateTime startDate = Convert.ToDateTime(((TextBox)(this.FV_PriceListDetail.FindControl("tbStartDate"))).Text.Trim()); if (DateTime.Compare(startDate, Convert.ToDateTime(args.Value)) >= 0) { ShowErrorMessage("MasterData.PriceList.TimeCompare"); args.IsValid = false; } } } catch (Exception) { ShowWarningMessage("Common.Date.Error"); args.IsValid = false; } break; case "cvCurrency": if (args.Value.Trim() != "") { if (TheCurrencyMgr.LoadCurrency(args.Value) == null) { ShowWarningMessage("MasterData.Currency.Code.NotExist", args.Value); args.IsValid = false; } } break; default: break; } }