public override void BindControl() { MachiningDAL dal = new MachiningDAL(); var machs = dal.GetMachBySource(SourceType, SourceNo); Utility.BindDataToRepeater(rpMachining, machs); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Utility.BindDataToDropdown(ddlDeliveryStatus, Utility.GetDeliveryStatusList()); Utility.BindDataToDropdown(ddlDeliveryMethod, Utility.GetLookupList(SysConst.DeliveryCatelog)); Utility.BindDataToDropdown(ddlInstallType, Utility.GetLookupList(SysConst.InstallCatelog)); Utility.BindDataToDropdown(ddlDelCreateMan, Utility.GetUserList2(true)); Utility.BindDataToDropdown(ddlSalesMan, Utility.GetUserList2(true)); if (!string.IsNullOrEmpty(DeliveryNo)) { DeliveryDAL dDAL = new DeliveryDAL(); var del = dDAL.GetDeliveryByNo(DeliveryNo); OrderDAL soDAL = new OrderDAL(); var ord = soDAL.GetOrderByNo(SourceNo); MachiningDAL mDAL = new MachiningDAL(); var machList = mDAL.GetMachBySource(SysConst.SourceTypeOrder, SourceNo); foreach (var item in machList) { cblMach.Items.Add(new ListItem() { Text = item.Mach_No, Value = item.Mach_Id.ToString() }); } //basic txtCreatedDate.Text = del.CreatedDate.ToString("yyyy-MM-dd"); ddlSalesMan.SelectedValue = del.OrderMan; ddlDelCreateMan.SelectedValue = del.DeliveryCreateMan; lnkOrder.Text = SourceNo; lnkOrder.NavigateUrl = Page.ResolveUrl(string.Format("~/OrderForm.aspx?ordid={0}&ordno={1}&sourcetype={2}&sourceno={3}", ord.Order_Id, ord.Order_No, ord.SourceType, ord.SourceNo)); if (!string.IsNullOrEmpty(del.MachList)) { foreach (ListItem item in cblMach.Items) { if (del.MachList.Contains(item.Text)) { item.Selected = true; } } } //customer this.customerInfoControl.SetValue( del.CustomerCompanyName, del.CustomerContactName, del.CustomerAddress, del.CustomerEmail, del.CustomerQQ, del.CustomerPhone1, del.CustomerPhone2, del.CustomerOthers); //delivery type this.ddlDeliveryMethod.SelectedValue = del.DeliveryType; this.txtDelIntro.Text = del.DeliveryIntro; this.txtDeliveryDriverMan.Text = del.DeliveryDriverMan; this.txtDelPhone.Text = del.DriverPhone; this.txtCarType.Text = del.CarType; this.txtDeliveryToAddress.Text = del.DeliveryToAddress; this.txtExpectDeliveryDate.Text = del.ExpectedDeliveryDate.HasValue ? del.ExpectedDeliveryDate.Value.ToString("yyyy-MM-dd") : string.Empty; this.txtRealDelDate.Text = del.RealDeliveryDate.HasValue ? del.RealDeliveryDate.Value.ToString("yyyy-MM-dd") : string.Empty; //install this.chkProvideInstall.Checked = del.IsInstallProvided; this.ddlInstallType.SelectedValue = del.InstallType; this.txtInstallIntro.Text = del.InstallIntro; this.txtInstallMan.Text = del.InstallMan; this.txtInstallPhone.Text = del.InstallPhone; this.txtInstallDate.Text = del.InstallDate.HasValue ? del.InstallDate.Value.ToString("yyyy-MM-dd"):string.Empty; this.chkInsteadSettlement.Checked = del.InsteadOfSettlement; //delivery content lineItemControl.SourceId = del.Delivery_Id; UIUtility.BindUserControl(lineItemControl, SysConst.SourceTypeDelivery, del.Delivery_No); //settlement info if (chkInsteadSettlement.Checked) { SettlementDAL dal = new SettlementDAL(); SetAmount(SysConst.SourceTypeDelivery, del.Delivery_Id); txtTotalAmount.Text = del.TotalAmount.ToString(); txtReceivedFirst.Text = del.FirstAmount.ToString(); txtReceived.Text = del.ReceivedAmount.ToString(); txtBalanceIntro.Text = del.ReceivableIntro; lblEndBalance.Text = ((del.TotalAmount.HasValue ? del.TotalAmount.Value : 0) - (del.ReceivedAmount.HasValue ? del.ReceivedAmount.Value : 0)).ToString(); var accumulateAmount = dal.GetSettlementByOrderNo(SourceNo).Where(s => s.CreatedDate <= del.CreatedDate).Sum(settle => settle.TotalAmount); var receivableTotal = new ReceiptDAL().GetReceiptBySource(SysConst.SourceTypeOrder, del.Order_No).Where(r => r.ReceivedDate <= del.CreatedDate).Sum(re => re.ReceivedAmount); lblAccumulateAmount.Text = accumulateAmount.ToString(); lblReceivableTotal.Text = receivableTotal.ToString(); } //intro UIUtility.BindUserControl(FooterIntroControl1, SysConst.SourceTypeDelivery, del.Delivery_No); this.ddlDeliveryStatus.SelectedValue = del.Status; //followup UIUtility.BindUserControl(followUpControl, SysConst.SourceTypeDelivery, del.Delivery_No); } } }