protected void ODS_Uom_Inserting(object source, ObjectDataSourceMethodEventArgs e) { Uom uom = (Uom)e.InputParameters[0]; uom.Description = uom.Description.Trim(); uom.Name = uom.Name.Trim(); if (uom.Code == null || uom.Code.Trim() == string.Empty) { ShowWarningMessage("MasterData.Uom.Code.Empty", ""); e.Cancel = true; return; } else { uom.Code = uom.Code.Trim(); } if (TheUomMgr.LoadUom(uom.Code) == null) { ShowSuccessMessage("MasterData.Uom.AddUom.Successfully", uom.Code); } else { e.Cancel = true; ShowErrorMessage("MasterData.Uom.AddUom.Error", uom.Code); } }
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 CV_ServerValidate(object source, ServerValidateEventArgs args) { CustomValidator cv = (CustomValidator)source; switch (cv.ID) { 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 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_Bom_Updating(object sender, ObjectDataSourceMethodEventArgs e) { string uom = ((Controls_TextBox)(this.FV_Bom.FindControl("tbUom"))).Text.Trim(); string region = ((TextBox)(this.FV_Bom.FindControl("tbRegion"))).Text.Trim(); bom = (Bom)e.InputParameters[0]; bom.Uom = TheUomMgr.LoadUom(uom); if (region == "") { bom.Region = null; } else { bom.Region = TheRegionMgr.LoadRegion(region); } }
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; } }
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; }
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; } }
protected void btnConfirm_Click(object sender, EventArgs e) { try { IList<TransformerDetail> transformerDetailList = this.ucList.PopulateTransformerDetailList(); IList<OrderDetail> orderDetailList = new List<OrderDetail>(); string currentFlow = string.Empty; foreach (TransformerDetail transformerDetail in transformerDetailList) { if (transformerDetail.CurrentQty != transformerDetail.AdjustQty) { OrderLocationTransaction orderLocTrans = TheOrderLocationTransactionMgr.LoadOrderLocationTransaction(transformerDetail.OrderLocTransId); if (currentFlow == string.Empty) { currentFlow = orderLocTrans.OrderDetail.OrderHead.Flow; } OrderDetail orderDetail = new OrderDetail(); orderDetail.Item = TheItemMgr.LoadItem(transformerDetail.ItemCode); orderDetail.Uom = TheUomMgr.LoadUom(transformerDetail.UomCode); if (transformerDetail.HuId != null && transformerDetail.HuId.Trim() != string.Empty) { Hu hu = this.TheHuMgr.CheckAndLoadHu(transformerDetail.HuId.Trim()); orderDetail.OrderedQty = transformerDetail.AdjustQty - hu.Qty; } else { orderDetail.OrderedQty = transformerDetail.AdjustQty - transformerDetail.CurrentQty; } orderDetail.UnitCount = transformerDetail.UnitCount; orderDetail.HuId = transformerDetail.HuId; orderDetail.HuLotNo = transformerDetail.LotNo; if (transformerDetail.LocationFromCode != null) { orderDetail.LocationFrom = TheLocationMgr.LoadLocation(transformerDetail.LocationFromCode); } if (transformerDetail.LocationToCode != null) { orderDetail.LocationTo = TheLocationMgr.LoadLocation(transformerDetail.LocationToCode); } orderDetailList.Add(orderDetail); } } if (orderDetailList.Count > 0) { Receipt receipt = TheOrderMgr.QuickReceiveOrder(currentFlow, orderDetailList, this.CurrentUser.Code, BusinessConstants.CODE_MASTER_ORDER_SUB_TYPE_VALUE_ADJ, DateTime.Now, DateTime.Now, false, this.ReceiptNo, null); this.Visible = false; ShowSuccessMessage("MasterData.Receipt.Adjust.Successfully", this.ReceiptNo); if (AdjustEvent != null) { AdjustEvent(receipt.ReceiptNo, e); } } else { ShowSuccessMessage("MasterData.Receipt.NoDetail.Adjust", this.ReceiptNo); } } catch (BusinessErrorException ex) { ShowErrorMessage(ex); } }
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.Bom.WarningMessage.UomInvalid", args.Value); args.IsValid = false; } break; case "cvRateQty": try { Convert.ToDecimal(args.Value); } catch (Exception) { ShowWarningMessage("MasterData.BomDetail.WarningMessage.RateQtyError", args.Value); args.IsValid = false; } break; case "cvStruType": if (TheCodeMasterMgr.GetCachedCodeMaster(BusinessConstants.CODE_MASTER_BOM_DETAIL_TYPE, args.Value) == null) { ShowWarningMessage("MasterData.BomDetail.WarningMessage.StruTypeError"); args.IsValid = false; } break; case "cvScrapPercentage": try { Convert.ToDecimal(args.Value); } catch (Exception) { ShowWarningMessage("MasterData.BomDetail.WarningMessage.ScrapPercentageError"); args.IsValid = false; } break; case "cvStartTime": try { Convert.ToDateTime(args.Value); } catch (Exception) { ShowWarningMessage("MasterData.BomDetail.WarningMessage.StartTimeError"); args.IsValid = false; } break; case "cvEndTime": try { if (args.Value.Trim() != "") { Convert.ToDateTime(args.Value); } } catch (Exception) { ShowWarningMessage("MasterData.BomDetail.WarningMessage.EndTimeError"); args.IsValid = false; } break; case "cvLocation": if (args.Value.Trim() != "") { if (TheLocationMgr.LoadLocation(args.Value) == null) { ShowWarningMessage("MasterData.BomDetail.WarningMessage.LocationError", args.Value); args.IsValid = false; } } break; default: break; } }
protected void ODS_Item_Updating(object sender, ObjectDataSourceMethodEventArgs e) { Item item = (Item)e.InputParameters[0]; item.Desc1 = item.Desc1.Trim(); item.Desc2 = item.Desc2.Trim(); item.Memo = item.Memo.Trim(); item.Type = ((CodeMstrDropDownList)(this.FV_Item.FindControl("ddlType"))).SelectedValue; string uom = ((TextBox)(this.FV_Item.FindControl("tbUom"))).Text.Trim(); item.Uom = TheUomMgr.LoadUom(uom); string location = ((Controls_TextBox)(this.FV_Item.FindControl("tbLocation"))).Text.Trim(); item.Location = TheLocationMgr.LoadLocation(location); string bom = ((Controls_TextBox)(this.FV_Item.FindControl("tbBom"))).Text.Trim(); item.Bom = TheBomMgr.LoadBom(bom); string routing = ((Controls_TextBox)(this.FV_Item.FindControl("tbRouting"))).Text.Trim(); item.Routing = TheRoutingMgr.LoadRouting(routing); string plant = ((CodeMstrDropDownList)(this.FV_Item.FindControl("ddlPlantType"))).Text.Trim(); item.Plant = plant; decimal uc = item.UnitCount; uc = System.Decimal.Round(uc, 8); if (uc == 0) { ShowErrorMessage("MasterData.Item.UC.Zero"); e.Cancel = true; } com.Sconit.Control.CodeMstrDropDownList ddlItemCategory = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Item.FindControl("ddlItemCategory")); if (ddlItemCategory.SelectedIndex != 0) { item.Category = ddlItemCategory.SelectedValue; } string imageUrl; string imgUpload = ((System.Web.UI.WebControls.Image)(this.FV_Item.FindControl("imgUpload"))).ImageUrl; if (((CheckBox)(this.FV_Item.FindControl("cbDeleteImage"))).Checked == true) { imageUrl = null; if (File.Exists(Server.MapPath(imgUpload))) { File.Delete(Server.MapPath(imgUpload)); } } else { imageUrl = UploadItemImage(item.Code); if (imageUrl == null) { imageUrl = imgUpload; } } item.ImageUrl = imageUrl; item.LastModifyDate = DateTime.Now; item.LastModifyUser = this.CurrentUser; }
protected void ODS_FlowDetail_Updating(object sender, ObjectDataSourceMethodEventArgs e) { FlowDetail flowDetail = (FlowDetail)e.InputParameters[0]; FlowDetail oldFLowDetail = TheFlowDetailMgr.LoadFlowDetail(this.FlowDetailId); Flow flow = TheFlowMgr.LoadFlow(FlowCode, true); flowDetail.Flow = flow; flowDetail.CreateDate = oldFLowDetail.CreateDate; flowDetail.CreateUser = oldFLowDetail.CreateUser; flowDetail.LastModifyDate = DateTime.Now; flowDetail.LastModifyUser = this.CurrentUser; flowDetail.Version = oldFLowDetail.Version + 1; //seq if (flowDetail.Sequence == 0) { flowDetail.Sequence = TheFlowDetailMgr.LoadFlowDetail(this.FlowDetailId).Sequence; } Controls_TextBox tbItemCode = (Controls_TextBox)(this.FV_FlowDetail.FindControl("tbItemCode")); Controls_TextBox tbUom = (Controls_TextBox)(this.FV_FlowDetail.FindControl("tbUom")); if (tbItemCode != null && tbItemCode.Text.Trim() != string.Empty) { flowDetail.Item = TheItemMgr.LoadItem(tbItemCode.Text.Trim()); } if (tbUom != null && tbUom.Text.Trim() != string.Empty) { flowDetail.Uom = TheUomMgr.LoadUom(tbUom.Text.Trim()); } if (this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_PROCUREMENT || this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_CUSTOMERGOODS || this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_SUBCONCTRACTING) { Controls_TextBox tbLocTo = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbProcurementLocTo"); if (tbLocTo != null && tbLocTo.Text.Trim() != string.Empty) { flowDetail.LocationTo = TheLocationMgr.LoadLocation(tbLocTo.Text.Trim()); } //djin 20120802 保存参考物料号 Controls_TextBox tbRefItemCode = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbRefItemCode"); if (tbRefItemCode != null && tbRefItemCode.Text.Trim() != string.Empty) { flowDetail.ReferenceItemCode = tbRefItemCode.Text.Trim(); } //end if (this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_PROCUREMENT) { DropDownList ddlBillSettleTerm = (DropDownList)this.FV_FlowDetail.FindControl("ddlBillSettleTerm"); if (ddlBillSettleTerm.SelectedIndex != -1) { if (ddlBillSettleTerm.SelectedValue == string.Empty) { flowDetail.BillSettleTerm = null; } else { flowDetail.BillSettleTerm = ddlBillSettleTerm.SelectedValue; } } com.Sconit.Control.CodeMstrDropDownList ddlBarCodeType = (com.Sconit.Control.CodeMstrDropDownList) this.FV_FlowDetail.FindControl("ddlBarCodeType"); if (ddlBarCodeType.SelectedIndex != -1) { flowDetail.BarCodeType = ddlBarCodeType.SelectedValue; } } } else if (this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_DISTRIBUTION) { Controls_TextBox tbLocFrom = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbDistributionLocFrom"); if (tbLocFrom != null && tbLocFrom.Text.Trim() != string.Empty) { flowDetail.LocationFrom = TheLocationMgr.LoadLocation(tbLocFrom.Text.Trim()); } DropDownList ddlBillSettleTerm = (DropDownList)this.FV_FlowDetail.FindControl("ddlBillSettleTerm"); if (ddlBillSettleTerm.SelectedIndex != -1) { flowDetail.BillSettleTerm = ddlBillSettleTerm.SelectedValue; } DropDownList ddlOddShipOption = (DropDownList)this.FV_FlowDetail.FindControl("ddlOddShipOption"); if (ddlOddShipOption.SelectedIndex != -1) { flowDetail.OddShipOption = ddlOddShipOption.SelectedValue; } flowDetail.PackagingCode = ((System.Web.UI.HtmlControls.HtmlSelect) this.FV_FlowDetail.FindControl("tbPackagingCode")).Value; flowDetail.TransModeCode = ((System.Web.UI.HtmlControls.HtmlSelect) this.FV_FlowDetail.FindControl("tbTransModeCode")).Value; } else if (this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_PRODUCTION) { Controls_TextBox tbBom = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbBom"); if (tbBom != null && tbBom.Text.Trim() != string.Empty) { flowDetail.Bom = TheBomMgr.LoadBom(tbBom.Text.Trim()); } TextBox tbBatchSize = (TextBox)this.FV_FlowDetail.FindControl("tbBatchSize"); Controls_TextBox tbLocFrom = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbProductionLocFrom"); if (tbBatchSize.Text.Trim() != string.Empty) { flowDetail.BatchSize = decimal.Parse(tbBatchSize.Text.Trim()); } if (tbLocFrom != null && tbLocFrom.Text.Trim() != string.Empty) { flowDetail.LocationFrom = TheLocationMgr.LoadLocation(tbLocFrom.Text.Trim()); } Controls_TextBox tbLocTo = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbProductionLocTo"); if (tbLocTo != null && tbLocTo.Text.Trim() != string.Empty) { flowDetail.LocationTo = TheLocationMgr.LoadLocation(tbLocTo.Text.Trim()); } Controls_TextBox tbCustomer = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbCustomer"); if (tbCustomer != null && tbCustomer.Text.Trim() != string.Empty) { flowDetail.Customer = TheCustomerMgr.LoadCustomer(tbCustomer.Text.Trim()); } com.Sconit.Control.CodeMstrDropDownList ddlBarCodeType = (com.Sconit.Control.CodeMstrDropDownList) this.FV_FlowDetail.FindControl("ddlBarCodeType"); if (ddlBarCodeType.SelectedIndex != -1) { flowDetail.BarCodeType = ddlBarCodeType.SelectedValue; } } else if (this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_TRANSFER) { Controls_TextBox tbLocFrom = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbTransferLocFrom"); if (tbLocFrom != null && tbLocFrom.Text.Trim() != string.Empty) { flowDetail.LocationFrom = TheLocationMgr.LoadLocation(tbLocFrom.Text.Trim()); } Controls_TextBox tbLocTo = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbTransferLocTo"); if (tbLocTo != null && tbLocTo.Text.Trim() != string.Empty) { flowDetail.LocationTo = TheLocationMgr.LoadLocation(tbLocTo.Text.Trim()); } DropDownList ddlOddShipOption = (DropDownList)this.FV_FlowDetail.FindControl("ddlOddShipOption"); if (ddlOddShipOption.SelectedIndex != -1) { flowDetail.OddShipOption = ddlOddShipOption.SelectedValue; } } }
protected void ODS_Item_Inserting(object sender, ObjectDataSourceMethodEventArgs e) { item = (Item)e.InputParameters[0]; item.Desc1 = item.Desc1.Trim(); item.Desc2 = item.Desc2.Trim(); item.Memo = item.Memo.Trim(); if (item.Code == null || item.Code.Trim() == string.Empty) { ShowErrorMessage("MasterData.Item.Code.Empty"); e.Cancel = true; return; } else { item.Code = item.Code.Trim(); } if (TheItemMgr.LoadItem(item.Code) != null) { e.Cancel = true; ShowErrorMessage("MasterData.Item.CodeExist", item.Code); return; } string uom = ((Controls_TextBox)(this.FV_Item.FindControl("tbUom"))).Text.Trim() == string.Empty ? "EA" : ((Controls_TextBox)(this.FV_Item.FindControl("tbUom"))).Text.Trim(); item.Uom = TheUomMgr.LoadUom(uom); string location = ((Controls_TextBox)(this.FV_Item.FindControl("tbLocation"))).Text.Trim(); item.Location = TheLocationMgr.LoadLocation(location); string bom = ((Controls_TextBox)(this.FV_Item.FindControl("tbBom"))).Text.Trim(); item.Bom = TheBomMgr.LoadBom(bom); string routing = ((Controls_TextBox)(this.FV_Item.FindControl("tbRouting"))).Text.Trim(); item.Routing = TheRoutingMgr.LoadRouting(routing); decimal uc = item.UnitCount; uc = System.Decimal.Round(uc, 8); if (uc == 0) { ShowErrorMessage("MasterData.Item.UC.Zero"); e.Cancel = true; } com.Sconit.Control.CodeMstrDropDownList ddlItemCategory = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Item.FindControl("ddlItemCategory")); if (ddlItemCategory.SelectedIndex != 0) { item.Category = ddlItemCategory.SelectedValue; } item.ImageUrl = UploadItemImage(item.Code); item.LastModifyDate = DateTime.Now; item.LastModifyUser = this.CurrentUser; }