protected override void FormLoad() { base.FormLoad(); gcSaleOrder.Dock = DockStyle.Fill; gvSaleOrder.OptionsBehavior.Editable = false; barAdd.Visibility = BarItemVisibility.Never; barEdit.Visibility = BarItemVisibility.Never; barDelete.Visibility = BarItemVisibility.Never; barbtn1.Visibility = BarItemVisibility.Always; barbtn1.LargeImageIndex = 17; barbtn1.Caption = "收款"; DisPlayEnum.BindEnumDS(lkpRevState, typeof(receiveState)); DisPlayEnum.BindEnumDS(lkpRevType, typeof(receiveType)); }
/// <summary> /// 获得枚举类型的数据源绑定 /// </summary> /// <param name="enumtype"></param> /// <returns></returns> public static List <DisPlayEnum> getEnumDS(Type enumtype) { List <DisPlayEnum> ds = new List <DisPlayEnum>(); var enumNames = Enum.GetNames(enumtype); for (int i = 0; i < enumNames.Length; i++) { DisPlayEnum t = new DisPlayEnum(); t.key = i; t.value = enumNames[i]; ds.Add(t); } return(ds); }
protected override void FormLoad() { base.FormLoad(); var customerlst = m_crmclient.getCustomerList(); lkpcustomer.ExtBindingDataSource <T_Customer>(customerlst, "id", "customername"); var pUds = DisPlayEnum.getEnumDS(typeof(periodUnit)); lkpPeriodUnit.ExtBindingDataSource(pUds, "key", "value"); var rtds = DisPlayEnum.getEnumDS(typeof(receiveType)); lkpRevType.ExtBindingDataSource(rtds, "key", "value"); readonlytxtbox(this.Controls, true); m_saleorder = m_ssclient.getSaleOrderbyId(m_soid); SetData(m_saleorder); if (m_saleorder.receivetype == (int)receiveType.产品明细收款) { m_saleProducts = m_ssclient.getSaleProductbysoid(m_soid); gcRecieve.DataSource = m_saleProducts; gcRecieve.MainView = gvSaledetail; //gvSaledetail.RefreshData(); colpcount.OptionsColumn.AllowEdit = false; colpcode.OptionsColumn.AllowEdit = false; colpname.OptionsColumn.AllowEdit = false; colpspec.OptionsColumn.AllowEdit = false; colpmodelprice.OptionsColumn.AllowEdit = false; colpunitprice.OptionsColumn.AllowEdit = false; colptotalprice.OptionsColumn.AllowEdit = false; colpcount.OptionsColumn.AllowEdit = false; } else { this.barbtn1.Visibility = BarItemVisibility.Always; this.barbtn1.LargeImageIndex = 8; this.barbtn1.Caption = "收款登记"; this.ribbonPageGroup2.Visible = true; m_saleRev = m_ssclient.getSaleRevbySoid(m_soid); gcRecieve.DataSource = m_saleRev; gcRecieve.MainView = gvSaleRev; colsrid.Visible = false; colsoid.Visible = false; coluid.OptionsColumn.AllowEdit = false; } }
/// <summary> /// 获得枚举类型的数据源绑定,并绑定至xtragrid的lookupEdit /// </summary> /// <param name="lkupedit"></param> /// <param name="enumtype"></param> public static void BindEnumDS(RepositoryItemLookUpEdit lkupedit, Type enumtype) { List <DisPlayEnum> ds = new List <DisPlayEnum>(); var enumNames = Enum.GetNames(enumtype); for (int i = 0; i < enumNames.Length; i++) { DisPlayEnum t = new DisPlayEnum(); t.key = i; t.value = enumNames[i]; ds.Add(t); } lkupedit.DataSource = ds; lkupedit.ValueMember = "key"; lkupedit.DisplayMember = "value"; lkupedit.ShowFooter = false; lkupedit.ShowHeader = false; }
protected override void FormLoad() { base.FormLoad(); InitCustomerCmb(); //DisPlayEnum.ExtGetEnumDS(lkpPeriodUnit, typeof(periodUnit)); var pUds = DisPlayEnum.getEnumDS(typeof(periodUnit)); lkpPeriodUnit.ExtBindingDataSource(pUds, "key", "value"); //DisPlayEnum.ExtGetEnumDS(lkpRevType, typeof(receiveType)); var rtds = DisPlayEnum.getEnumDS(typeof(receiveType)); lkpRevType.ExtBindingDataSource(rtds, "key", "value"); this.barbtn1.Visibility = BarItemVisibility.Always; this.barbtn1.LargeImageIndex = 8; gcSaledetail.DataSource = m_saleProducts; if (formmode == frmmodetype.add) { m_saleorder = new T_saleorder(); } else if (formmode == frmmodetype.edit) { m_saleorder = m_ssclient.getSaleOrderbyId(m_soid); SetData(m_saleorder); m_saleProducts = m_ssclient.getSaleProductbysoid(m_soid); gcSaledetail.DataSource = m_saleProducts; gvSaledetail.RefreshData(); colpcode.OptionsColumn.AllowEdit = false; colpname.OptionsColumn.AllowEdit = false; colpspec.OptionsColumn.AllowEdit = false; colpmodelprice.OptionsColumn.AllowEdit = false; colpunitprice.OptionsColumn.AllowEdit = false; colptotalprice.OptionsColumn.AllowEdit = false; } else if (formmode == frmmodetype.delete) { m_saleorder = m_ssclient.getSaleOrderbyId(m_soid); SetData(m_saleorder); readonlytxtbox(this.Controls, true); gvSaledetail.OptionsBehavior.Editable = false; m_saleProducts = m_ssclient.getSaleProductbysoid(m_soid); gcSaledetail.RefreshDataSource(); } }
/// <summary> /// 设置数据至控件 /// </summary> /// <param name="saleOrder"></param> private void SetData(T_saleorder saleOrder) { txtSono.Text = saleOrder.saleno; txtOrderAmt.Text = saleOrder.saletotalamount.HasValue ? saleOrder.saletotalamount.Value.ToString() : ""; txtPeriod.Text = saleOrder.receiveperiod.HasValue ? saleOrder.receiveperiod.Value.ToString() : ""; txtremarks.Text = saleOrder.remarks; if (saleOrder.receiveamount.HasValue) { txtRevAmt.Text = saleOrder.receiveamount.Value.ToString(); } //txtRevAmt.Text = saleOrder.receiveamount.HasValue ? saleOrder.receiveamount.Value.ToString() : ""; //txtRevRatio.Text = (saleOrder.receiveratio.HasValue ? saleOrder.receiveratio.Value.ToString() : "0") + "%"; txtRevRatio.Text = saleOrder.receiveratio; txtRevStatus.Text = DisPlayEnum.getEnumName(typeof(receiveState), saleOrder.receivestate); txtOrderStatus.Text = DisPlayEnum.getEnumName(typeof(orderState), saleOrder.orderstate); dateSaleOrder.DateTime = saleOrder.saledate; lkpPeriodUnit.EditValue = saleOrder.receiveperiodtype; lkpRevType.EditValue = saleOrder.receivetype; lkpcustomer.EditValue = saleOrder.customerid; InitQt(saleOrder.customerid); lkpqtno.EditValue = saleOrder.quotationid; }
protected override void FormLoad() { DisPlayEnum.BindEnumDS(lkupOrderState, typeof(orderState)); base.FormLoad(); }
/// <summary> /// 获得枚举类型的数据源绑定 /// </summary> /// <param name="enumtype"></param> /// <returns></returns> public static List<DisPlayEnum> getEnumDS(Type enumtype) { List<DisPlayEnum> ds = new List<DisPlayEnum>(); var enumNames = Enum.GetNames(enumtype); for (int i = 0; i < enumNames.Length; i++) { DisPlayEnum t = new DisPlayEnum(); t.key = i; t.value = enumNames[i]; ds.Add(t); } return ds; }
/// <summary> /// 获得枚举类型的数据源绑定,并绑定至xtragrid的lookupEdit /// </summary> /// <param name="lkupedit"></param> /// <param name="enumtype"></param> public static void BindEnumDS(RepositoryItemLookUpEdit lkupedit, Type enumtype) { List<DisPlayEnum> ds = new List<DisPlayEnum>(); var enumNames = Enum.GetNames(enumtype); for (int i = 0; i < enumNames.Length; i++) { DisPlayEnum t = new DisPlayEnum(); t.key = i; t.value = enumNames[i]; ds.Add(t); } lkupedit.DataSource = ds; lkupedit.ValueMember = "key"; lkupedit.DisplayMember = "value"; lkupedit.ShowFooter = false; lkupedit.ShowHeader = false; }