/// <summary> /// 设定主权限按钮单击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSetAll_Click(object sender, EventArgs e) { bool flag = false; if (btnSetAll.Text.Trim() == "设定") { ComboxItem cmboxItem = (ComboxItem)comBoxMain.SelectedItem; flag = service.SetMainService("All", PageStatus, cmboxItem.ID); } else//修改的情况 { ComboxItem cmboxItem = (ComboxItem)comBoxMain.SelectedItem; flag = service.UpdateMainService(auth.SeqNo, "All", PageStatus, cmboxItem.ID); } if (flag) { MessageBox.Show("操作成功!"); loadComboxMain(PageStatus); FindAllAuthority();//刷新页面 } else { MessageBox.Show("操作失败!"); } }
void BtnSupprimer_Click(object sender, EventArgs e) { ComboxItem item = (ComboxItem)ComboBoxSupprimerFournisseur.SelectedItem; //Fournisseur fou = (Fournisseur) item.Value; BDDExterne.SupprimerFournisseur(item.Value.ToString()); //Fournisseur fournisseur = Fournisseur.afficher((Guid) item.Value); ReloadFourn(); }
private void listBox_Mission_SelectedIndexChanged(object sender, EventArgs e) { if (listBox_Mission.SelectedIndex >= 0) { ComboxItem itemsupport = listBox_Mission.SelectedItem as ComboxItem; adapter.NotifyfreshDataTable(controller.FindByMissionID(itemsupport.Tag)); gridhelper.UpdateTableSourceAsyn(adapter.ResultTable); } }
/// <summary> /// 保存其他配置信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSetOther_Click(object sender, EventArgs e) { if (btnSetOther.Text.Trim() == "新增") { ComboxItem cmboxItem = (ComboxItem)cmBoxOther.SelectedItem; if (cmboxItem != null) { Authority authOther = new Authority(); authOther.AuthorityName = AuthOtherName; authOther.AuthorityArea = PageStatus; authOther.AUthorityLevel = cmboxItem.ID; bool flag = service.SetOtherService(authOther); if (flag) { MessageBox.Show("操作成功!"); loadComboxMain(PageStatus); } else { MessageBox.Show("操作失败!"); } } else { MessageBox.Show("请先配置主权限!"); } } else //修改权限 { ComboxItem cmboxItem = (ComboxItem)cmBoxOther.SelectedItem; if (cmboxItem != null) { Authority authOther = new Authority(); authOther.SeqNo = updateAuth.SeqNo; authOther.AuthorityName = AuthOtherName; authOther.AuthorityArea = PageStatus; authOther.AUthorityLevel = cmboxItem.ID; bool flag = service.UpdateOtherService(authOther); if (flag) { MessageBox.Show("操作成功!"); loadComboxMain(PageStatus); ReturnAddRule(); } else { MessageBox.Show("操作失败!"); } } } FindAllAuthority();//刷新权限显示 }
/// <summary> /// 加载最大限制条件的下拉列表框 /// </summary> public void loadComboxMain(string pageStatus) { comBoxMain.Items.Clear(); cmBoxOther.Items.Clear(); try { ComboxItem cmboxItem = null; IVstatus status = null; for (int i = 0; i < statusList.Count; i++) { status = statusList[i]; cmboxItem = new ComboxItem(status.IvStatusName, status.IvStatusCode); if (int.Parse(status.IvStatusCode) < int.Parse(pageStatus)) { comBoxMain.Items.Add(cmboxItem); } } comBoxMain.DisplayMember = "Name"; comBoxMain.ValueMember = "ID"; auth = service.FindMainAuthorityByArea(pageStatus, "All"); if (auth.AuthorityName != null && auth.AuthorityName != "") { foreach (IVstatus ivstatus in statusList) { if (ivstatus.IvStatusCode == auth.AUthorityLevel) { int cmbindex = comBoxMain.FindString(ivstatus.IvStatusName); comBoxMain.SelectedItem = comBoxMain.Items[cmbindex]; btnSetAll.Text = "修改"; } if (int.Parse(ivstatus.IvStatusCode) < int.Parse(auth.AUthorityLevel)) { cmboxItem = new ComboxItem(ivstatus.IvStatusName, ivstatus.IvStatusCode); cmBoxOther.Items.Add(cmboxItem); } } cmBoxOther.DisplayMember = "Name"; cmBoxOther.ValueMember = "ID"; if (cmBoxOther.Items.Count > 0) { cmBoxOther.SelectedIndex = 0; } } else { comBoxMain.SelectedIndex = 0; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void BtnModifier_Click(object sender, EventArgs e) { if (BDDExterne.GetAllModules().Count <= 0) { MessageBox.Show("Il n'y a pas de modules !"); } else { ComboxItem item = (ComboxItem)CbxModuleModifier.SelectedItem; Module modu = BDDExterne.GetAllModules().Find(x => x.modId == (Guid)item.Value); ActionButtonGeneric.GoNextForm(this, new ModificationModule(modu)); } }
private void BtnSupprimer_Click(object sender, EventArgs e) { if (BDDExterne.GetAllModules().Count <= 0) { MessageBox.Show("Il n'y a pas de module !"); } else { ComboxItem item = (ComboxItem)CbxModuleSupprimer.SelectedItem; if (BDDExterne.SupprimerModule(Convert.ToString(item.Value))) { MessageBox.Show("Le module a été supprimée !"); reloadModules(); } } }
private void updateArea() { comboBoxAreaList.Items.Clear(); int count = area.arealist.Count; for (int j = 0; j < count; j++) { ComboxItem item = new ComboxItem { Value = area.arealist[j].Areaid, Text = area.arealist[j].AreaName }; comboBoxAreaList.Items.Add(item); } }
public void reloadModules() { // vidage des combobox CbxModuleModifier.Items.Clear(); CbxModuleSupprimer.Items.Clear(); CbxModuleModifier.Text = ""; CbxModuleSupprimer.Text = ""; // ajout des modules déjà existant ComboxItem item; foreach (Module m in BDDExterne.GetAllModules()) { item = new ComboxItem(m.modLibele, m.modId); CbxModuleModifier.Items.Add(item); CbxModuleSupprimer.Items.Add(item); } List <ComboxItem> dataGamme = new List <ComboxItem>(); foreach (Gamme maGamme in BDDExterne.GetAllGammes()) { dataGamme.Add(new ComboxItem() { Value = maGamme.gamId, Text = maGamme.gamLibelle }); } CbxGammeAjout.DisplayMember = "Text"; CbxGammeAjout.ValueMember = "Value"; CbxGammeAjout.DataSource = dataGamme; List <ComboxItem> dataMatiere = new List <ComboxItem>(); foreach (Matiere maMatiere in BDDExterne.GetAllMatiere()) { dataMatiere.Add(new ComboxItem() { Value = maMatiere.matId, Text = maMatiere.matLibelle }); } CbxMatièreAjout.DisplayMember = "Text"; CbxMatièreAjout.ValueMember = "Value"; CbxMatièreAjout.DataSource = dataMatiere; }
void Reload() { // ajout des fournisseurs dans les combobox ComboxItem item; foreach (Fournisseur f in BDDExterne.GetAllFournisseur()) { item = new ComboxItem(f.fouNom, f.fouId); CbxFournisseurModifier.Items.Add(item); } List <ComboxItem> data = new List <ComboxItem>(); foreach (Fournisseur itemf in BDDExterne.GetAllFournisseur()) { data.Add(new ComboxItem() { Value = itemf.fouId, Text = itemf.fouNom }); } CbxFournisseurAjouter.DisplayMember = "Text"; CbxFournisseurAjouter.ValueMember = "Value"; CbxFournisseurAjouter.DataSource = data; // ajout des matières pour suppression foreach (Matiere m in BDDExterne.GetAllMatiere()) { item = new ComboxItem(m.matLibelle, m.matId); CbxMatièreSupprimer.Items.Add(item); } List <ComboxItem> data2 = new List <ComboxItem>(); foreach (Matiere itemm in BDDExterne.GetAllMatiere()) { data2.Add(new ComboxItem() { Value = itemm.matId, Text = itemm.matLibelle }); } CbxMatièreSupprimer.DisplayMember = "Text"; CbxMatièreSupprimer.ValueMember = "Value"; CbxMatièreSupprimer.DataSource = data2; }
private void updateFloor() { if (aid != null) { comboBoxfloor.Items.Clear(); floor = updater.updatefloor(aid); int count1 = floor.floorlist.Count; for (int i = 0; i < count1; i++) { ComboxItem flooritem = new ComboxItem { Text = "区域" + floor.floorlist[i].id + "|进度:" + floor.floorlist[i].prog, Value = floor.floorlist[i].id }; comboBoxfloor.Items.Add(flooritem); } } }
private void cbR1_SelectedIndexChanged(object sender, EventArgs e) { ComboBox cbTmp = (ComboBox)sender; string NO = cbTmp.Name.Substring(cbTmp.Name.Length - 1, 1); Label lbTmp = (Label)this.Controls.Find("lbR" + NO, true)[0]; ComboxItem item = (ComboxItem)cbTmp.SelectedItem; if (item != null) { Reason_Item ri = dReason.Find(x => x.Reason_code.Contains(item.Value.ToString())); lbTmp.Text = ri.Point; } else { Reason_Item ri = null; lbTmp.Text = ""; } }
private void BtnSupprimer_Click(object sender, EventArgs e) { //if (Gamme.listGamme.Count <= 0) { // MessageBox.Show("Il n'y a pas de gammes !"); //} else { // ComboxItem item = (ComboxItem) comboBox2.SelectedItem; // if (Gamme.supprimeGamme((Guid) item.Value)) { // MessageBox.Show("La gamme a été supprimée !"); // reloadGammes(); // } //} ComboxItem item = (ComboxItem)comboBox2.SelectedItem; //Fournisseur fou = (Fournisseur) item.Value; BDDExterne.SupprimerGamme(item.Value.ToString()); //Fournisseur fournisseur = Fournisseur.afficher((Guid) item.Value); reloadGammes(); }
public void ReloadFourn() { // vidage des combox ComboBoxModifierFournisseur.Items.Clear(); ComboBoxSupprimerFournisseur.Items.Clear(); ComboBoxModifierFournisseur.Text = ""; ComboBoxSupprimerFournisseur.Text = ""; // ajout des valeurs ComboxItem item; foreach (Fournisseur f in BDDExterne.GetAllFournisseur()) { item = new ComboxItem(f.fouNom, f.fouId); ComboBoxModifierFournisseur.Items.Add(item); ComboBoxSupprimerFournisseur.Items.Add(item); } }
private void Init() { this.AcceptButton = btnLogin; string ssql = SQL_TEXT.Q_EMPL; DataTable dtRet = dbTool.QueryData(ssql); if (dtRet.Rows.Count > 0) { cbName.Items.Clear(); for (int i = 0; i < dtRet.Rows.Count; i++) { ComboxItem cbItem = new ComboxItem(); cbItem.Text = string.Format("{0}-{1}", dtRet.Rows[i]["EMPLNO"], dtRet.Rows[i]["EMPLNAME"]); cbItem.Value = dtRet.Rows[i]["EMPLNO"].ToString(); cbName.Items.Add(cbItem); } cbName.SelectedIndex = 0; } }
private void btnSrch_Click(object sender, EventArgs e) { if (comKd.SelectedIndex < 0) { MessageBox.Show("请选择快递公司!"); return; } if (edtKdh.Text == "") { MessageBox.Show("请输入快递单号!"); return; } ComboxItem item = comKd.SelectedItem as ComboxItem; ApiUtils apiGet = new ApiUtils(); object obj = null; if (apiGet.ApiData_Get(PubApi.ApiTypeEnum.ApiExpressInfo, out obj, item.Value, edtKdh.Text)) { if (obj != null) { apiDataObject.ExpressInfoObj dataInfo = obj as apiDataObject.ExpressInfoObj; if (dataInfo.status != "200") { MessageBox.Show("查询失败!"); return; } else { string sNr = string.Empty; for (int i = 0; i < dataInfo.data.Count; i++) { sNr += dataInfo.data[i].time + "\r\n"; sNr += dataInfo.data[i].context + "\r\n"; sNr += "------------------------------------------------------------------------\r\n"; } memoNr.Text = sNr; } } } }
public void reloadGammes() { // vidage des combobox comboBox1.Items.Clear(); comboBox2.Items.Clear(); comboBox1.Text = ""; comboBox2.Text = ""; // ajout des valeurs ComboxItem item; foreach (Gamme g in BDDExterne.GetAllGammes()) { item = new ComboxItem(g.gamLibelle, g.gamId); comboBox1.Items.Add(item); comboBox2.Items.Add(item); } // sélection du 1er élément //comboBox1.SelectedIndex = 0; //comboBox2.SelectedIndex = 0; }
private void btnLogin_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(cbName.Text)) { ComboxItem cbItem = (ComboxItem)cbName.SelectedItem; string[] emplStr = cbItem.Text.Split('-'); EMPLOYEE empl = new EMPLOYEE(emplStr[0], emplStr[1], GlobalVar.sMode.ToString()); if (tbPW.Text == "111111") //if (empl.CheckPW(tbPW.Text)) { GlobalVar.LoginUser = empl; DialogResult = DialogResult.OK; } else { MessageBox.Show("密碼錯誤!"); } } else { lbNote.Text = "請選擇使用者!"; } }
private void tlbSave_Click(object sender, EventArgs e) { if (txtID.Text == "" || _tableId == "" || txtDESCR.Text.Trim() == "" || txtNAME.Text.Trim() == "") { //MessageBox.Show("列描述不允许为空!"); return; } int temp; string[] isInt = new string[4] { txtORDER_ID.Text, txtLENGTH.Text, txtCONTROL_LIST_WIDTH.Text, txtCONTROL_HEIGHT.Text }; for (int i = 0; i < isInt.Length; i++) { if (isInt[i].Trim() == "") { continue; } if (!int.TryParse(isInt[i], out temp)) { //MessageBox.Show("必须输入整数!"); return; } else { if (temp > 32767 || temp < 0) { //MessageBox.Show(this, "数值必须在0~32767之间!"); return; } } } string align; if (cbbCONTROL_LIST_DISPLAY_ALIGN.SelectedItem == null) { align = ""; } else { ComboxItem item = (ComboxItem)cbbCONTROL_LIST_DISPLAY_ALIGN.SelectedItem; align = item.Value; } FieldPara[] field = { new FieldPara("TABLE_ID", FieldType.Int, txtTABLE_ID.Text), new FieldPara("ID", FieldType.Int, txtID.Text), new FieldPara("NAME", FieldType.String, txtNAME.Text), new FieldPara("DESCR", FieldType.String, txtDESCR.Text), new FieldPara("OTHER_LANGUAGE_DESCR", FieldType.String, txtOTHER_LANGUAGE_DESCR.Text), new FieldPara("TYPE", FieldType.String, txtTYPE.Text), new FieldPara("ISNULL", FieldType.Int, ckbISNULL.Checked == true?"1":"0"), new FieldPara("ISPRIMARY", FieldType.Int, ckbISPRIMARY.Checked == true?"1":"0"), new FieldPara("LENGTH", FieldType.Int, txtLENGTH.Text), new FieldPara("ISDISPLAY", FieldType.Int, ckbISDISPLAY.Checked == true?"1":"0"), new FieldPara("CONTROL_LIST_WIDTH", FieldType.Int, txtCONTROL_LIST_WIDTH.Text), new FieldPara("CONTROL_LIST_DISPLAY_FORMAT", FieldType.String, cbbCONTROL_LIST_DISPLAY_FORMAT.Text), new FieldPara("CONTROL_LIST_DISPLAY_ALIGN", FieldType.String, align), new FieldPara("CONTROL_HEIGHT", FieldType.Int, txtCONTROL_HEIGHT.Text), //new FieldPara("FILL_EXPRESSION",FieldType.String,txtFILL_EXPRESSION.Text.Replace('\'','^')), new FieldPara("RELATING_COLUMN", FieldType.String, cbbRELATING_COLUMN.Text), new FieldPara("ORDER_ID", FieldType.Int, txtORDER_ID.Text), new FieldPara("CUSTOM_CONTROL_NAME", FieldType.String, txtCUSTOM_CONTROL_NAME.Text), new FieldPara("CUSTOM_CONTROL_TYPE", FieldType.String, cbbCUSTOM_CONTROL_TYPE.Text), new FieldPara("CUSTOM_CONTROL_SVAE_TYPE", FieldType.String, cbbCUSTOM_CONTROL_SVAE_TYPE.Text), new FieldPara("CONTROL_DISPLAY_ONE_ROW", FieldType.Int, ckbCONTROL_DISPLAY_ONE_ROW.Checked == true?"1":"0"), new FieldPara("RELATING_CONDITION", FieldType.String, txtRELATING_CONDITION.Text) }; WherePara[] where = { new WherePara("ID", FieldType.Int, txtID.Text, "=", "and") }; _sql = DBOpt.dbHelper.GetUpdateSql("DMIS_SYS_COLUMNS", field, where); if (DBOpt.dbHelper.ExecuteSql(_sql) > 0) { if (DBHelper.databaseType == "SqlServer") { } else if (DBHelper.databaseType == "Oracle") { _sql = "update DMIS_SYS_COLUMNS set FILL_EXPRESSION=:FillExpression where ID=" + txtID.Text; OracleParameter[] aPara = new OracleParameter[1]; OracleParameter pContent = new OracleParameter("FillExpression", OracleType.VarChar); pContent.Value = txtFILL_EXPRESSION.Text; aPara[0] = pContent; DBOpt.dbHelper.ExecuteSqlByParas(_sql, aPara); } else if (DBHelper.databaseType == "Sybase") { } else //ODBC { } } InitColumns(); }
/// <summary> /// 绑定数据 /// </summary> /// <typeparam name="object"></typeparam> /// <param name="cb"></param> /// <param name="items"></param> public static void BindData(this ComboBox cb, params object[] items) => cb.BindData(ComboxItem.FromValues(true, items));
public async void SetTopMenu(DataTable dataTable) { ComboxItem comboxItem1; ComboxItem comboxItem2; int cntException; List <ComboxItem> comboxItems; decimal defaultMenuID; comboxItems = new List <ComboxItem>(); cntException = 0; comboxItem2 = null; try { defaultMenuID = this.Core.GetAttributeDecimal("DefaultMenuID"); } catch (Exception ex) { DiagnosticsTool.MyTrace(ex); defaultMenuID = -1; } foreach (DataRow dataRow in dataTable.Rows) { try { comboxItem1 = new ComboxItem() { MenuID = (decimal)dataRow["MENU_ID"], ParentMenuID = (decimal)dataRow["PARENT_MENU_ID"], Name = (string)dataRow["NAME"], Description = (string)dataRow["DESCRIPTION"], Image = dataRow["IMAGE_URL1"] != DBNull.Value && (string)dataRow["IMAGE_URL1"] != "" ? (((string)dataRow["IMAGE_URL1"]).Contains("http") ? await this.Core.GetAttributeMediaWebImage(new Uri((string)dataRow["IMAGE_URL1"])) : null) : null }; if (comboxItem1 != null) { comboxItems.Add(comboxItem1); if (defaultMenuID == comboxItem1.MenuID) { comboxItem2 = comboxItem1; } if (dataTable.Rows.Count == (comboxItems.Count + cntException)) { this.ComboxMenuItem = comboxItems; if (comboxItem2 != null) { this.ComboxMenuItemSelected = comboxItem2; } } } } catch (Exception ex) { cntException += 1; } } //comboxItem1 = new ComboxItem() //{ // Text = "생산관리", // Image = new BitmapImage(new Uri("/Atomus.Windows.Controls.Toolbar.ModernToolbar;component/Image/icon-menu-02-pm.png", UriKind.Relative)) //}; //if (comboxItem1 != null && comboxItem1.Image != null) // this.ComboxMenuItem.Add(comboxItem1); //comboxItem1 = new ComboxItem() //{ // Text = "히스토리안", // Image = new BitmapImage(new Uri("/Atomus.Windows.Controls.Toolbar.ModernToolbar;component/Image/icon-menu-03-history.png", UriKind.Relative)) //}; //if (comboxItem1 != null && comboxItem1.Image != null) // this.ComboxMenuItem.Add(comboxItem1); //comboxItem1 = new ComboxItem() //{ // Text = "방사제조", // Image = await this.Core.GetAttributeMediaWebImage("Image1") //}; //if (comboxItem1 != null) // this.ComboxMenuItem.Add(comboxItem1); //comboxItem1 = new ComboxItem() //{ // Text = "물성추적", // Image = new BitmapImage(new Uri("/Atomus.Windows.Controls.Toolbar.ModernToolbar;component/Image/icon-menu-05.png", UriKind.Relative)) //}; //if (comboxItem1 != null && comboxItem1.Image != null) // this.ComboxMenuItem.Add(comboxItem1); }
private void tlbSave_Click(object sender, EventArgs e) { if (txtTYPE_ID.Text == "" || txtNAME.Text.Trim() == "" || txtTYPE_ID.Text.Trim() == "" || txtOWNER.Text.Trim() == "" || txtDESCR.Text.Trim() == "") { MessageBox.Show(this, Main.Properties.Resources.NoEmpty);//"某些项不允许为空!" return; } if (txtORDER_ID.Text.Trim() != "") { int order; if (!int.TryParse(txtORDER_ID.Text.Trim(), out order)) { MessageBox.Show(this, Main.Properties.Resources.NumericalValeError);//"排列序号不是整数类型!" return; } else { if (order > 32767 || order < 0) { //MessageBox.Show(this, "排列序号必须在0~32767之间!"); return; } } } if (txtPAGE_ROWS.Text.Trim() != "") { int order; if (!int.TryParse(txtPAGE_ROWS.Text.Trim(), out order)) { //MessageBox.Show(this, "每页行数不是整数类型!"); MessageBox.Show(this, Main.Properties.Resources.NumericalValeError); return; } else { if (order > 32767 || order < 0) { //MessageBox.Show(this, "每页行数必须在0~32767之间!"); return; } } } string style; if (cbbDISPLAY_STYLE.SelectedItem == null) { style = ""; } else { ComboxItem item = (ComboxItem)cbbDISPLAY_STYLE.SelectedItem; style = item.Value; } FieldPara[] field = { new FieldPara("ID", FieldType.Int, txtID.Text), new FieldPara("NAME", FieldType.String, txtNAME.Text), new FieldPara("TYPE_ID", FieldType.Int, txtTYPE_ID.Text), new FieldPara("OWNER", FieldType.String, txtOWNER.Text), new FieldPara("DESCR", FieldType.String, txtDESCR.Text), new FieldPara("PAGE_ROWS", FieldType.Int, txtPAGE_ROWS.Text), new FieldPara("ORDER_ID", FieldType.Int, txtORDER_ID.Text), new FieldPara("DISPLAY_STYLE", FieldType.String, style), new FieldPara("QUERY_COL", FieldType.String, cbbQUERY_COL.Text), new FieldPara("OTHER_LANGUAGE_DESCR", FieldType.String, txtOTHER_LANGUAGE_DESCR.Text) }; if (DBOpt.dbHelper.IsExist("DMIS_SYS_TABLES", "ID=" + txtID.Text)) { WherePara[] where = { new WherePara("ID", FieldType.Int, txtID.Text, "=", "and") }; _sql = DBOpt.dbHelper.GetUpdateSql("DMIS_SYS_TABLES", field, where); } else { _sql = DBOpt.dbHelper.GetInserSql("DMIS_SYS_TABLES", field); } if (DBOpt.dbHelper.ExecuteSql(_sql) >= 0) { InitTable(tvTableType.SelectedNode); } else { //Log.InsertLog("", "失败", "维护数据表时,语句出错:" + _sql); //MessageBox.Show(this, "更新失败,已经记录日志!"); return; } }
/// <summary> /// 显示其他规则的公共方法 /// </summary> private void LblOtherMsgShow() { msg = ""; AuthOtherName = ""; if (chkBoxLing.Checked == false && chkBoxUnling.Checked == true) { msg += "非临时瓶签,"; AuthOtherName += "UL;"; } else if (chkBoxLing.Checked == true && chkBoxUnling.Checked == false) { msg += "临时瓶签,"; AuthOtherName += "L;"; } else if (chkBoxLing.Checked == true && chkBoxUnling.Checked == true) { msg += "非临时和临时瓶签,"; AuthOtherName += "UL,L;"; } if (chkBoxUnST.Checked == true && chkBoxST.Checked == false) { msg += "非临时医嘱,"; AuthOtherName += "UST;"; } else if (chkBoxUnST.Checked == false && chkBoxST.Checked == true) { msg += "临时医嘱,"; AuthOtherName += "SL;"; } else if (chkBoxUnST.Checked == true && chkBoxST.Checked == true) { msg += "非临时和临时医嘱,"; AuthOtherName += "UST,ST;"; } if (chkBoxK.Checked == true && chkBoxA.Checked == false) { msg += "K包,"; AuthOtherName += "K;"; } else if (chkBoxK.Checked == false && chkBoxA.Checked == true) { msg += "#包,"; AuthOtherName += "#;"; } else if (chkBoxK.Checked == true && chkBoxA.Checked == true) { msg += "K和#包,"; AuthOtherName += "K,#;"; } //AuthOtherName += GetBatchCheckbox() + ";"; // msg += "第" + cmBoxBatch.Text + "批次 ,"; msg += "第" + GetBatchCheckbox() + "批次 ,"; AuthOtherName += GetBatchCheckbox() + ";"; ComboxItem cmboxItem = (ComboxItem)cmBoxOther.SelectedItem; if (cmboxItem != null) { AuthOtherName += cmboxItem.ID; } msg += cmBoxOther.Text + "之后 "; msg += "允许" + PageName; lblOtherMsg.Text = msg; }
private void btnGen_Click(object sender, EventArgs e) { DateTime start = dtpStart.Value; DateTime end = dtpEnd.Value; DateTime cur; int curMonth, curYear; Object obj; lsbMsg.Items.Clear(); string path = txtPath.Text.Trim(); if (start > end) { errorProvider1.SetError((Control)dtpEnd, " "); //MessageBox.Show("起始日期不能大于终止日期!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { errorProvider1.SetError((Control)dtpEnd, ""); } if(path.Length<1) { errorProvider1.SetError((Control)txtPath, " "); //MessageBox.Show("请先选择存放备份文件的目录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { errorProvider1.SetError((Control)txtPath, ""); } if (!Directory.Exists(path)) { errorProvider1.SetError((Control)txtPath, " "); //MessageBox.Show("目录:" + txtPath.Text.Trim() + " 不存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { errorProvider1.SetError((Control)txtPath, ""); } Directory.SetCurrentDirectory(path); for (int i = 0; i < trvTables.Nodes.Count; i++) { if (!trvTables.Nodes[i].Checked) continue; //找对应的时间列 _sql = "select QUERY_COL from DMIS_SYS_TABLES where OWNER='" + cbbDataBase.SelectedItem.ToString() + "' and NAME='" + trvTables.Nodes[i].Text + "'"; obj = DBOpt.dbHelper.ExecuteScalar(_sql); if (obj == null || obj.ToString().Trim() == "") { if (DBHelper.databaseType == "Oracle") _sql = "select * from " + cbbDataBase.SelectedItem.ToString() + "." + trvTables.Nodes[i].Text; else if (DBHelper.databaseType == "SqlServer" || DBHelper.databaseType == "Sybase") _sql = "select * from " + cbbDataBase.SelectedItem.ToString() + ".dbo." + trvTables.Nodes[i].Text; else _sql = ""; GenSql(_sql, trvTables.Nodes[i].Text, ""); } else { ComboxItem ci =(ComboxItem)cbbTimeType.SelectedItem; //if(ci==null) if (DBHelper.databaseType == "Oracle") { if (ci.Value == "0" || ci.Value == "") { _sql = "select * from " + cbbDataBase.SelectedItem.ToString() + "." + trvTables.Nodes[i].Text + " where to_char(" + obj.ToString() + ",'YYYYMMDD')>='" + start.ToString("yyyyMMdd") + "' and to_char(" + obj.ToString() + ",'YYYYMMDD')<='" + end.ToString("yyyyMMdd") + "'"; GenSql(_sql, trvTables.Nodes[i].Text, start.ToString("yyyyMMdd") +"-"+ end.ToString("yyyyMMdd")); } else if (ci.Value == "3") { cur = start; while (cur <= end) { _sql = "select * from " + cbbDataBase.SelectedItem.ToString() + "." + trvTables.Nodes[i].Text + " where to_char(" + obj.ToString() + ",'YYYYMMDD')='" + cur.ToString("yyyyMMdd") + "'"; GenSql(_sql, trvTables.Nodes[i].Text, cur.ToString("yyyyMMdd")); cur = cur.AddDays(1); } } else if (ci.Value == "2") { cur = start; curMonth=Convert.ToInt32(start.ToString("yyyyMM")); while (curMonth <= Convert.ToInt32(end.ToString("yyyyMM"))) { _sql = "select * from " + cbbDataBase.SelectedItem.ToString() + "." + trvTables.Nodes[i].Text + " where to_char(" + obj.ToString() + ",'YYYYMM')='" + cur.ToString("yyyyMM") + "'"; GenSql(_sql, trvTables.Nodes[i].Text, cur.ToString("yyyyMM")); cur = cur.AddMonths(1); curMonth = Convert.ToInt32(cur.ToString("yyyyMM")); } } else if (ci.Value == "1") { cur = start; curYear = start.Year; while (curYear <= end.Year) { _sql = "select * from " + cbbDataBase.SelectedItem.ToString() + "." + trvTables.Nodes[i].Text + " where to_char(" + obj.ToString() + ",'YYYY')='" + cur.Year + "'"; GenSql(_sql, trvTables.Nodes[i].Text, cur.ToString("yyyy")); cur = cur.AddYears(1); curYear = cur.Year; } } } else if (DBHelper.databaseType == "SqlServer" || DBHelper.databaseType == "Sybase") { if (cbbTimeType.SelectedValue.ToString() == "0") { _sql = "select * from " + cbbDataBase.SelectedItem.ToString() + "." + trvTables.Nodes[i].Text + " where convert(char(8)," + obj.ToString() + ",112)>='" + start.ToString("yyyyMMdd") + "' and convert(char(8)," + obj.ToString() + ",112)<='" + end.ToString("yyyyMMdd") + "'"; GenSql(_sql, trvTables.Nodes[i].Text, start.ToString("yyyyMMdd") + "-" + end.ToString("yyyyMMdd")); } else if (cbbTimeType.SelectedValue.ToString() == "3") { cur = start; while (cur <= end) { _sql = "select * from " + cbbDataBase.SelectedItem.ToString() + "." + trvTables.Nodes[i].Text + " where convert(char(8)," + obj.ToString() + ",112)='" + cur.ToString("yyyyMMdd") + "'"; GenSql(_sql, trvTables.Nodes[i].Text, cur.ToString("yyyyMMdd")); cur = cur.AddDays(1); } } else if (cbbTimeType.SelectedValue.ToString() == "2") { cur = start; curMonth = Convert.ToInt16(start.ToString("yyyyMM")); while (curMonth <= Convert.ToInt16(end.ToString("yyyyMM"))) { _sql = "select * from " + cbbDataBase.SelectedItem.ToString() + "." + trvTables.Nodes[i].Text + " where convert(char(6)," + obj.ToString() + ",112)='" + cur.ToString("yyyyMM") + "'"; GenSql(_sql, trvTables.Nodes[i].Text, cur.ToString("yyyyMM")); cur = cur.AddMonths(1); curMonth = Convert.ToInt16(cur.ToString("yyyyMM")); } } else if (cbbTimeType.SelectedValue.ToString() == "1") { cur = start; curYear = start.Year; while (curYear <= end.Year) { _sql = "select * from " + cbbDataBase.SelectedItem.ToString() + "." + trvTables.Nodes[i].Text + " where convert(char(4)," + obj.ToString() + ",112)='" + cur.Year + "'"; GenSql(_sql, trvTables.Nodes[i].Text, cur.ToString("yyyy")); cur = cur.AddYears(1); curYear = cur.Year; } } } else { _sql = ""; } } } }
private void Init() { gpMode = Page_Mode.ADD; //Load EQP LoadEQP(); //LoadINS LoadINS_DATA(); //Load Reason string ssql = SQL_TEXT.Q_REASON_CODE; DataTable dtReasonCode = dbTool.QueryData(ssql); dReason.Clear(); foreach (DataRow dr in dtReasonCode.Rows) { Reason_Item ri = new Reason_Item(); ri.Reason_code = dr[0].ToString(); ri.Reason = dr[1].ToString(); ri.Point = dr[2].ToString(); dReason.Add(ri); } for (int i = 1; i <= 4; i++) { Label lbY = (Label)this.Controls.Find("lbY" + i, true)[0]; Label lbPts = (Label)this.Controls.Find("lbPts" + i, true)[0]; Label lbG = (Label)this.Controls.Find("lbG" + i, true)[0]; lbY.Text = ""; lbPts.Text = ""; lbG.Text = ""; } #region Init Shift combobix //Init Shift combobix foreach (Control s in this.tableLayoutPanel2.Controls) { if (s is Panel) { foreach (Control s1 in s.Controls) { if (s1.Name.Contains("cbS")) { ComboBox cb = (ComboBox)s1; cb.Items.Clear(); cb.Items.Add("A"); cb.Items.Add("B"); cb.Items.Add("C"); cb.SelectedIndex = 0; cb.DropDownStyle = ComboBoxStyle.DropDownList; } if (s1.Name.Contains("cbR")) { ComboBox cb = (ComboBox)s1; cb.Items.Clear(); foreach (Reason_Item r in dReason) { ComboxItem cItem = new ComboxItem(); cItem.Text = r.Reason_code + "-" + r.Reason; cItem.Value = r.Reason_code; cb.Items.Add(cItem); } //cb.SelectedIndex = 0; cb.DropDownStyle = ComboBoxStyle.DropDownList; } } } } cbS0.Items.Clear(); cbS0.Items.Add("A"); cbS0.Items.Add("B"); cbS0.Items.Add("C"); cbS0.SelectedIndex = 0; cbS0.DropDownStyle = ComboBoxStyle.DropDownList; #endregion //Init Table Layout this.tableLayoutPanel2.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single; #region Event Handler //Event btnAddO1.Click += btnAddO1_Click; btnAddO2.Click += btnAddO1_Click; btnAddO3.Click += btnAddO1_Click; btnAddO4.Click += btnAddO1_Click; btnDelO1.Click += btnDelO1_Click; btnDelO2.Click += btnDelO1_Click; btnDelO3.Click += btnDelO1_Click; btnDelO4.Click += btnDelO1_Click; btnAddR1.Click += btnAddR1_Click; btnAddR2.Click += btnAddR1_Click; btnAddR3.Click += btnAddR1_Click; btnAddR4.Click += btnAddR1_Click; btnDelR1.Click += btnDelR1_Click; btnDelR2.Click += btnDelR1_Click; btnDelR3.Click += btnDelR1_Click; btnDelR4.Click += btnDelR1_Click; dgvO1.CellClick += dgvO1_CellClick; dgvO2.CellClick += dgvO1_CellClick; dgvO3.CellClick += dgvO1_CellClick; dgvO4.CellClick += dgvO1_CellClick; dgvR1.CellClick += dgvR1_CellClick; dgvR2.CellClick += dgvR1_CellClick; dgvR3.CellClick += dgvR1_CellClick; dgvR4.CellClick += dgvR1_CellClick; cbR1.SelectedIndexChanged += cbR1_SelectedIndexChanged; cbR2.SelectedIndexChanged += cbR1_SelectedIndexChanged; cbR3.SelectedIndexChanged += cbR1_SelectedIndexChanged; cbR4.SelectedIndexChanged += cbR1_SelectedIndexChanged; tbS12.KeyDown += tbS12_KeyDown; tbS22.KeyDown += tbS12_KeyDown; tbS32.KeyDown += tbS12_KeyDown; tbS42.KeyDown += tbS12_KeyDown; tbR11.KeyDown += tbS12_KeyDown; tbR21.KeyDown += tbS12_KeyDown; tbR31.KeyDown += tbS12_KeyDown; tbR41.KeyDown += tbS12_KeyDown; tbS11.KeyPress += textBox1_KeyPress; tbS12.KeyPress += textBox1_KeyPress; tbS21.KeyPress += textBox1_KeyPress; tbS22.KeyPress += textBox1_KeyPress; tbS31.KeyPress += textBox1_KeyPress; tbS32.KeyPress += textBox1_KeyPress; tbS41.KeyPress += textBox1_KeyPress; tbS42.KeyPress += textBox1_KeyPress; tbR11.KeyPress += textBox1_KeyPress; tbR21.KeyPress += textBox1_KeyPress; tbR31.KeyPress += textBox1_KeyPress; tbR41.KeyPress += textBox1_KeyPress; #endregion }