protected void ControlComboEditor_ItemNotInList(object sender, ValidationErrorEventArgs e) { try { UltraComboEditor control = (UltraComboEditor)sender; if (string.IsNullOrEmpty(control.Text.Trim())) { return; } // Tiếp tục Focus vào control có giá trị nhập sai e.RetainFocus = true; // Thông báo lỗi dữ liệu nhập MessageBoxCommon.ShowExclamation(string.Format(Properties.Resources.Message_Error_Input_Dropdown, control.Tag)); if (e.LastValidValue != null) { control.Value = e.LastValidValue; } else { control.SelectedIndex = 0; } control.SelectAll(); control.DropDown(); } catch (Exception ex) { #if Debug MessageBoxCommon.ShowException(ex); #endif } }
public static void LoadCombo <T>(UltraComboEditor combo, IEnumerable <T> collection, string valueMember, string displayMember, string defaultValue, bool multiple) { T blankEntity = (T)Activator.CreateInstance(typeof(T)); IList <T> list = collection.ToList(); if (defaultValue != null) { blankEntity.GetType().GetProperty(valueMember).SetValue(blankEntity, -1, null); blankEntity.GetType().GetProperty(displayMember).SetValue(blankEntity, defaultValue, null); list.Insert(0, blankEntity); } combo.DataSource = null; combo.DataSource = list; combo.ValueMember = valueMember; combo.DisplayMember = displayMember; if (defaultValue != null) { if (multiple) { combo.Value = new object[] { -1 }; } else { combo.Value = -1; } } }
public static void BindJob_Query_Filter(UltraComboEditor cmbShow, bool bBeginDate, string strBeginDate, bool bEndDate, string strEndDate) { // string strSql = "select * from tbJob where cndEndDate>=getdate() order by cndBeginDate"; string strSql = "select * from tbJob where 1=1 "; if (bBeginDate) { strSql += " and Convert(char(10),cndBeginDate,121)>='" + strBeginDate + "' "; } if (bEndDate) { strSql += " and Convert(char(10),cndEndDate,121)<='" + strEndDate + "' "; } strSql += " order by cndBeginDate "; // strSql = "select * from tbJob " // +" where Convert(char(10),cndBeginDate,121)>='"+strBeginDate+"' " // +"and Convert(char(10),cndEndDate,121)<='"+strEndDate+"' " // +"order by cndBeginDate"; //JobManage jobManage = new JobManage(); DataTable dtJob = Query(strSql); //jobManage.GetAllJob(); cmbShow.DataSource = dtJob; cmbShow.ValueMember = "cnnID"; cmbShow.DisplayMember = "cnvcJobName"; cmbShow.DataBind(); }
public static void BindNameCodeType(UltraComboEditor cmbType) { ArrayList alMemberCode = new ArrayList(); alMemberCode.Add(ConstApp.MemberType); alMemberCode.Add(ConstApp.EnterpriseType); alMemberCode.Add(ConstApp.BookDate); alMemberCode.Add(ConstApp.Trade); alMemberCode.Add(ConstApp.Product); //alMemberCode.Add(ConstApp.ValueAddedServices); alMemberCode.Add(ConstApp.tishi); alMemberCode.Add(ConstApp.TouchFlash); alMemberCode.Add(ConstApp.TouchBookBeginDate); alMemberCode.Add(ConstApp.TouchBookEndDate); alMemberCode.Add(ConstApp.TouchSignInBeginDate); alMemberCode.Add(ConstApp.TouchSignInEndDate); alMemberCode.Add(ConstApp.JobListBeginDate); alMemberCode.Add(ConstApp.JobListEndDate); alMemberCode.Add(ConstApp.JobBookingListBeginDate); alMemberCode.Add(ConstApp.JobBookingListEndDate); alMemberCode.Add(ConstApp.JobRemainListBeginDate); alMemberCode.Add(ConstApp.JobRemainListEndDate); alMemberCode.Add(ConstApp.NetBookBeforeDate); //alMemberCode.Add(ConstApp.CardType); cmbType.SetDataBinding(alMemberCode, null); }
public static void BindSynch(UltraComboEditor cmbSynch) { cmbSynch.Items.Add("0", "会员系统"); cmbSynch.Items.Add("1", "网站操作"); cmbSynch.Items.Add("2", "触摸屏操作"); cmbSynch.Items.Add("3", "客服预定"); }
public static void BindMember(UltraComboEditor cmbMember) { ArrayList alMember = new ArrayList(); alMember.Add("会员"); alMember.Add("非会员"); cmbMember.SetDataBinding(alMember, null); }
public static void AddDirection(UltraComboEditor cmbDirection) { cmbDirection.Items.Add("上", "上"); cmbDirection.Items.Add("下", "下"); cmbDirection.Items.Add("左", "左"); cmbDirection.Items.Add("右", "右"); cmbDirection.Items.Add("闭合", "闭合"); }
public static void BindInfoWay(UltraComboEditor cmbInfoWay) { cmbInfoWay.Items.Add("自带", "自带"); cmbInfoWay.Items.Add("上一次", "上一次"); cmbInfoWay.Items.Add("待传", "待传"); cmbInfoWay.Items.Add("传真", "传真"); cmbInfoWay.Items.Add("申请表", "申请表"); }
public static void ReadOnly_Control(Control ctr) { try { foreach (Control txt in ctr.Controls) { ReadOnly_Control(txt); switch (txt.GetType().Name) { case "UltraTextEditor": { UltraTextEditor Ultratxt = txt as UltraTextEditor; Ultratxt.ReadOnly = true; break; } case "TextBox": { TextBox textboxtxt = txt as TextBox; textboxtxt.ReadOnly = true; break; } case "UltraCombo": { UltraCombo textboxtxt = txt as UltraCombo; textboxtxt.ReadOnly = true; break; } case "UltraComboEditor": { UltraComboEditor textboxtxt = txt as UltraComboEditor; textboxtxt.ReadOnly = true; break; } case "UltraDateTimeEditor": { UltraDateTimeEditor textboxtxt = txt as UltraDateTimeEditor; textboxtxt.ReadOnly = true; break; } case "UltraNumericEditor": { UltraNumericEditor textboxtxt = txt as UltraNumericEditor; textboxtxt.ReadOnly = true; break; } } } } catch (Exception) { } }
/// <summary> /// 绑定会员参数类型 /// </summary> /// <param name="cmbMemberCode"></param> public static void BindMemberCode(UltraComboEditor cmbMemberCode, string strMember) { ArrayList alMemberCode = new ArrayList(); if (strMember == ConstApp.MemberType) { alMemberCode.Add(ConstApp.FreeType); alMemberCode.Add(ConstApp.BookDate); alMemberCode.Add(ConstApp.DisabledDate); alMemberCode.Add(ConstApp.DisabledDateMinAmount); alMemberCode.Add(ConstApp.MemberDiscount); alMemberCode.Add(ConstApp.MemberSeats); alMemberCode.Add(ConstApp.MemberFee); alMemberCode.Add(ConstApp.BookTimes); alMemberCode.Add(ConstApp.PointsBK); alMemberCode.Add(ConstApp.PointsCZ); alMemberCode.Add(ConstApp.PointsXF); alMemberCode.Add(ConstApp.PointsJF); alMemberCode.Add(ConstApp.IsJob); alMemberCode.Add(ConstApp.IsMemberFee); alMemberCode.Add(ConstApp.IsInMoney); alMemberCode.Add(ConstApp.IsProduct); alMemberCode.Add(ConstApp.IsProductSelect); alMemberCode.Add(ConstApp.IsFeeType); alMemberCode.Add(ConstApp.IsDisabledDate); DataTable dtProduct = Query("select * from tbNameCode where cnvcType = '" + ConstApp.Product + "' order by cnvcValue"); foreach (DataRow drProduct in dtProduct.Rows) { NameCode namceCode = new NameCode(drProduct); if (!alMemberCode.Contains(namceCode.cnvcValue)) { alMemberCode.Add(namceCode.cnvcValue); } } //DataTable dtProduct = Query("select * from tbNameCode where cnvcType = '" + ConstApp.ValueAddedServices + "' order by cnvcValue"); //foreach (DataRow drProduct in dtProduct.Rows) //{ // NameCode namceCode = new NameCode(drProduct); // if (!alMemberCode.Contains(namceCode.cnvcValue)) // { // alMemberCode.Add(namceCode.cnvcValue); // } //} } if (strMember == ConstApp.Product) { alMemberCode.Add(ConstApp.ProductPrice); alMemberCode.Add(ConstApp.ProductDiscount); alMemberCode.Add(ConstApp.ProductPoints); } cmbMemberCode.SetDataBinding(alMemberCode, null); }
public frmKontoZamjena(string idKonto) { InitializeComponent(); UltraComboEditor test = new UltraComboEditor(); test.Location = new Point(4, 4); lblMessage.Text = string.Format("Konto {0} se više ne koristi odaberite konto koji će ga zamjeniti!", idKonto); FillKonto(); }
protected void ComboboxValueChangedCmmt(object sender, System.EventArgs e) { Logger.logBegin("ComboboxValueChangedCmmt"); UltraComboEditor objCombobox = sender as UltraComboEditor; #if _tigerDebug base.RecordFunction("test", Mercury.QTP.CustomServer.RecordingMode.RECORD_KEEP_LINE, "Genearted by tiger"); #endif base.RecordFunction(MarsTigerServerConst.CNST_EVNT_SELECT, Mercury.QTP.CustomServer.RecordingMode.RECORD_SEND_LINE, objCombobox.Value); Logger.logEnd("ComboboxValueChangedCmmt"); }
public static void BindShow(UltraComboEditor cmbFloor, string strJobID) { cmbFloor.Text = ""; cmbFloor.Items.Clear(); DataTable dtShow = Helper.Query("select * from tbShow where cnnJobID=" + strJobID); cmbFloor.DataSource = dtShow; cmbFloor.DisplayMember = "cnvcShowName"; cmbFloor.ValueMember = "cnnShowID"; cmbFloor.DataBind(); }
public static void BindSales(UltraComboEditor cmbSales) { string strsql = "select cnvcSales from tbSales "; DataTable dt = SqlHelper.ExecuteDataTable(CommandType.Text, strsql); ArrayList al = new ArrayList(); foreach (DataRow dr in dt.Rows) { al.Add(dr[0]); } cmbSales.SetDataBinding(al, null); }
public static void BindJob_Query(UltraComboEditor cmbShow) { // string strSql = "select * from tbJob where cndEndDate>=getdate() order by cndBeginDate"; string strSql = "select * from tbJob order by cndBeginDate"; //JobManage jobManage = new JobManage(); DataTable dtJob = Query(strSql); //jobManage.GetAllJob(); cmbShow.DataSource = dtJob; cmbShow.ValueMember = "cnnID"; cmbShow.DisplayMember = "cnvcJobName"; cmbShow.DataBind(); }
public static void BindDept(UltraComboEditor cmbSales, string strOperId) { string strsql = string.Format(@"select b.* from tbOperDept a join tbDept b on a.cnnDeptID=b.cnnDeptID where a.cnnOperID={0} ", strOperId); DataTable dt = SqlHelper.ExecuteDataTable(CommandType.Text, strsql); cmbSales.DataSource = dt; cmbSales.DisplayMember = "cnvcDeptName"; cmbSales.ValueMember = "cnnDeptId"; cmbSales.DataBind(); }
public static void BindSales(UltraComboEditor cmbSales, string strOperId) { string strsql = string.Format(@"select a.cnvcSales from tbSales a join tbOperDept b on a.cnnDeptID=b.cnnDeptID where b.cnnOperID={0}", strOperId); DataTable dt = SqlHelper.ExecuteDataTable(CommandType.Text, strsql); ArrayList al = new ArrayList(); foreach (DataRow dr in dt.Rows) { al.Add(dr[0]); } cmbSales.SetDataBinding(al, null); }
public static void ReserAll(Control ctr) { try { foreach (Control txt in ctr.Controls) { ReserAll(txt); switch (txt.GetType().Name) { case "UltraTextEditor": { UltraTextEditor Ultratxt = txt as UltraTextEditor; Ultratxt.Text = string.Empty; break; } case "TextBox": { TextBox textboxtxt = txt as TextBox; textboxtxt.Text = string.Empty; break; } case "UltraCombo": { UltraCombo textboxtxt = txt as UltraCombo; textboxtxt.Text = string.Empty; break; } case "UltraComboEditor": { UltraComboEditor textboxtxt = txt as UltraComboEditor; textboxtxt.Text = string.Empty; break; } case "UltraNumericEditor": { UltraNumericEditor textboxtxt = txt as UltraNumericEditor; textboxtxt.Value = 0; break; } } } } catch (Exception) { } }
public Form_genericAddRemove(Connector conn, string titulo, string sqlStringAdd, string sqlStringRemove, UltraComboEditor comboBox, UltraComboEditor idParticipants, Form_main formMain, Form_modifyEvent formModify, bool b) { InitializeComponent(); this.Text = titulo; this.conn = conn; this.sqlStringAdd = sqlStringAdd; this.sqlStringRemove = sqlStringRemove; this.comboBox = comboBox; this.idParticipants = idParticipants; this.formMain = formMain; this.formModify = formModify; this.b = b; formMain.Enabled = false; }
public void PopulateSettingsTypeDropDown ( UltraComboEditor cmbcontrol, string tablename, string whereField , string whereValue, string displayMember, string valueMember) { cmbcontrol.DataSource = GetDataTable("select * from " + tablename + " WHERE " + whereField + " = '" + whereValue + "'"); cmbcontrol.DisplayMember = displayMember; cmbcontrol.ValueMember = valueMember; cmbcontrol.DataBind(); }
public static void LoadCombo(UltraComboEditor combo, DataTable data, string valueMember, string displayMember) { DataRow row = data.NewRow(); row[valueMember] = -1; row[displayMember] = "Seleccione"; data.Rows.InsertAt(row, 0); combo.DataSource = null; combo.DataSource = data; combo.ValueMember = valueMember; combo.DisplayMember = displayMember; combo.Value = -1; }
public static void BindNameCodeProductType(UltraComboEditor cmbType) { ArrayList alMemberCode = new ArrayList(); //alMemberCode.Add(ConstApp.MemberType); //alMemberCode.Add(ConstApp.EnterpriseType); //alMemberCode.Add(ConstApp.BookDate); //alMemberCode.Add(ConstApp.Trade); alMemberCode.Add(ConstApp.Product); //alMemberCode.Add(ConstApp.tishi); //alMemberCode.Add(ConstApp.TouchFlash); //alMemberCode.Add(ConstApp.TouchBookBeginDate); //alMemberCode.Add(ConstApp.TouchBookEndDate); //alMemberCode.Add(ConstApp.TouchSignInBeginDate); //alMemberCode.Add(ConstApp.TouchSignInEndDate); cmbType.SetDataBinding(alMemberCode, null); }
public static void BindOper(UltraComboEditor cmbOper, Oper oper, Dept dept) { string strsql = string.Format(@"select a.* from tbOper a left join tbDept b on a.cnnDeptID=b.cnnDeptID where (b.cnnParentDeptID={0} or b.cnnDeptID={0}) and cnvcOperName <> 'admin'", oper.cnnDeptID.ToString()); DataTable dtOper = SqlHelper.ExecuteDataTable(CommandType.Text, strsql); cmbOper.DataSource = dtOper; cmbOper.DisplayMember = "cnvcOperName"; cmbOper.ValueMember = "cnnOperID"; cmbOper.DataBind(); if (oper.cnnDeptID != 0 && oper.cnvcOperName != dept.cnvcManager) { cmbOper.FindString(oper.cnvcOperName); cmbOper.Enabled = false; } }
public static void LoadUltraComboEditorList(UltraComboEditor prmDropDownList, string prmDataTextField = null, string prmDataValueField = null, List <KeyValueDTO> prmDataSource = null, DropDownListAction?prmDropDownListAction = null) { prmDropDownList.DataSource = null; prmDropDownList.Items.Clear(); KeyValueDTO firstItem = null; var priorFirstItem = prmDataSource.FirstOrDefault(p => p.Id == "-1"); if (prmDropDownListAction != null) { switch (prmDropDownListAction) { case DropDownListAction.All: firstItem = new KeyValueDTO() { Id = Constants.AllValue, Value1 = Constants.All }; break; case DropDownListAction.Select: firstItem = new KeyValueDTO() { Id = Constants.SelectValue, Value1 = Constants.Select }; break; } } if (priorFirstItem == null && firstItem != null) { prmDataSource.Insert(0, firstItem); } if (prmDataSource != null) { if (prmDataSource.Count != 0) { prmDropDownList.DisplayMember = prmDataTextField; prmDropDownList.ValueMember = prmDataValueField; prmDropDownList.DataSource = prmDataSource; } } }
/*************************************************************************************************************************************************************/ public void fillComboBox(UltraComboEditor u, string sqlString, string campo) { u.Items.Clear(); try { conn.getConnection(); DR = SqlManager.getQuery(sqlString, conn); if (DR != null) { while (DR.Read()) { u.Items.Add(DR[campo]); } } DR.Close(); } catch (DbException ex) { MessageBox.Show("No se pudo Obtener las Ramas:\n " + ex); } }
public static void ObtenerUmParaCombo(UltraComboEditor cbo) { try { using (var cnx = ConnectionHelper.GetConnection) { if (cnx.State != ConnectionState.Open) { cnx.Open(); } cbo.DropDownStyle = DropDownStyle.DropDownList; const string query = "select i_ItemId as 'IdUnidadMedida', v_Value1 as 'Nombre' from datahierarchy where i_GroupId = 17 and i_IsDeleted = 0"; cbo.DataSource = cnx.Query <UnidadMedidaDto>(query).ToList(); cbo.DisplayMember = "Nombre"; cbo.ValueMember = "IdUnidadMedida"; cbo.SelectedIndex = 0; } } catch (Exception e) { throw e; } }
public static void ObtenerLineasParaCombo(UltraComboEditor cbo) { try { using (var cnx = ConnectionHelper.GetConnection) { if (cnx.State != ConnectionState.Open) { cnx.Open(); } cbo.DropDownStyle = DropDownStyle.DropDownList; const string query = "select v_IdLinea as 'IdLinea', v_nombre as 'Nombre' from linea where i_Eliminado = 0"; cbo.DataSource = cnx.Query <LineaDto>(query).ToList(); cbo.DisplayMember = "Nombre"; cbo.ValueMember = "IdLinea"; cbo.SelectedIndex = 0; } } catch (Exception e) { throw e; } }
public static void BindJob(UltraComboEditor cmbShow) { string strSql = "select * from tbJob where cndEndDate>=getdate() order by cndBeginDate"; // string strSql = "select * from tbJob order by cndBeginDate"; //if (ca.strJobBeginDate != "") //{ // strSql = "select * from tbJob where convert(varchar(10),cndBeginDate,121)>='" + ca.strJobBeginDate + "'"; // if (ca.strJobEndDate != "") // strSql += " and convert(varchar(10),cndEndDate,121)<='" + ca.strJobEndDate + "'"; //} //else //{ // if (ca.strJobEndDate != "") // strSql = "select * from tbJob where convert(varchar(10),cndEndDate,121)<='" + ca.strJobEndDate + "'"; //} //JobManage jobManage = new JobManage(); DataTable dtJob = Query(strSql);//jobManage.GetAllJob(); cmbShow.DataSource = dtJob; cmbShow.ValueMember = "cnnID"; cmbShow.DisplayMember = "cnvcJobName"; cmbShow.DataBind(); }
/// <summary> /// Provjera ispravnosti unosa /// </summary> /// <param name="cjenikID"></param> /// <param name="proizvodID"></param> /// <param name="olaksica"></param> /// <returns></returns> public bool ValidateDataInput(int?cjenikID, UltraComboEditor proizvodID, UltraComboEditor olaksica) { this.ValidationMessages = new List <DataValidationException>(); // CJENIKID - not null if (cjenikID == null) { this.ValidationMessages.Add(new DataValidationException(null, "- CJENIK je obavezno polje")); } // PROIZVODID - not null if (proizvodID.Value == null) { this.ValidationMessages.Add(new DataValidationException("ComboBoxProizvod", "- PROIZVOD je obavezno polje")); } // OLAKSICA - not null if (olaksica.Value == null) { this.ValidationMessages.Add(new DataValidationException("ComboBoxOlaksica", "- OLAKŠICA je obavezno polje")); } return(this.ValidationMessages.Count == 0); }
private void btnAgregar_Click(object sender, EventArgs e) { this.Enabled = false; if (this.ultraTabDataGrids.SelectedTab.Index == 0) { string sqlStringAdd = "select name as'NOMBRE DE ORGANIZADOR', institution as 'INSTITUCION' from organizers where not exists (select name, institution from organizersTmp where name =SACMEDB.dbo.organizers.name)"; string sqlStringRemove = "select name as'NOMBRE DE ORGANIZADOR', institution as 'INSTITUCION' from organizersTmp"; UltraComboEditor u = new UltraComboEditor(); Form_genericAddRemove g = new Form_genericAddRemove(conn, "Agregar/Remover Organizador(es)", sqlStringAdd, sqlStringRemove, cmbOrganizadoresM, cmbIdParticipantesM, formMain, this, true); g.fillDatagridAgregar(); g.fillDatagridRemover(); g.Show(); } else if (this.ultraTabDataGrids.SelectedTab.Index == 1) { string sqlStringAdd = "select name + ' ' + lastname as 'NOMBRES',id as 'CEDULA', registrationNumber as 'MATRICULA', emailPersonal as 'CORREO' from users where not exists( select id from usersTmp where id = SACMEDB.dbo.users.id)"; string sqlStringRemove = "select name + ' ' + lastname as 'NOMBRES',id as 'CEDULA', registrationNumber as 'MATRICULA', emailPersonal as 'CORREO' from usersTmp"; UltraComboEditor u = new UltraComboEditor(); Form_genericAddRemove g = new Form_genericAddRemove(conn, "Agregar/Remover Participante(s)", sqlStringAdd, sqlStringRemove, cmbParticipantesM, cmbIdParticipantesM, formMain, this, false); g.fillDatagridAgregar(); g.fillDatagridRemover(); g.Show(); } }
private void SetDictValue(UltraComboEditor _comEdit, string type) { var dict = instDict.GetListByWhere(string.Format(" and dict_key='{0}' and dict_code <>'{0}' order by dict_order ", type)); _comEdit.DataSource = dict.ToList(); _comEdit.DisplayMember = "Dict_Name"; _comEdit.ValueMember = "Dict_Code"; _comEdit.SelectedIndex = 0; }
public void PopulateSettingsTypeDropDown( UltraComboEditor cmbcontrol, string tablename, string whereField , string whereValue, string displayMember, string valueMember) { cmbcontrol.DataSource = GetDataTable("select * from " + tablename + " WHERE " + whereField + " = '" + whereValue + "'"); cmbcontrol.DisplayMember = displayMember; cmbcontrol.ValueMember = valueMember; cmbcontrol.DataBind(); }
public void SetCodeTableControls(string ultraComboEditorName, List<CodeTableEntity> codeTableEntityList) { UltraComboEditor ultraComboEditor = new UltraComboEditor(); switch (ultraComboEditorName) { case CodeTableCategoryNames.IsMasterOffice: ultraComboEditor = this.cb_masterOffice; break; case CodeTableCategoryNames.Office: ultraComboEditor = this.cb_office; break; default: break; } ultraComboEditor.Items.Clear(); if (codeTableEntityList.Count > 0) { foreach (CodeTableEntity codeTableEntity in codeTableEntityList) { ultraComboEditor.Items.Add( codeTableEntity.Code, codeTableEntity.Code ); } } // set default item value ultraComboEditor.SelectedIndex = 0; }
void uCom_BeforeDropDown(object sender, System.ComponentModel.CancelEventArgs e) { UltraCombo uCom = sender as UltraCombo; //if (uCom.Value == null) //{ // uCom.Value = ""; //} Sys_PD_Filed field = uCom.Tag as Sys_PD_Filed; Sys_PD_RefModule refModule = new Sys_PD_RefModule(); refModule = instRef.GetListByWhere(string.Format(" and SPR_RefModule='{0}'", field.DCP_RefSQL)).FirstOrDefault(); if (refModule == null) { return; } string sql = string.Empty; //处理有上级控件的情况 if (!string.IsNullOrEmpty(field.DCP_PControl)) { uCom.Enabled = true; Form frm = uCom.FindForm(); UltraCombo ultra = new UltraCombo(); UltraComboEditor ultrEditor = new UltraComboEditor(); Control ct = new Control(); string pValue = ""; ct = frm.Controls.Find(field.DCP_PControl, true).FirstOrDefault(); if (ct.GetType() == typeof(UltraCombo)) { ultra = ct as UltraCombo; pValue = ultra.Value.ToString(); } else if (ct.GetType() == typeof(UltraComboEditor)) { ultrEditor = ct as UltraComboEditor; pValue = ultrEditor.Value.ToString(); } } else { } }
public Size GenerateTipsForm(Sys_PD_Module module, List<Sys_PD_Filed> filedList, Control ctr, Point p) { Sys_PD_RefModule refModule = new Sys_PD_RefModule(); ctr.Tag = module; ctr.Text = module.SPM_Name; int iTabInex = 0; int xPosition = p.X; int yPosition = p.Y; int vXPosition = p.X; int step = 0;//控制一行已经输出多少列 int fTI = module.SPM_TI; int fTX = module.SPM_TX; int fTY = module.SPM_TY; int fHeight = module.SPM_Height; int controlWidth = 0; int controlHeight = 0; Size lableSize = new Size(module.SPM_LX, module.SPM_LY);//标签的大小 Size textSize = new Size(fTX, fTY);//文本框的大小 Size areaSize = new Size((fTX * 2) + module.SPM_LX + module.SPM_LI, fTY * 3);//备注框大小 foreach (Sys_PD_Filed field in filedList) { if (field.DCP_IsHidden == 1) { UltraTextEditor _hiddenBox = new UltraTextEditor(); _hiddenBox.Location = new System.Drawing.Point(vXPosition, yPosition); _hiddenBox.Name = module.SPM_TPrefix + field.DCP_ControlID; _hiddenBox.Visible = false; ctr.Controls.Add(_hiddenBox); continue; } if (field.DCP_Style == "newline" || (field.DCP_ControlType == "textarea" && step > module.SPM_CNum - 2)) { step = 0; vXPosition = xPosition; yPosition += fHeight; } fTI = module.SPM_TI; fTX = module.SPM_TX; fTY = module.SPM_TY; fHeight = module.SPM_Height; textSize = new Size(fTX, fTY);//文本框的大小 areaSize = new Size((fTX * 2) + module.SPM_LX + module.SPM_LI, fTY * 3); /////////如果字段有自定义的大小,则赋值到相关模块 if (field.DCP_TI != 0 && field.DCP_TX != 0 && field.DCP_TY != 0 && field.DCP_Height != 0) { textSize = new Size(field.DCP_TX, field.DCP_TY); areaSize = new Size(field.DCP_TX, field.DCP_TY); fTX = field.DCP_TX; fTY = field.DCP_TY; fTI = field.DCP_TI; fHeight = field.DCP_Height; } Infragistics.Win.Misc.UltraLabel _lab = new Infragistics.Win.Misc.UltraLabel(); _lab.Location = new Point(vXPosition, yPosition + 6); _lab.Name = module.SPM_LPrefix + field.DCP_ControlID.ToString(); _lab.Size = lableSize; _lab.TabIndex = iTabInex++; _lab.Text = field.DCP_Label.ToString(); ctr.Controls.Add(_lab); vXPosition += module.SPM_LI; #region 控件生成 switch (field.DCP_ControlType) { case "dec": UltraNumericEditor _numBox = new UltraNumericEditor(); _numBox.Location = new System.Drawing.Point(vXPosition, yPosition); _numBox.Name = module.SPM_TPrefix + field.DCP_ControlID; _numBox.Size = textSize; _numBox.NumericType = NumericType.Double; _numBox.TabIndex = iTabInex++; _numBox.PromptChar = ' '; _numBox.Nullable = true; _numBox.NullText = "0"; if (field.DCP_IsReadonly == 1) { _numBox.ReadOnly = true; } ctr.Controls.Add(_numBox); break; case "int": UltraNumericEditor _intBox = new UltraNumericEditor(); _intBox.Location = new System.Drawing.Point(vXPosition, yPosition); _intBox.Name = module.SPM_TPrefix + field.DCP_ControlID; _intBox.Size = textSize; _intBox.NumericType = NumericType.Integer; _intBox.TabIndex = iTabInex++; if (field.DCP_IsReadonly == 1) { _intBox.ReadOnly = true; } _intBox.PromptChar = ' '; _intBox.Nullable = true; _intBox.NullText = ""; ctr.Controls.Add(_intBox); break; case "text": UltraTextEditor _textBox = new UltraTextEditor(); _textBox.Location = new System.Drawing.Point(vXPosition, yPosition); _textBox.Name = module.SPM_TPrefix + field.DCP_ControlID; _textBox.Size = textSize; _textBox.TabIndex = iTabInex++; _textBox.Nullable = true; if (field.DCP_IsReadonly == 1) { _textBox.ReadOnly = true; } ctr.Controls.Add(_textBox); break; case "textl": UltraTextEditor _texBox = new UltraTextEditor(); _texBox.Location = new System.Drawing.Point(vXPosition, yPosition); _texBox.Name = module.SPM_TPrefix + field.DCP_ControlID; _texBox.Size = new Size(textSize.Width * 2, textSize.Height); _texBox.TabIndex = iTabInex++; if (field.DCP_IsReadonly == 1) { _texBox.ReadOnly = true; } ctr.Controls.Add(_texBox); step++; vXPosition += (fTI + module.SPM_LI); break; case "textarea": UltraTextEditor _mBox = new UltraTextEditor(); _mBox.Location = new System.Drawing.Point(vXPosition, yPosition); _mBox.Name = module.SPM_TPrefix + field.DCP_ControlID; _mBox.Multiline = true; _mBox.Size = areaSize; _mBox.TabIndex = iTabInex++; if (field.DCP_IsReadonly == 1) { _mBox.ReadOnly = true; } ctr.Controls.Add(_mBox); break; case "date": UltraDateTimeEditor _dateCom = new UltraDateTimeEditor(); _dateCom.BackColor = System.Drawing.SystemColors.Window; _dateCom.MaskInput = "yyyy-mm-dd"; _dateCom.SpinButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.OnMouseEnter; _dateCom.Location = new System.Drawing.Point(vXPosition, yPosition); _dateCom.Name = module.SPM_TPrefix + field.DCP_ControlID; _dateCom.Size = textSize; _dateCom.TabIndex = iTabInex++; _dateCom.Value = DateTime.Now; _dateCom.PromptChar = ' '; _dateCom.Nullable = true; _dateCom.NullText = DateTime.Now.ToString(); if (field.DCP_IsReadonly == 1) { _dateCom.ReadOnly = true; } ctr.Controls.Add(_dateCom); break; case "time": UltraDateTimeEditor _timeCom = new UltraDateTimeEditor(); _timeCom.BackColor = System.Drawing.SystemColors.Window; _timeCom.MaskInput = "yyyy-mm-dd hh:mm"; _timeCom.SpinButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.OnMouseEnter; _timeCom.Location = new System.Drawing.Point(vXPosition, yPosition); _timeCom.Name = module.SPM_TPrefix + field.DCP_ControlID; _timeCom.Size = textSize; _timeCom.TabIndex = iTabInex++; _timeCom.Value = DateTime.Now; _timeCom.PromptChar = ' '; _timeCom.Nullable = true; _timeCom.NullText = DateTime.Now.ToString(); if (field.DCP_IsReadonly == 1) { _timeCom.ReadOnly = true; } ctr.Controls.Add(_timeCom); break; case "dict": UltraComboEditor _comEdit = new UltraComboEditor(); _comEdit.Location = new System.Drawing.Point(vXPosition, yPosition); _comEdit.Name = module.SPM_TPrefix + field.DCP_ControlID; _comEdit.Size = textSize; _comEdit.TabIndex = iTabInex++; _comEdit.DropDownStyle = DropDownStyle.DropDownList; _comEdit.Tag = field; if (field.DCP_IsReadonly == 1) { _comEdit.ReadOnly = true; } _comEdit.ValueChanged += new EventHandler(_comEdit_ValueChanged); ctr.Controls.Add(_comEdit); //ExcuteWithReturnValue ddd = new ExcuteWithReturnValue(this.SetDictValue); //ddd.BeginInvoke(_comEdit, field.DCP_Type, null, null); SetDictValue(_comEdit, field.DCP_Type); break; case "ref": #region UltraGrid 界面设置 UltraCombo uCom = new UltraCombo(); #endregion uCom.Location = new System.Drawing.Point(vXPosition, yPosition); uCom.Name = module.SPM_TPrefix + field.DCP_ControlID; uCom.Size = textSize; uCom.TabIndex = iTabInex++; uCom.Tag = field; //uCom.Text = ctr.Controls.Add(uCom); //if (uCom.Value == null) //{ // uCom.Value = ""; //} string sql = string.Empty; if (!string.IsNullOrEmpty(field.DCP_RefSQL)) { refModule = instRef.GetListByWhere(string.Format(" and SPR_RefModule='{0}'", field.DCP_RefSQL)).FirstOrDefault();//获取参考 if (refModule != null) { sql = string.Format(refModule.SPR_RefSQL.Trim(), "", ""); DataTable refDate = new DataTable(); refDate = instField.GetRefData(sql); uCom.DataSource = refDate.DefaultView; uCom.DisplayMember = refModule.SPR_RefData; uCom.ValueMember = refModule.SPR_RefValue; } } if (!string.IsNullOrEmpty(field.DCP_PControl)) { uCom.Enabled = false; } uCom.ValueChanged += new EventHandler(uCom_ValueChanged); //uCom.BeforeDropDown += new System.ComponentModel.CancelEventHandler(uCom_BeforeDropDown); uCom.TextChanged += new EventHandler(uCom_TextChanged); //uCom.LostFocus += new EventHandler(uCom_LostFocus); //uCom.InitializeLayout += new InitializeLayoutEventHandler(uCom_InitializeLayout); if (field.DCP_IsReadonly == 1) { uCom.ReadOnly = true; } break; } #endregion if (field.DCP_ControlType == "textarea" && step + 2 < module.SPM_CNum - 2) { vXPosition += fTI;// step++; } else if (field.DCP_ControlType == "textarea" && step + 2 > module.SPM_CNum - 2) { step = module.SPM_CNum - 1; if (field.DCP_TI != 0 && field.DCP_TX != 0 && field.DCP_TY != 0 && field.DCP_Height != 0) { yPosition += fHeight; } else { yPosition += fHeight * 2 - 14; ; } } vXPosition += fTI; if (controlWidth < vXPosition) { controlWidth = vXPosition; } if (controlHeight < yPosition + module.SPM_Height) { controlHeight = yPosition + module.SPM_Height; } if (step == module.SPM_CNum - 1) { step = 0; vXPosition = xPosition; yPosition += module.SPM_Height; } else { step++; } } ctr.Height = controlHeight; Size point = new Size(controlWidth + 20, controlHeight + 10); ctr.KeyUp += new KeyEventHandler(ctr_KeyUp); return point; }
public static void InitCMB_Shift_All(UltraComboEditor cmb) { wsMDL.IwsMDLClient client = new wsMDL.IwsMDLClient(); try { List<MESParameterInfo> lstParameters = new List<MESParameterInfo>(); cmb.DataSource = client.GetShiftRecords((new BaseForm()).CurrentContextInfo, lstParameters.ToArray<MESParameterInfo>()).Tables[0]; cmb.DisplayMember = "shiftname"; cmb.ValueMember = "shift"; } catch (Exception ex) { throw ex; } finally { baseForm.CloseWCF(client); } }