protected void ButtonLoadTextBoxDate_Click(object sender, EventArgs e) { TextBoxDate textBoxDate = ( TextBoxDate )LoadControl("~/UserControl/TextBoxDate.ascx"); textBoxDate.Label = "Coucou c'est moi : "; PanelTextBoxDate.Controls.Add(textBoxDate); }
void init() { buttonExe = new Button() { Content = "exe" }; buttonExe.Width = 150; buttonExe.Click += buttonExe_Click; AddElementToLayoutMenuTop(buttonExe); buttonB = new Button() { Content = "exe 2" }; buttonB.Width = 150; buttonB.Click += buttonB_Click; AddElementToLayoutMenuTop(buttonB); TextBoxDate maskedTextBox = new TextBoxDate(); maskedTextBox.Mask = "00/00/0000"; AddElementToLayoutMenuTop(maskedTextBox); List <Base> _l = null; Gate.Load.Communes(ref _l); Dft.Identite.Nom = "MARIE"; Dft.Identite.Prenom = "Pascal"; Dft.Coordonnees.adress1 = "route de l'église"; Dft.Pouvoir.Qualite = Qualite.Fille; //objEdit.SetConfigFor( // typeof(Commune), // _l, // new DataDisplay(new REMemberExpression(typeof(Commune), ()=>((Commune)null).nom), // new REValue(" "), // new REMemberExpression(typeof(Commune), ()=>((Commune)null).codePost)) // ); //objEdit.Object = Dft.Pouvoir; //PropertyGrid prGrid = new PropertyGrid(); //AddElementToRootLayout(prGrid); //prGrid.SelectedObject = Dft.Coordonnees; CTRL_FicheDefunt _ficheDefunt = new CTRL_FicheDefunt(); AddElementToRootLayout(_ficheDefunt); _ficheDefunt.Defunt = Dft; }
/// <summary> /// Populate the listboxes. /// </summary> private void InitaliseList() { //First get the note IDs of the notes from the //database that contain the correct student ID try { SqlConnector db = new SqlConnector(); snl = db.GetStudentNoteLink_ByStudentID(student.StudentID); } catch { MyMessageBox.ShowMessage("Failed to load Student Note Link data from the database."); return; } //Display them in the appropriate listbox ListBoxNoteList.DataSource = snl; ListBoxNoteList.DisplayMember = "NoteNumber"; //If the snl list contains items, get the note //contents from the note IDs we just retrieved if (snl.Count() > 0) { try { SqlConnector db = new SqlConnector(); notes = db.GetNote_ByNoteID(snl[ListBoxNoteList.SelectedIndex].NoteID); } catch { MyMessageBox.ShowMessage("Failed to load notes from the database."); return; } //Display the selected note in TextBoxNoteViewer TextBoxNoteViewer.Text = notes[0].NoteContents; } else { TextBoxNoteViewer.Clear(); } //First get the message IDs of the messages from the //database that contain the correct student ID try { SqlConnector db = new SqlConnector(); sml = db.GetStudentMessageLink_ByStudentID(student.StudentID); } catch { MyMessageBox.ShowMessage("Failed to load Student Message Link data from the database."); return; } //Display these in the listbox ListBoxMessageList.DataSource = sml; ListBoxMessageList.DisplayMember = "MessageNumber"; //If sml list contains items, get the messages by //their message ID we just retrieved if (sml.Count() > 0) { try { SqlConnector db = new SqlConnector(); messages = db.GetMessage_ByMessageID(sml[ListBoxMessageList.SelectedIndex].MessageID); } catch { MyMessageBox.ShowMessage("Failed to load pinned messages from the database."); return; } //Display the selected message in the text box TextBoxMessageViewer.Text = messages[0].MessageContents; } else { TextBoxMessageViewer.Clear(); TextBoxDate.Clear(); TextBoxTime.Clear(); } }
private string GetCondition() { //总表,从表都不等于0 string condition = "1=1"; string QRcondition = ""; //订单状态 if ((DropDownListOrderState.SelectedValue == "0") && (DropDownListPushState.SelectedValue == "0")) { //全部 condition = " totalstate='1' AND detailstate<>'0' "; addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue); addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue); } else if ((DropDownListOrderState.SelectedValue == "0") && (DropDownListPushState.SelectedValue == "1")) { condition = " totalstate='1' AND (detailstate='1' or detailstate='3') and detailcstate='0' "; addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue); addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue); } else if ((DropDownListOrderState.SelectedValue == "0") && (DropDownListPushState.SelectedValue == "2")) { condition = " totalstate='1' AND detailstate='2' and detailcstate='0' "; addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue); addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue); } else if ((DropDownListOrderState.SelectedValue == "0") && (DropDownListPushState.SelectedValue == "3")) { condition = " totalstate='1' AND detailstate='1' and detailcstate='1' "; addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue); addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue); } else if ((DropDownListOrderState.SelectedValue == "1") && (DropDownListPushState.SelectedValue == "0")) { //订单采购中,明细全部 condition = " totalstate='1' and totalcstate='0' AND detailstate<>'0' "; addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue); addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue); } else if ((DropDownListOrderState.SelectedValue == "1") && (DropDownListPushState.SelectedValue == "1")) { //订单采购中,明细采购中 condition = " totalstate='1' and totalcstate='0' AND (detailstate='1' or detailstate='3') and detailcstate='0'"; addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue); addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue); } else if ((DropDownListOrderState.SelectedValue == "1") && (DropDownListPushState.SelectedValue == "2")) { //订单采购中,明细采购完毕 condition = " totalstate='1' and totalcstate='0' AND detailstate='2' and detailcstate='0'"; addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue); addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue); } else if ((DropDownListOrderState.SelectedValue == "1") && (DropDownListPushState.SelectedValue == "3")) { //订单采购中,明细采购手动关闭 condition = " totalstate='1' and totalcstate='0' AND detailstate='1' and detailcstate='1'"; addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue); addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue); } else if ((DropDownListOrderState.SelectedValue == "2") && (DropDownListPushState.SelectedValue == "0")) { //订单采购完毕,明细全部 condition = " totalstate='3' and totalcstate='0' AND detailstate<>'0' "; addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue); addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue); } else if ((DropDownListOrderState.SelectedValue == "2") && (DropDownListPushState.SelectedValue == "1")) { //订单采购完毕,明细采购中 condition = " totalstate='3' and totalcstate='0' AND (detailstate='1' or detailstate='3') and detailcstate='0'"; addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue); addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue); } else if ((DropDownListOrderState.SelectedValue == "2") && (DropDownListPushState.SelectedValue == "2")) { //订单采购完毕,明细采购完毕 condition = " totalstate='3' and totalcstate='0' AND detailstate='2' and detailcstate='0'"; addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue); addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue); } else if ((DropDownListOrderState.SelectedValue == "2") && (DropDownListPushState.SelectedValue == "3")) { //订单采购完毕,明细手动关闭 condition = " totalstate='3' and totalcstate='0' AND detailstate='1' and detailcstate='1'"; addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue); addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue); } else if ((DropDownListOrderState.SelectedValue == "3") && (DropDownListPushState.SelectedValue == "0")) { //订单手动关闭,明细全部 condition = " totalstate='1' and totalcstate='1' AND detailstate<>'0' "; addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue); addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue); } else if ((DropDownListOrderState.SelectedValue == "3") && (DropDownListPushState.SelectedValue == "1")) { //订单手动关闭,明细采购中 condition = " totalstate='1' and totalcstate='1' AND (detailstate='1' or detailstate='3') and detailcstate='0'"; addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue); addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue); } else if ((DropDownListOrderState.SelectedValue == "3") && (DropDownListPushState.SelectedValue == "2")) { //订单手动关闭,明细采购完毕 condition = " totalstate='1' and totalcstate='1' AND detailstate='2' and detailcstate='0'"; addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue); addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue); } else if ((DropDownListOrderState.SelectedValue == "3") && (DropDownListPushState.SelectedValue == "3")) { //订单手动关闭,明细手动关闭 condition = " totalstate='1' and totalcstate='1' AND detailstate='1' and detailcstate='1'"; addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue); addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue); } //订单号条件 if (TextBoxOrderCode.Text != "") { condition += " AND orderno LIKE '%" + TextBoxOrderCode.Text.Trim().PadLeft(8, '0') + "%'"; addQueryItem(PageName, "TextBoxOrderCode", TextBoxOrderCode.GetType().ToString(), TextBoxOrderCode.Text.Trim()); } //供应商条件 if ((TextBoxSupplier.Text != "") && (condition != "")) { condition += " AND " + " suppliernm LIKE '%" + TextBoxSupplier.Text.Trim() + "%'"; addQueryItem(PageName, "TextBoxSupplier", TextBoxSupplier.GetType().ToString(), TextBoxSupplier.Text.Trim()); } //部门条件 if ((TextBoxDep.Text != "") && (condition != "")) { condition += " AND " + " depnm LIKE'%" + TextBoxDep.Text.Trim() + "%'"; addQueryItem(PageName, "TextBoxDep", TextBoxDep.GetType().ToString(), TextBoxDep.Text.Trim()); } //业务员条件 if ((TextBoxClerk.Text != "") && (condition != "")) { condition += " AND " + " ywynm LIKE'%" + TextBoxClerk.Text.Trim() + "%'"; addQueryItem(PageName, "TextBoxClerk", TextBoxClerk.GetType().ToString(), TextBoxClerk.Text.Trim()); } //下单日期条件 if ((TextBoxDate.Text != "") && (condition != "")) { condition += " AND " + " shtime LIKE '%" + TextBoxDate.Text.Trim() + "%'"; addQueryItem(PageName, "TextBoxDate", TextBoxDate.GetType().ToString(), TextBoxDate.Text.Trim()); } //交货日期 if ((TextBoxJhuo.Text != "") && (condition != "")) { condition += " AND " + " recdate LIKE '%" + TextBoxJhuo.Text.Trim() + "%'"; addQueryItem(PageName, "TextBoxJhuo", TextBoxJhuo.GetType().ToString(), TextBoxJhuo.Text.Trim()); } //物料编码条件 if ((TextBoxCode.Text != "") && (condition != "")) { condition += " AND " + " marid LIKE '%" + TextBoxCode.Text.Trim() + "%'"; addQueryItem(PageName, "TextBoxCode", TextBoxCode.GetType().ToString(), TextBoxCode.Text.Trim()); //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if (DropDownListPlanno.SelectedValue != "1") { QRcondition += " and marid like '%" + TextBoxCode.Text.Trim() + "%'"; } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% } //物料名称条件 if ((TextBoxName.Text != "") && (condition != "")) { condition += " AND " + " marnm LIKE '%" + TextBoxName.Text.Trim() + "%'"; addQueryItem(PageName, "TextBoxName", TextBoxName.GetType().ToString(), TextBoxName.Text.Trim()); //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if (DropDownListPlanno.SelectedValue != "1") { QRcondition += " and marnm like '%" + TextBoxName.Text.Trim() + "%'"; } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% } //规格型号条件 if ((TextBoxStandard.Text != "") && (condition != "")) { condition += " AND " + " margg LIKE '%" + TextBoxStandard.Text.Trim() + "%'"; addQueryItem(PageName, "TextBoxStandard", TextBoxStandard.GetType().ToString(), TextBoxStandard.Text.Trim()); //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if (DropDownListPlanno.SelectedValue != "1") { QRcondition += " and margg like '%" + TextBoxStandard.Text.Trim() + "%'"; } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% } //计划跟踪号条件 if ((TextBoxPTC.Text != "") && (condition != "")) { condition += " AND patindex('%" + TextBoxPTC.Text.Trim() + "%',ptcode)>0"; addQueryItem(PageName, "TextBoxPTC", TextBoxPTC.GetType().ToString(), TextBoxPTC.Text.Trim()); } //材质 if ((TextBoxcaizhi.Text != "") && (condition != "")) { condition += " AND " + " marcz LIKE '%" + TextBoxcaizhi.Text.Trim() + "%'"; addQueryItem(PageName, "TextBoxcaizhi", TextBoxcaizhi.GetType().ToString(), TextBoxcaizhi.Text.Trim()); //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if (DropDownListPlanno.SelectedValue != "1") { QRcondition += " and marcz like '%" + TextBoxcaizhi.Text.Trim() + "%'"; } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% } //国标 if ((TextBoxgb.Text != "") && (condition != "")) { condition += " AND " + " margb LIKE '%" + TextBoxgb.Text.Trim() + "%'"; addQueryItem(PageName, "TextBoxgb", TextBoxgb.GetType().ToString(), TextBoxgb.Text.Trim()); //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if (DropDownListPlanno.SelectedValue != "1") { QRcondition += " and margb like '%" + TextBoxgb.Text.Trim() + "%'"; } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% } //订货数量 if ((TextBoxDnum.Text != "") && (condition != "")) { condition += " AND " + " zxnum LIKE '%" + TextBoxDnum.Text.Trim() + "%'"; addQueryItem(PageName, "TextBoxDnum", TextBoxDnum.GetType().ToString(), TextBoxDnum.Text.Trim()); } //到货数量 if ((TextBoxAnum.Text != "") && (condition != "")) { condition += " AND " + " recgdnum LIKE '%" + TextBoxAnum.Text.Trim() + "%'"; addQueryItem(PageName, "TextBoxAnum", TextBoxAnum.GetType().ToString(), TextBoxAnum.Text.Trim()); } //标识号 if ((TextBoxBSHNUM.Text != "") && (condition != "")) { condition += " AND " + " PO_TUHAO LIKE '%" + TextBoxBSHNUM.Text.Trim() + "%'"; addQueryItem(PageName, "TextBoxBSHNUM", TextBoxBSHNUM.GetType().ToString(), TextBoxBSHNUM.Text.Trim()); } //计划类型 if ((TextBoxPlanTyple.Text != "") && (condition != "")) { condition += " AND " + " PO_MASHAPE LIKE '%" + TextBoxPlanTyple.Text.Trim() + "%'"; addQueryItem(PageName, "TextBoxPlanTyple", TextBoxPlanTyple.GetType().ToString(), TextBoxPlanTyple.Text.Trim()); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //是否入库(即是否生成入库单) if ((DropDownListQRInState.SelectedValue != "") && (condition != "")) { condition += " AND " + " QRIn_State='" + DropDownListQRInState.SelectedValue + "'"; addQueryItem(PageName, "DropDownListQRInState", DropDownListQRInState.GetType().ToString(), DropDownListQRInState.SelectedValue); //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% QRcondition += " and QRIn_State='" + DropDownListQRInState.SelectedValue + "'"; //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% } if ((DropDownListQRInState.SelectedValue == "") && (condition != "")) { condition += " AND " + " (QRIn_State='0' or QRIn_State='1')"; addQueryItem(PageName, "DropDownListQRInState", DropDownListQRInState.GetType().ToString(), DropDownListQRInState.SelectedValue); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //质检结果 if ((DropDownListQCResult.SelectedValue != "all") && (condition != "")) { if (DropDownListQCResult.SelectedValue.ToString().Trim() == "合格") { condition += " AND " + " (RESULT='" + DropDownListQCResult.SelectedValue + "' or RESULT='免检')"; } else { condition += " AND " + " RESULT='" + DropDownListQCResult.SelectedValue + "'"; } } if (DropDownListPlanno.SelectedValue == "1") { condition = condition; } else { condition = condition + " or ((QRIn_PTC is null or QRIn_PTC='')" + QRcondition + ")"; } return(condition); }
public void SetFields(DataBase db, List <UserField> userFields) { dataBase = db; tableLayoutPanel.Controls.Clear(); if (DontShowEmptyFieldsMessage) { linkLabel.Visible = false; } this.userFields = userFields; bool atLeastOneUserField = false; int row = 0; foreach (UserField userField in userFields) { if (!string.IsNullOrEmpty(userField.Name)) { if (!atLeastOneUserField) { tableLayoutPanel.Visible = true; linkLabel.Visible = false; atLeastOneUserField = true; } Label lbl = new Label(); lbl.Text = userField.Name + ":"; lbl.Padding = new Padding(0, 5, 0, 0); lbl.Margin = new Padding(0); lbl.AutoSize = true; tableLayoutPanel.Controls.Add(lbl, 0, row); switch (userField.Type) { case UserFieldType.Number: contentControl[row] = new TextBox(); break; case UserFieldType.Boolean: if (UsedAsFilter) { ComboBox comboBox = new ComboBox(); comboBox.DropDownStyle = ComboBoxStyle.DropDownList; comboBox.Items.Add("<" + StringTable.All + ">"); comboBox.Items.Add(StringTable.Unchecked); comboBox.Items.Add(StringTable.Checked); comboBox.SelectedIndex = 0; contentControl[row] = comboBox; } else { contentControl[row] = new CheckBox(); } break; case UserFieldType.Currency: contentControl[row] = new TextBoxCurrency(); break; case UserFieldType.Date: contentControl[row] = new TextBoxDate(); break; default: contentControl[row] = new TextBox(); break; } contentControl[row].Dock = DockStyle.Fill; tableLayoutPanel.Controls.Add(contentControl[row], 1, row); } row++; } }