public AbstractComponent CrearAtributo() { if (InterfaceAtributo != null) return (AbstractComponent)InterfaceAtributo; else { Hidden hidden = new Hidden(); return (AbstractComponent)hidden; } }
public void onUploadBorrower(FileUploadField fileUpload, Ext.Net.Image image, Hidden hidden, string name) { string msg = ""; // Check that a file is actually being submitted. if (fileUpload.PostedFile.FileName == "") { X.MessageBox.Alert("Alert", "No file specified.").Show(); btnSaveSignatures.Disabled = true; btnSaveSignatures.Disabled = true; } else //else if file exists { // Check the extension. string extension = Path.GetExtension(fileUpload.PostedFile.FileName); switch (extension.ToLower()) { case ".bmp": case ".gif": case ".jpg": case ".png": case ".tiff": case ".jpeg": case ".tif": break; default: X.MessageBox.Alert("Alert", "This file type is not allowed.").Show(); return; } // Using this code, the saved file will retain its original // file name when it's placed on the server. string serverFileName = Path.GetFileName(fileUpload.PostedFile.FileName); string fullUploadPath = Path.Combine(uploadDirectory, name + serverFileName); string file = ""; string fileName = ""; try { //check if file already exists if (File.Exists(fullUploadPath)) { file = Path.GetFileNameWithoutExtension(serverFileName); file += DateTime.Now.ToString("M-dd-yyyy hhmmss.ff") + Path.GetExtension(serverFileName); fileName = file; file = Path.Combine(uploadDirectory, name + file); } else { file = fullUploadPath; fileName = serverFileName; } //save file fileUpload.PostedFile.SaveAs(file); msg = "File uploaded successfully."; btnSaveSignatures.Disabled = false; } catch (Exception err) { msg = err.Message; } X.MessageBox.Alert("Status", msg).Show(); imageFilename = "../../../Uploaded/Agreement/" + hdnLoanApplicationId.Value.ToString() + "/" + FormType.PromissoryNoteType.Name + "/" + name + fileUpload.PostedFile.FileName; image.ImageUrl = imageFilename; hidden.Value = imageFilename; } }
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%"; _txtRolename = new TextField(); _txtRolename.ID = "txtname"; _txtRolename.Name = "Name"; _txtRolename.ColSpan = 1; _txtRolename.Width = 300; _txtRolename.AllowBlank = false; _txtRolename.FieldLabel = "角色名"; _txtRolename.EmptyText = "输入角色名"; _formPanel.Add(_txtRolename); _comboStatus = new ComboBox(); _comboStatus.EmptyText = "选择状态"; _comboStatus.ValueHiddenName = "Status"; _comboStatus.SimpleSubmit = true; _comboStatusStore = new Store(); _comboStatusStore.ID = "comboStoreStatus"; _comboStatusStore.Model.Add(ComponentHelper.GetModel( new Dictionary<string, ModelFieldType>(){ {"Id",ModelFieldType.Int},{"Name",ModelFieldType.String} })); _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.EmptyText = "简单描述一下角色的功能"; _txtMemo.FieldLabel = "描述"; _txtMemo.Height = 70; _formPanel.Add(_txtMemo); _treePrivilegeSelector = new TreePanelNodeMover(); _treePrivilegeSelector.LeftReadData += _treePrivilegeSelector_LeftReadData; _treePrivilegeSelector.RightReadData += _treePrivilegeSelector_RightReadData; _treePrivilegeSelector.Height = 180; _treePrivilegeSelector.Width = 750; _treePrivilegeSelector.ColSpan = 2; _treePrivilegeSelector.ID = "treeRoles"; _formPanel.Add(_treePrivilegeSelector); _btnSave = new Button(); _btnSave.Icon = Icon.DatabaseSave; _btnSave.Text = "保存"; _btnSave.DirectEvents.Click.Event += SaveRole; _btnSave.DirectEvents.Click.EventMask.Set("正在添加"); _formPanel.Buttons.Add(_btnSave); _hidId = new Hidden(); _hidId.Name = "Id"; _formPanel.Controls.Add(_hidId); MainForm.Controls.Add(_formPanel); }
protected override void OnInit(EventArgs e) { _hiddenAddedEditors = new Hidden { ID = ID + "_hiddenAddedEditors", Text = @"0" }; Controls.Add(_hiddenAddedEditors); base.OnInit(e); }
/// <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 }
/// <summary> /// metodo que carrega as pesquisas existentes /// </summary> private void CarregarPesquisas() { foreach (PesquisaOpiniaoVO p in Pesquisas) { FieldSet fds = new FieldSet() { AutoWidth = true, AutoHeight = true, Title = p.Pergunta, TitleCollapse = true, Collapsible = true, Collapsed = false, AnimCollapse = true }; Hidden hdf = new Hidden() { ID = "hdf_" + p.Id, Value = p.Id.ToString() }; Ext.Net.RadioGroup group = new RadioGroup() { AutoWidth=true, ColumnsNumber = 1, GroupName = "group_" + p.Id, ID="group_"+p.Id, InvalidText="Selecione uma resposta.", AllowBlank = !(p.Status == StatusPesquisa.Iniciada), MsgTarget = MessageTarget.Side }; foreach (RespostaVO r in p.Respostas) { Radio radio = new Radio() { BoxLabel = r.Descricao, HideLabel = true, AutoWidth = true, MinWidth = 150, ID = "radio_"+r.Id, Checked = r.Usuarios.Any(x=> x.Id == UsuarioLogado.Id) }; group.Items.Add(radio); } fds.Items.Add(hdf); fds.Items.Add(group); if (p.Status == StatusPesquisa.Finalizada && p.MostrarResultado) { Ext.Net.Button btnGrafico = new Ext.Net.Button("Resultado"); //btnGrafico.DirectEvents.Click.EventMask = new EventMask() { Msg = "Abrindo gráfico...", ShowMask = true, Target = MaskTarget.Page }; btnGrafico.ID = "btnGrafico" + p.Id; btnGrafico.Listeners.Click.Handler = "Ext.net.DirectMethods.VisualizarGrafico('" + p.Id + "');"; btnGrafico.Icon = Ext.Net.Icon.ChartBar; btnGrafico.Disabled = !hdfVisualizarGraficoResponderPesquisas.Value.ToInt32().ToBoolean(); Toolbar toolbar = new Toolbar(); toolbar.Add(btnGrafico); fds.TopBar.Add(toolbar); } group.Disabled = !(p.Status == StatusPesquisa.Iniciada); fds.AddTo(frmPesquisas); } }