protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); _formPanel = new FormPanel(); _formPanel.BodyPadding = 10; _formPanel.Layout = "table"; _formPanel.LayoutConfig.Add(new TableLayoutConfig() { Columns = 2 }); _formPanel.ID = "addForm"; _formPanel.DefaultAnchor = "100%"; _txtUsername = new TextField(); _txtUsername.ID = "txtUsername"; _txtUsername.Name = "Username"; _txtUsername.ColSpan = 1; _txtUsername.Width = 300; _txtUsername.AllowBlank = false; _txtUsername.FieldLabel = "用户名"; _txtUsername.EmptyText = "输入用户名"; _formPanel.Add(_txtUsername); _comboStatus = new ComboBox(); _comboStatus.EmptyText = "选择状态"; _comboStatusStore = new Store(); _comboStatusStore.ID = "comboStoreStatus"; _comboStatusStore.Model.Add(ComponentHelper.GetModel( new Dictionary<string, ModelFieldType>(){ {"Id",ModelFieldType.Int},{"Name",ModelFieldType.String} })); _comboStatus.ValueHiddenName = "Status"; _comboStatus.SimpleSubmit = true; _comboStatus.DisplayField = "Name"; _comboStatus.ValueField = "Id"; _comboStatus.Store.Add(_comboStatusStore); _comboStatus.FieldLabel = "状态"; _comboStatus.Editable = false; _formPanel.Add(_comboStatus); _txtMemo = new TextArea(); _txtMemo.Width = 750; _txtMemo.Name = "Description"; _txtMemo.ColSpan = 2; _txtMemo.FieldLabel = "描述"; _txtMemo.Height = 80; _formPanel.Add(_txtMemo); _treeRoleSelector = new TreePanelNodeMover(); _treeRoleSelector.LeftReadData += _treeRoleSelector_LeftReadData; //_treeRoleSelector.RightReadData += _treeRoleSelector_RightReadData; _treeRoleSelector.Height = 180; _treeRoleSelector.Width = 750; _treeRoleSelector.ColSpan = 2; _treeRoleSelector.ID = "treeRoles"; _formPanel.Add(_treeRoleSelector); _btnAdd = new Button(); _btnAdd.Text = "添加"; _btnAdd.Icon = Icon.Add; _btnAdd.DirectEvents.Click.Event += AddUser; _btnAdd.DirectEvents.Click.EventMask.Set("正在添加"); _formPanel.Buttons.Add(_btnAdd); MainForm.Controls.Add(_formPanel); }
public void GetCombobox(ref Ext.Net.ComboBox combobox) { combobox.DisplayField = "TEN_CHUCVU"; combobox.ValueField = "MA_CHUCVU"; combobox.EnableViewState = false; string storeName = "store" + combobox.ID; Ext.Net.Store store = new CommonUtil().GetStore(storeName, "~/Modules/Base/ComboHandler.ashx", "DM_CHUCVU", "MA_CHUCVU", "TEN_CHUCVU"); combobox.Store.Add(store); combobox.Listeners.Expand.Handler += "if(" + storeName + ".getCount()==0){" + storeName + ".reload();}"; }
protected void cmbVessel_Select(object sender, DirectEventArgs e) { Ext.Net.ComboBox combox = sender as ComboBox; if (combox.ID == "cmbpreVessel") { cmbpreVoyage.Text = ""; } else { cmbVesselText.Text = ""; } ComList(combox); }
/// <summary> /// 验证ComboBox是否为空 /// </summary> /// <param name="text"></param> /// <returns></returns> public bool CheckNullOrEmpty(Ext.Net.ComboBox text) { if (string.IsNullOrEmpty(text.Text.Trim())) { text.Text = ""; text.Focus(); return(true); } else { return(false); } }
private void EstadosNotaSiguienteSt_Refresh(Ext.Net.ComboBox siguienteIdCmb) { try { EstadoNotaDePesoLogic estadologic = new EstadoNotaDePesoLogic(); int siguiente = siguienteIdCmb.Text == "" ? 0 : Convert.ToInt32(siguienteIdCmb.Text); this.EstadosNotaSiguienteSt.DataSource = estadologic.GetEstadosNotaDePesoSinAsignar(siguiente); this.EstadosNotaSiguienteSt.DataBind(); } catch (Exception ex) { log.Fatal("Error fatal al obtener estados de nota de peso.", ex); throw; } }
protected void cmbVesselText_Select(object sender, DirectEventArgs e) { Ext.Net.ComboBox combox = sender as ComboBox; if (combox.ID == "cmbpreVoyage") { if (cmbpreVessel.SelectedItem.Value != "") { DataTable dt = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_BasicData_ComboBoxBinder_SP", new List <IFields>() { dal.CreateIFields().Append("Option", "VoyageByID"). Append("STAT", cmbpreVoyage.SelectedItem.Value) }).GetTable(); txtpreonboard.Text = dt.Rows[0][8].ToString(); } } else { if (cmbVesselText.SelectedItem.Value != "") { DataTable dt = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_BasicData_ComboBoxBinder_SP", new List <IFields>() { dal.CreateIFields().Append("Option", "VoyageByID"). Append("STAT", cmbVesselText.SelectedItem.Value) }).GetTable(); txtETD.Text = dt.Rows[0][2].ToString(); txtETADischarge.Text = dt.Rows[0][3].ToString(); cmbLoading.setValue(BaseCheckCode.locationCheckCode(dt.Rows[0][4].ToString())); cmbPort.setValue(BaseCheckCode.locationCheckCode(dt.Rows[0][5].ToString())); cmbFinalDest.setValue(BaseCheckCode.locationCheckCode(dt.Rows[0][5].ToString())); txtCFSClosing.Text = dt.Rows[0][6].ToString(); txtCYClosing.Text = dt.Rows[0][7].ToString(); txtOnBoard.Text = dt.Rows[0][8].ToString(); } } }
/// <summary> /// Lấy fieldname và giá trị /// </summary> /// <param name="control"></param> /// <param name="value"></param> /// <returns></returns> private string GetFieldName(Ext.Net.Component control, ref object value) { switch (control.ToString()) { case "Ext.Net.TextField": Ext.Net.TextField txtControl = (Ext.Net.TextField)control; value = txtControl.Text; if (!txtControl.ID.Contains("_")) { return(""); } else { return(txtControl.ID.Substring(txtControl.ID.IndexOf("_") + 1)); } case "Ext.Net.Hidden": Ext.Net.Hidden hdfControl = (Ext.Net.Hidden)control; value = hdfControl.Text; if (!hdfControl.ID.Contains("_")) { return(""); } else { return(hdfControl.ID.Substring(hdfControl.ID.IndexOf("_") + 1)); } case "Ext.Net.Checkbox": Ext.Net.Checkbox chk = (Ext.Net.Checkbox)control; value = chk.Checked == true ? 1 : 0; if (!chk.ID.Contains("_")) { return(""); } else { return(chk.ID.Substring(chk.ID.IndexOf("_") + 1)); } case "Ext.Net.DateField": Ext.Net.DateField dfDate = (Ext.Net.DateField)control; if (!SoftCore.Util.GetInstance().IsDateNull(dfDate.SelectedDate)) { value = dfDate.SelectedDate.Month + "/" + dfDate.SelectedDate.Day + "/" + dfDate.SelectedDate.Year; } else { value = ""; } if (!dfDate.ID.Contains("_")) { return(""); } else { return(dfDate.ID.Substring(dfDate.ID.IndexOf("_") + 1)); } case "Ext.Net.NumberField": Ext.Net.NumberField nbf = (Ext.Net.NumberField)control; value = nbf.Text; if (!nbf.ID.Contains("_")) { return(""); } else { return(nbf.ID.Substring(nbf.ID.IndexOf("_") + 1)); } case "Ext.Net.ComboBox": Ext.Net.ComboBox cbBox = (Ext.Net.ComboBox)control; value = cbBox.SelectedItem.Value; if (!cbBox.ID.Contains("_")) { return(""); } else { return(cbBox.ID.Substring(cbBox.ID.IndexOf("_") + 1)); } case "Ext.Net.SpinnerField": Ext.Net.SpinnerField spinnerField = (Ext.Net.SpinnerField)control; value = spinnerField.Text; if (!spinnerField.ID.Contains("_")) { return(""); } else { return(spinnerField.ID.Substring(spinnerField.ID.IndexOf("_") + 1)); } case "Ext.Net.TextArea": Ext.Net.TextArea txtArea = (Ext.Net.TextArea)control; value = txtArea.Text; if (!txtArea.ID.Contains("_")) { return(""); } else { return(txtArea.ID.Substring(txtArea.ID.IndexOf("_") + 1)); } case "Ext.Net.Container": Ext.Net.Container cContainer = (Ext.Net.Container)control; GetChildControl(cContainer); break; case "Ext.Net.FieldSet": Ext.Net.FieldSet fieldSet = (Ext.Net.FieldSet)control; GetChildControl(fieldSet); break; case "Ext.Net.HtmlEditor": Ext.Net.HtmlEditor htmlEditor = (Ext.Net.HtmlEditor)control; value = htmlEditor.Text; if (!htmlEditor.ID.Contains("_")) { return(""); } else { return(htmlEditor.ID.Substring(htmlEditor.ID.IndexOf("_") + 1)); } } return(""); }
private void InitComponents() { #region Button and Toolbar bool display = (Status == "Open" || Status == "") ? true : false; btnSave = new Button { ID = "btnSave", Icon = Icon.Disk, Text = "Lưu", ToolTip = "Save", Visible = display }; btnDeleteCard = new Button { ID = "btnDeleteCard", Icon = Icon.Delete, Text = "Xóa", ToolTip = "Delete", Visible = display }; topBar = new Toolbar { ID = "topBar", Items = { btnSave, btnDeleteCard }, Visible = display }; #endregion Button and Toolbar #region Batch and Key txtBatch = new Ext.Net.Hidden { Name = "Batch", LabelWidth = 150, Anchor = "100%", FieldLabel = "Batch", ID = "txtBatch" }; txtKey = new Ext.Net.Hidden { DataIndex = "UID", Name = "UID", LabelWidth = 150, Anchor = "100%", FieldLabel = "UID", ID = "txtKey" }; #endregion Batch and Key #region cboNo cboNo = new ComboBoxLookup { DataIndex = "No", Name = "No", LabelWidth = 150, Anchor = "100%", FieldLabel = "No.", ID = "cboNo", SelectOnFocus = true, AllowBlank = false, MsgTarget = MessageTarget.Side, ProxyUrl = "../../../Handler/ItemListHandler.ashx", DataTemplete = { new LookupFormatData { FieldName = "No", FieldTitle = "No.", ColWidth = 100 }, new LookupFormatData { FieldName = "Description", FieldTitle = "Description", ColWidth = 250 }, new LookupFormatData { FieldName = "Base_Unit_of_Measure", FieldTitle = "Base Unit of Measure", ColWidth = 150 }, new LookupFormatData { FieldName = "Unit_Cost", FieldTitle = "Unit Cost", ColWidth = 120 } }, idProperty = "No", DisplayField = "No", ValueField = "No", PageSize = 100, CurCompany = GlobalVariable.CompanyName, SCOPE = "GLX.Lookup.ItemNo" }; #endregion cboNo #region cboType cboType = new ComboBox { DataIndex = "Type", Name = "Type", LabelWidth = 150, Anchor = "100%", FieldLabel = "Type", ID = "cboType", SelectOnFocus = true, AllowBlank = false, ReadOnly = true, Items = { new ListItem { Text = "G/L Account", Value = "G/L Account" }, new ListItem { Text = "Item", Value = "Item" }, } }; #endregion cboType #region cboAction_Message cboAction_Message = new ComboBox { DataIndex = "Action_Message", Name = "Action_Message", LabelWidth = 150, Anchor = "100%", FieldLabel = "Action Message", ID = "cboAction_Message", SelectOnFocus = true, ReadOnly = true, //Items = { // new ListItem {Text="", Value="" }, // new ListItem {Text="New", Value="New" }, // new ListItem {Text="Change Qty.", Value="Change Qty." }, // new ListItem {Text="Reschedule", Value="Reschedule" }, // new ListItem {Text="Resched. & Chg. Qty.", Value="Resched. & Chg. Qty." }, // new ListItem {Text="Cancel", Value="Cancel" }, //} Store = { new Store { Data = ActionMessage, AutoDataBind = true, Model = { new Model { Fields = { new ModelField { Name = "value" }, new ModelField { Name = "text" }, new ModelField { Name = "displaytext" } } } } } } }; #endregion cboAction_Message #region Accept Action Message and Description cboAccept_Action_Message = new Checkbox { DataIndex = "Accept_Action_Message", Name = "Accept_Action_Message", LabelWidth = 150, Anchor = "100%", FieldLabel = "Accept Action Message", ID = "cboAccept_Action_Message", ReadOnly = true }; txtDescription = new TextField { DataIndex = "Description", Name = "Description", LabelWidth = 150, Anchor = "100%", FieldLabel = "Description", ID = "txtDescription", ReadOnly = true }; txtRemark = new TextField { DataIndex = "Remark", Name = "Remark", LabelWidth = 150, Anchor = "100%", FieldLabel = "Remark", ID = "txtRemark", ReadOnly = false }; #endregion Accept Action Message and Description #region cboLocation_Code cboLocation_Code = new ComboBoxLookup { DataIndex = "Location_Code", Name = "Location_Code", LabelWidth = 150, Anchor = "100%", FieldLabel = "Location Code", ID = "cboLocation_Code", SelectOnFocus = true, AllowBlank = true, MsgTarget = MessageTarget.Side, ProxyUrl = "../../../Handler/LocationListHandler.ashx", DataTemplete = { new LookupFormatData { FieldName = "Code", FieldTitle = "Code", ColWidth = 100 }, new LookupFormatData { FieldName = "Name", FieldTitle = "Name", ColWidth = 150 } }, idProperty = "Code", DisplayField = "Code", ValueField = "Code", PageSize = 100, CurCompany = GlobalVariable.CompanyName, SCOPE = "GLX.Lookup.Location" }; #endregion cboLocation_Code #region Original_Quantity and Quantity txtOriginal_Quantity = new NumberField { DataIndex = "Original_Quantity", Name = "Original_Quantity", LabelWidth = 150, Anchor = "100%", FieldLabel = "Original Quantity", ID = "txtOriginal_Quantity", MinValue = 0, MaxValue = 1000000, ReadOnly = true }; //1.000.000 txtQuantity = new TextField { DataIndex = "Quantity", Name = "Quantity", LabelWidth = 150, Anchor = "100%", FieldLabel = "Quantity", ID = "txtQuantity", MaskRe = @"/[0-9\.]/", }; #endregion Original_Quantity and Quantity #region cboUnit_of_Measure_Code cboUnit_of_Measure_Code = new ComboBoxLookup { DataIndex = "Unit_of_Measure_Code", Name = "Unit_of_Measure_Code", LabelWidth = 150, Anchor = "100%", FieldLabel = "Unit of Measure Code", ID = "cboUnit_of_Measure_Code", SelectOnFocus = true, AllowBlank = false, MsgTarget = MessageTarget.Side, ProxyUrl = "../../../Handler/UOMHandler.ashx", DataTemplete = { new LookupFormatData { FieldName = "Code", FieldTitle = "Code", ColWidth = 100 }, new LookupFormatData { FieldName = "Description", FieldTitle = "Description", ColWidth = 150 }, new LookupFormatData { FieldName = "Qty_per_Unit_of_Measure", FieldTitle = "Qty per Unit of Measure", ColWidth = 150 } }, idProperty = "Code", DisplayField = "Code", ValueField = "Code", PageSize = 100, CurCompany = GlobalVariable.CompanyName, SCOPE = "GLX.Lookup.UOM" }; #endregion txtUnit_of_Measure_Code #region Direct_Unit_Cost and Due_Date txtDirect_Unit_Cost = new TextField { DataIndex = "Direct_Unit_Cost", Name = "txtDirect_Unit_Cost", LabelWidth = 150, Anchor = "100%", FieldLabel = "Direct Unit Cost", ID = "txtDirect_Unit_Cost", ReadOnly = true }; txtDue_Date = new DateField { DataIndex = "Due_Date", Name = "Due_Date", LabelWidth = 150, Anchor = "100%", FieldLabel = "Due Date", ID = "txtDue_Date", Format = "dd/MM/yyyy", SubmitFormat = "dd/MM/yyyy" }; #endregion Direct_Unit_Cost and Due_Date #region cboVendor_No cboVendor_No = new ComboBoxLookup { DataIndex = "Vendor_No", Name = "Vendor_No", LabelWidth = 150, Anchor = "100%", FieldLabel = "Vendor No.", ID = "cboVendor_No", ReadOnly = true, AllowBlank = true, MsgTarget = MessageTarget.Side, ProxyUrl = "../../../Handler/ItemVendorCatalogHandler.ashx", DataTemplete = { new LookupFormatData { FieldName = "Vendor_No", FieldTitle = "Vendor No", ColWidth = 100 }, new LookupFormatData { FieldName = "Vendor_Item_No", FieldTitle = "Vendor Item No.", ColWidth = 100 }, new LookupFormatData { FieldName = "Lead_Time_Calculation", FieldTitle = "Lead Time Calculation", ColWidth = 150 } }, idProperty = "Vendor_No", DisplayField = "Vendor_No", ValueField = "Vendor_No", PageSize = 100, CurCompany = GlobalVariable.CompanyName, SCOPE = "GLX.Lookup.ItemVendorCatalog" }; #endregion cboVendor_No #region cboUOMHandler //cboUOMHandler = new ComboBoxLookup { // DataIndex = "Unit_of_Measure_Code", // Name = "Unit_of_Measure_Code", // LabelWidth = 150, // Anchor = "100%", // FieldLabel = "UOM", // ID = "cboUOMHandler", // ReadOnly = false, // AllowBlank = false, // MsgTarget = MessageTarget.Side, // ProxyUrl = "../../../Handler/UOMHandler.ashx", // DataTemplete = { // new LookupFormatData{FieldName = "Code", FieldTitle = "Code", ColWidth = 100}, // new LookupFormatData{FieldName = "Description", FieldTitle = "Description", ColWidth = 100}, // new LookupFormatData{FieldName = "Qty_per_Unit_of_Measure", FieldTitle = "Qty per Unit of Measure", ColWidth = 200, Format="N0"}, // }, // idProperty = "Unit_of_Measure_Code", // DisplayField = "Unit_of_Measure_Code", // ValueField = "Unit_of_Measure_Code", // PageSize = 5, // CurCompany = GlobalVariable.CompanyName, // SCOPE = "GLX.Lookup.UOM" //}; //cboUOMHandler.Store.Primary.Parameters.AddRange(new Ext.Net.StoreParameter[] { // new Ext.Net.StoreParameter{Name = "type", Value = String.Format("2|3"), Mode = ParameterMode.Value}, //}); #endregion cboUOMHandler #region Vendor_Item_No txtVendor_Item_No = new TextField { DataIndex = "Vendor_Item_No", Name = "Vendor_Item_No", LabelWidth = 150, Anchor = "100%", FieldLabel = "Vendor Item No", ID = "txtVendor_Item_No", ReadOnly = true }; #endregion Vendor_Item_No #region cboReplenishment_System cboReplenishment_System = new ComboBox { DataIndex = "Replenishment_System", Name = "Replenishment_System", LabelWidth = 150, Anchor = "100%", FieldLabel = "Replenishment System", ID = "cboReplenishment_System", ReadOnly = true, Store = { new Store { Data = ReplenishmentSystem, AutoDataBind = true, Model = { new Model { Fields = { new ModelField { Name = "value" }, new ModelField { Name = "text" }, new ModelField { Name = "displaytext" } } } } } } //Items = { // new ListItem { Text="Purchase", Value="Purchase"}, // new ListItem { Text="Prod. Order", Value="Prod. Order"}, // new ListItem { Text="Transfer", Value="Transfer"}, // new ListItem { Text="Assembly", Value="Assembly"} //} }; #endregion cboReplenishment_System #region cboNo cboNo = new ComboBoxLookup { DataIndex = "No", Name = "No", LabelWidth = 150, Anchor = "100%", FieldLabel = "No.", ID = "cboNo", SelectOnFocus = true, AllowBlank = false, MsgTarget = MessageTarget.Side, ProxyUrl = "../../../Handler/ItemListHandler.ashx", DataTemplete = { new LookupFormatData { FieldName = "No", FieldTitle = "No.", ColWidth = 100 }, new LookupFormatData { FieldName = "Description", FieldTitle = "Description", ColWidth = 250 }, new LookupFormatData { FieldName = "Base_Unit_of_Measure", FieldTitle = "Base Unit of Measure", ColWidth = 150 }, new LookupFormatData { FieldName = "Unit_Cost", FieldTitle = "Unit Cost", ColWidth = 120 } }, idProperty = "No", DisplayField = "No", ValueField = "No", PageSize = 100, CurCompany = GlobalVariable.CompanyName, SCOPE = "GLX.Lookup.ItemNo" }; #endregion cboNo TextAreaChangeLogComment = new TextArea { Flex = 1, ID = "TextAreaChangeLogComment", ReadOnly = true }; hiddenConverted = new Ext.Net.Hidden { DataIndex = "Converted", Name = "Converted", ID = "hiddenConverted" }; hiddenStatus = new Ext.Net.Hidden { DataIndex = "Status", Name = "Status", ID = "hiddenStatus" }; #region frmHeader frmHeader = new FormPanel { Header = false, Region = Region.North, Icon = Ext.Net.Icon.ApplicationForm, Border = true, ID = "frmHeader", TrackResetOnLoad = true, Layout = "Hbox", Items = { new Panel { Layout = "Anchor", Flex = 1, BodyPaddingSummary = "10 10 10 10", Border = false, //Items = { txtKey, txtBatch, cboType, cboNo, cboAction_Message, cboAccept_Action_Message, txtDescription, cboLocation_Code } //txtOriginal_Quantity Items ={ txtKey, txtBatch, hiddenConverted, hiddenStatus, cboNo, txtDescription, txtRemark, cboUnit_of_Measure_Code, txtDirect_Unit_Cost, cboLocation_Code, txtQuantity, txtDue_Date }//txtOriginal_Quantity, cboType, cboAction_Message, cboAccept_Action_Message, }, } }; frmComment = new FormPanel { ID = "frmComment", Title = "Comment", Icon = Icon.Comments, Border = false, Region = Region.South, Layout = "Fit", Height = 150, Items = { TextAreaChangeLogComment } }; #endregion frmHeader #region Windows this.ID = "winCard"; this.Maximizable = false; this.Minimizable = false; this.CloseAction = CloseAction.Destroy; this.Icon = Icon.ApplicationEdit; this.TopBar.Add(topBar); this.Layout = "Border"; this.Items.AddRange( new ItemsCollection <Ext.Net.AbstractComponent> { this.frmHeader, frmComment } ); #endregion Windows }
private void InitComponent() { #region Button btnAddUser = new Button { ID = "btnAddUser", Text = "Add User", Icon = Icon.UserAdd }; btnDelete = new Button { ID = "btnDelete", Text = "Delete User", Icon = Icon.UserDelete }; #endregion Button #region Card txtUserName = new TextField { ID = "txtUserName", EmptyText = "Enter username", Flex = 1, LabelWidth = 80, FieldLabel = "Username", AllowBlank = false }; txtFullName = new TextField { ID = "txtFullName", EmptyText = "Enter full name", Flex = 1, LabelWidth = 80, FieldLabel = "Full name", AllowBlank = false }; cbgCinema = new CheckboxGroup { ID = "cbgCinema", FieldLabel = "Cinema", ColumnsNumber = 3, Cls = "x-check-group-alt" }; cboLocation = new ComboBox { ID = "cboLocation", FieldLabel = "Location", EmptyText = "Enter Location", Flex = 1, LabelWidth = 80, AllowBlank = false }; cboBatch = new ComboBox { ID = "cboBatch", EmptyText = "Enter Batch", Flex = 1, LabelWidth = 80, FieldLabel = "Batch", AllowBlank = false }; rdgRole = new RadioGroup { ID = "rdgRole", FieldLabel = "Role", ColumnsNumber = 1, Items = { new Radio { ID = "rdoAdmin", BoxLabel = "Admin", Value = "Admin", InputValue = "Admin" }, new Radio { ID = "rdoFnb", BoxLabel = "F&B", Value = "FnB", InputValue = "FnB" }, new Radio { ID = "rdoAccSite", BoxLabel = "Accounting Site", Value = "AccSite", InputValue = "AccSite", Checked = true }, new Radio { ID = "rdoCM", BoxLabel = "Cinema Manager", Value = "CM", InputValue = "CM" } } }; cboCompanyCard = new ComboBox { ID = "cboCompanyCard", EmptyText = "Enter company", Flex = 1, LabelWidth = 80, FieldLabel = "Company", AllowBlank = false }; #endregion #region Account strUsername = new Store { ID = "strUsername", Model = { new Model { Fields = { new ModelField { Name = "Account" }, new ModelField { Name = "Fullname" }, } } } }; cboUsername = new Ext.Net.ComboBox { DataIndex = "Account", Name = "Account", LabelWidth = 80, Anchor = "100%", FieldLabel = "Account", ID = "cboUsername", SelectOnFocus = true, AllowBlank = false, MsgTarget = MessageTarget.Side, DisplayField = "Account", ValueField = "Account", PageSize = 100, }; cboUsername.Store.Add(strUsername); cboUsername.ListConfig = new BoundList { Width = 320, Height = 300, ItemSelector = ".x-boundlist-item", Tpl = new XTemplate { Html = string.Format(@" <Html> <tpl for="".""> <tpl if=""[xindex] == 1""> <table class=""cbStates-list""> <tr> <th style =""font-weight: bold;padding: 3px;background: #3892d3"">{0}</th> <th style =""font-weight: bold;padding: 3px;background: #3892d3"">{1}</th> </tr> </tpl> <tr class=""x-boundlist-item""> <td style=""padding:3px;"">{{{0}}}</td> <td style=""padding:3px;"">{{{1}}}</td> </tr> <tpl if=""[xcount-xindex]==0""> </table> </tpl> </tpl> </Html>" , "Account", "Fullname") } }; cboUsername.Triggers.Add(new FieldTrigger { Icon = TriggerIcon.Clear, HideTrigger = true }); #endregion Account #region Permission strPermission = new Store { ID = "strPermission", Model = { new Model { Fields = { new ModelField { Name = "UID" }, new ModelField { Name = "Company" }, new ModelField { Name = "Username" }, new ModelField { Name = "Page" }, new ModelField { Name = "Action" }, new ModelField { Name = "Allow" } } } } }; grdPermission = new GridPanel { ID = "grdPermission", BodyCls = "line-body-border", CtCls = "line-border", Title = "Permissions List", Height = 250, ColumnModel = { Columns = { new Column { DataIndex = "UID", Text = "UID", Width = 0 }, new Column { DataIndex = "Company", Text = "Company", MinWidth = 100, Flex = 1 }, new Column { DataIndex = "Username", Text = "Username", Width = 100 }, new Column { DataIndex = "Page", Text = "Page", Width = 120 }, new Column { DataIndex = "Action", Text = "Action", MinWidth = 150, Flex = 1 }, new Column { DataIndex = "Allow", Text = "Allow", Width = 100 }, } }, BottomBar = { new PagingToolbar { HideRefresh = true } }, SelectionModel = { new RowSelectionModel { Mode = SelectionMode.Single } } }; grdPermission.Store.Add(strPermission); #endregion Permission #region GLXAccount strGLXAccount = new Store { ID = "strGLXAccount", Model = { new Model { Fields = { new ModelField { Name = "UID" }, new ModelField { Name = "Account" }, new ModelField { Name = "Company" } } } } }; grdGLXAccount = new GridPanel { ID = "grdGLXAccount", BodyCls = "line-body-border", CtCls = "line-border", Title = "Company List", Height = 250, ColumnModel = { Columns = { new Column { DataIndex = "UID", Text = "UID", Width = 0 }, new Column { DataIndex = "Company", Text = "Company", Width = 100, Flex = 1 }, } }, BottomBar = { new PagingToolbar { HideRefresh = true } }, SelectionModel = { new RowSelectionModel { Mode = SelectionMode.Single } } }; grdGLXAccount.Store.Add(strGLXAccount); #endregion GLXAccount #region LocationAndAccount strLocationAndAccount = new Store { ID = "strLocationAndAccount", Model = { new Model { Fields = { new ModelField { Name = "UID" }, new ModelField { Name = "Account" }, new ModelField { Name = "Location" } } } } }; grdLocationAndAccount = new GridPanel { ID = "grdLocationAndAccount", BodyCls = "line-body-border", CtCls = "line-border", Title = "Location List", Height = 220, ColumnModel = { Columns = { new Column { DataIndex = "UID", Text = "UID", Width = 0 }, new Column { DataIndex = "Location", Text = "Location", Width = 100, Flex = 1 }, } }, BottomBar = { new PagingToolbar { HideRefresh = true } }, SelectionModel = { new RowSelectionModel { Mode = SelectionMode.Single } } }; grdLocationAndAccount.Store.Add(strLocationAndAccount); #endregion #region Worksheet strWorksheet = new Store { ID = "strWorksheet", Model = { new Model { Fields = { new ModelField { Name = "UID" }, new ModelField { Name = "Worksheet Template Name" }, new ModelField { Name = "Name" }, new ModelField { Name = "Description" }, new ModelField { Name = "Template Type" }, new ModelField { Name = "Recurring" }, new ModelField { Name = "Company" }, new ModelField { Name = "Account" }, } } } }; grdWorksheet = new GridPanel { ID = "grdWorksheet", BodyCls = "line-body-border", CtCls = "line-border", Title = "Worksheet List", Height = 220, ColumnModel = { Columns = { new Column { DataIndex = "UID", Text = "UID", Width = 0 }, new Column { DataIndex = "Company", Text = "Company", Width = 150 }, new Column { DataIndex = "Name", Text = "Name", Width = 100 }, new Column { DataIndex = "Description", Text = "Description", Width = 120, Flex = 1 }, new Column { DataIndex = "Account", Text = "Account", Width = 100 }, } }, BottomBar = { new PagingToolbar { HideRefresh = true } }, SelectionModel = { new RowSelectionModel { Mode = SelectionMode.Single } } }; grdWorksheet.Store.Add(strWorksheet); #endregion #region FormPanel frmHeader = new FormPanel { Collapsed = false, Collapsible = true, Region = Region.North, Layout = "HBox", Items = { new FormPanel { Layout = "Anchor", Flex = 1, BodyPaddingSummary = "10 10 10 10", Border = false, Items = { cboUsername } }, new FormPanel { Layout = "Anchor", Flex = 1, BodyPaddingSummary = "10 10 10 10", Border = false } }, TopBar = { new Toolbar { Items = { btnAddUser, btnDelete } } } }; frmGrid = new FormPanel { Layout = "HBoxLayout", Region = Region.Center, Header = true, BodyPaddingSummary = "5,5,5,5", Items = { new Panel { BodyPadding = 5, Layout = "VBoxLayout", Flex = 2, Region = Region.Center, LayoutConfig ={ new Ext.Net.VBoxLayoutConfig { Align = VBoxAlign.Stretch } }, Items = { grdPermission, grdWorksheet } }, new Panel { BodyPaddingSummary = "5,5,5,5", Layout = "Fit", Flex = 1, Region = Region.East, Items = { new Panel { Items ={ grdGLXAccount, grdLocationAndAccount } } } } } }; #endregion FormPanel this.ID = "pageMain"; this.Layout = "BorderLayout"; this.Items.AddRange(new ItemsCollection <Ext.Net.AbstractComponent> { frmGrid, frmHeader }); }
public override void RenderView(System.Web.Mvc.ViewContext viewContext, System.IO.TextWriter writer) { RenderMain(writer); var _formPanel = new ValidatedForm(); _formPanel.BodyPadding = 10; _formPanel.Layout = "table"; _formPanel.Url = Url.Action("AddAccount"); _formPanel.LayoutConfig.Add(new TableLayoutConfig() { Columns = 2 }); _formPanel.ID = "addForm"; _formPanel.DefaultAnchor = "100%"; var _txtUsername = new TextField(); _txtUsername.ID = "txtUsername"; _txtUsername.Name = "Username"; _txtUsername.ColSpan = 1; _txtUsername.Width = 300; _txtUsername.AllowBlank = false; _txtUsername.FieldLabel = "用户名"; _txtUsername.EmptyText = "输入用户名"; _formPanel.Add(_txtUsername); var _comboStatus = new ComboBox(); _comboStatus.EmptyText = "选择状态"; _comboStatus.Name = "Status"; var _comboStatusStore = new Store(); _comboStatusStore.ID = "comboStoreStatus"; _comboStatus.AllowBlank = false; _comboStatus.BlankText = "必须选择一个状态"; _comboStatusStore.Model.Add(ComponentHelper.GetModel( new Dictionary<string, ModelFieldType>(){ {"Id",ModelFieldType.Int},{"Name",ModelFieldType.String} })); _comboStatus.ValueHiddenName = "Status"; _comboStatus.SimpleSubmit = true; _comboStatus.DisplayField = "Name"; _comboStatus.ValueField = "Id"; _comboStatus.Store.Add(_comboStatusStore); _comboStatus.FieldLabel = "状态"; _comboStatus.Editable = false; _comboStatusStore.DataSource = EnumHelper.GetList(typeof(BaseStatuses), (k, v) => { return new { Id = k, Name = v }; }); _comboStatusStore.DataBind(); _formPanel.Add(_comboStatus); var _txtMemo = new TextArea(); _txtMemo.Width = 750; _txtMemo.Name = "Description"; _txtMemo.ColSpan = 2; _txtMemo.FieldLabel = "描述"; _txtMemo.Height = 80; _formPanel.Add(_txtMemo); var _treeRoleSelector = new TreePanelNodeMover(); _treeRoleSelector.LeftReadProxy.Url = Url.Action("GetNotAddedRoles"); _treeRoleSelector.RightReadProxy.Url = Url.Action("GetAddedRoles"); _treeRoleSelector.Height = 180; _treeRoleSelector.Width = 750; _treeRoleSelector.ColSpan = 2; _treeRoleSelector.ID = "treeRoles"; _formPanel.Add(_treeRoleSelector); _formPanel.Add(new Hidden() { Name = "RoleIds", ID = "hdnRoleIds" }); var _btnAdd = new Button(); _btnAdd.Text = "添加"; _btnAdd.Icon = Icon.Add; _btnAdd.Handler = _treeRoleSelector.SyncAddedNodes("hdnRoleIds") + "App." + _formPanel.ID + ".submitData(function(r){if(r.success){" + HideWindowReloadGrid("gridUsers") + "}})"; _formPanel.Buttons.Add(_btnAdd); writer.Write(_formPanel.ToBuilder().ToHtmlString()); }