private void frmBsDepartment_Load(object sender, EventArgs e) { //系統狀態 clsGoodsCode.Set_DropBox_For_State(luestate, DBUtility._language); string strDept; if (DBUtility._language == "2") { strDept = @"SELECT id,english_name as name FROM dbo.bs_productline where state='0'"; } else { strDept = @"SELECT id,name FROM dbo.bs_productline where state='0'"; } //倉庫位置 dtDeptpartment = clsApp.GetDataTable(strDept); DataRow row1 = dtDeptpartment.NewRow();//插一空行 dtDeptpartment.Rows.Add(row1); dtDeptpartment.DefaultView.Sort = "id ASC"; //排序 dtDeptpartment = dtDeptpartment.DefaultView.ToTable(); //排序後重新賦值 luelocation.Properties.DataSource = dtDeptpartment; luelocation.Properties.ValueMember = "id"; luelocation.Properties.DisplayMember = "name"; dgvDetails.AutoGenerateColumns = false; Load_Date(); Bingding_Data(); }
private void frmBsArtWork_Load(object sender, EventArgs e) { //系統狀態 clsGoodsCode.Set_DropBox_For_State(luestate, DBUtility._language); dtMostly = clsApp.GetDataTable("Select * From dbo.cd_pattern Where 1=0"); dtDetails = clsApp.GetDataTable("Select * From dbo.cd_pattern_details Where 1=0"); dtTempDel = dtDetails.Clone(); bds_h.DataSource = dtMostly; bds_d.DataSource = dtDetails; gridControl1.DataSource = bds_d; Set_DataBindings(); DataTable dtMat = clsArtwork.Return_mat_type(); clMat_id.DataSource = dtMat; clMat_id.DisplayMember = "name"; clMat_id.ValueMember = "id"; //回樣類型 DataTable dtAcus = clsArtwork.Return_cd_acus(); clPoduct_type_id.DataSource = dtAcus; clPoduct_type_id.DisplayMember = "name"; clPoduct_type_id.ValueMember = "id"; DataTable dtSizeRange = clsArtwork.Return_size_range(); clSize_range.DataSource = dtSizeRange; clSize_range.DisplayMember = "name"; clSize_range.ValueMember = "id"; }
private void frmSysUserGroup_Load(object sender, EventArgs e) { if (form_type == "E") { txtUser_id.ReadOnly = true; string sql = String.Format(@"SELECT user_id,user_name,remark,createby,createdate,modifyby,modifydate FROM dbo.sys_user WHERE user_id ='{0}'", txtUser_id.Text); DataTable dt = clsApp.GetDataTable(sql); if (dt.Rows.Count > 0) { txtUser_name.Text = dt.Rows[0]["user_name"].ToString(); txtRemark.Text = dt.Rows[0]["remark"].ToString(); txtCreateby.Text = dt.Rows[0]["createby"].ToString(); txtCreatedate.Text = dt.Rows[0]["createdate"].ToString(); txtModifyby.Text = dt.Rows[0]["modifyby"].ToString(); txtModifydate.Text = dt.Rows[0]["modifydate"].ToString(); } } else { txtUser_id.ReadOnly = false; txtUser_name.Text = ""; txtRemark.Text = ""; txtCreateby.Text = DBUtility._user_id; txtCreatedate.Text = DateTime.Now.Date.ToString("yyyy/MM/dd"); txtModifyby.Text = DBUtility._user_id; txtModifydate.Text = DateTime.Now.Date.ToString("yyyy/MM/dd"); } }
public frmBomFind() { InitializeComponent(); clsTranslate obj_ctl = new clsTranslate(this.Controls, DBUtility._language); obj_ctl.Translate(); str_language = DBUtility._language; NextControl oNext = new NextControl(this, "1"); oNext.EnterToTab(); objToolbar = new clsToolBar(this.Tag.ToString(), this.Controls); objToolbar.Set_Button_Image(toolStrip1); DataTable dtDept = clsApp.GetDataTable(@"SELECT id as dep_id,(id +'[' + name+']') AS dep_cdesc FROM dbo.bs_department with(nolock) WHERE state='0'"); DataRow dr1 = dtDept.NewRow(); //插一空行 dr1["dep_id"] = ""; dtDept.Rows.InsertAt(dr1, 0); txtDetp_id1.Properties.DataSource = dtDept; txtDetp_id1.Properties.ValueMember = "dep_id"; txtDetp_id1.Properties.DisplayMember = "dep_cdesc"; txtDetp_id2.Properties.DataSource = dtDept; txtDetp_id2.Properties.ValueMember = "dep_id"; txtDetp_id2.Properties.DisplayMember = "dep_cdesc"; }
private void frmBsType_Load(object sender, EventArgs e) { //系統狀態 clsGoodsCode.Set_DropBox_For_State(luestate, DBUtility._language); string sql_group; if (mLanguage == "2") { sql_group = @"SELECT id,english_name as name FROM dbo.bs_type_group order by id"; } else { sql_group = @"SELECT id,name FROM dbo.bs_type_group order by id"; } //組別 dtGroup = clsApp.GetDataTable(sql_group); DataRow row2 = dtGroup.NewRow(); dtGroup.Rows.Add(row2); dtGroup.DefaultView.Sort = "id ASC"; dtGroup = dtGroup.DefaultView.ToTable(); txtgroup_id.Properties.DataSource = dtGroup; txtgroup_id.Properties.ValueMember = "id"; txtgroup_id.Properties.DisplayMember = "name"; }
private void frmBsUnit_Load(object sender, EventArgs e) { //系統狀態 clsGoodsCode.Set_DropBox_For_State(luestate, DBUtility._language); string sql_country; if (DBUtility._language == "2") { sql_country = @"SELECT id,english_name as name FROM dbo.bs_unit_kind"; } else { sql_country = @"SELECT id,name FROM dbo.bs_unit_kind"; } //unit kind dtUnitKind = clsApp.GetDataTable(sql_country); DataRow row1 = dtUnitKind.NewRow();//插一空行 dtUnitKind.Rows.Add(row1); dtUnitKind.DefaultView.Sort = "id ASC"; //排序 dtUnitKind = dtUnitKind.DefaultView.ToTable(); //排序後重新賦值 luekind.Properties.DataSource = dtUnitKind; luekind.Properties.ValueMember = "id"; luekind.Properties.DisplayMember = "name"; Load_Date(); BingDing_Data(); }
private void frmBsMoney_Load(object sender, EventArgs e) { //系統狀態 clsGoodsCode.Set_DropBox_For_State(luestate, DBUtility._language); string sql_country; if (DBUtility._language == "2") { sql_country = @"SELECT id,english_name as name FROM dbo.bs_country where state='0'"; } else { sql_country = @"SELECT id,name FROM dbo.bs_country where state='0'"; } //國家代碼 dtCountry = clsApp.GetDataTable(sql_country); DataRow row1 = dtCountry.NewRow();//插一空行 dtCountry.Rows.Add(row1); dtCountry.DefaultView.Sort = "id ASC"; //排序 dtCountry = dtCountry.DefaultView.ToTable(); //排序後重新賦值 txtCountry_id.Properties.DataSource = dtCountry; txtCountry_id.Properties.ValueMember = "id"; txtCountry_id.Properties.DisplayMember = "name"; Load_Date(); Bingding_Data(); }
private void frmSysPopedomEdit_Load(object sender, EventArgs e) { string strsql = string.Format( @"SELECT A.menu_id,A.menu_parent_id,A.window_id,A.relatively_station,B.[col_name] FROM sys_menu_window A INNER JOIN sys_dictionary B ON A.menu_id=B.col_code WHERE A.co_id='' and A.[language_id]=2 and A.user_id='admin' and Isnull(A.menu_parent_id,'')='' and A.visible='1' and B.[language_id]='{0}' ORDER BY A.relatively_station", lang_id); dtTopMenu = clsApp.GetDataTable(strsql); strsql = string.Format( @"SELECT A.menu_id,A.menu_parent_id,A.window_id,A.relatively_station,B.[col_name] FROM sys_menu_window A INNER JOIN sys_dictionary B ON A.menu_id=B.col_code WHERE A.co_id='' and A.[language_id]=2 and A.user_id='admin' and A.visible='1' and B.[language_id]='{0}' ORDER by A.relatively_station", lang_id); dtAllMenu = clsApp.GetDataTable(strsql); try { if (dtTopMenu.Rows.Count > 0) { InitMenu(); //myTree1.ExpandAll();//展開 //myTree.SelectedNode = myTree.Nodes[0];//選中第上個節點 } else { MessageBox.Show("请先添加超级管理用户[ADMIN],并设置程序菜单!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); myTree.Nodes.Clear(); } } catch { myTree.Nodes.Clear(); } }
private void frmSysPopedom_Load(object sender, EventArgs e) { const string strsql = @"SELECT user_id as group_id,user_name,typeid From sys_user WHERE user_id='ADMIN' AND typeid='U'"; dtGroup = clsApp.GetDataTable(strsql); dt = clsApp.GetDataTable("select * from sys_user"); try { if (dtGroup.Rows.Count > 0) { InitMenu(); myTree.Nodes[0].Expand();//只展開頂層節點 //myTree.SelectedNode = myTree.Nodes[0];//選中第上個節點 } else { MessageBox.Show("请首先添加超级管理用户[ADMIN]!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); myTree.Nodes.Clear(); } } catch { myTree.Nodes.Clear(); } }
private void frmMmFind_Load(object sender, EventArgs e) { //DataTable dtDept = clsCommon.GetDepartment(); //DataRow dr1 = dtDept.NewRow(); //插一空行 //dr1["id"] = ""; //dtDept.Rows.InsertAt(dr1, 0); //txtDetp_id.Properties.DataSource = dtDept; //txtDetp_id.Properties.ValueMember = "id"; //txtDetp_id.Properties.DisplayMember = "english_name"; //管制類型 DataTable dtModality = new DataTable(); if (DBUtility._language == "2") { dtModality = clsApp.GetDataTable(@"SELECT id,english_name as name FROM dbo.cd_goodscode_modality Order by id"); } else { dtModality = clsApp.GetDataTable(@"SELECT id,name FROM dbo.cd_goodscode_modality Order by id"); } cl_modality.DataSource = dtModality; cl_modality.ValueMember = "id"; cl_modality.DisplayMember = "name"; }
private void frmMain_Left_Load(object sender, EventArgs e) { string _user_id = DBUtility._user_id; string strsql, within_code; if (_user_id.ToUpper() == "ADMIN") { //最高管理權限 within_code = ""; strsql = string.Format( @"SELECT A.menu_id,A.menu_parent_id,A.window_id,A.relatively_station,B.[col_name] FROM sys_menu_window A INNER JOIN sys_dictionary B ON A.menu_id=B.col_code WHERE A.co_id='' and A.[language_id]=2 and A.user_id='{0}' and Isnull(A.menu_parent_id,'')='' and A.visible='1' and B.[language_id]='{1}' ORDER BY A.relatively_station", _user_id, lang_id); dtTopMenu = clsApp.GetDataTable(strsql); } else { //普通用戶此字段為非空 within_code = "0000"; SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@within_code", within_code), new SqlParameter("@user_id", _user_id), new SqlParameter("@language_id", lang_id) }; dtTopMenu = clsApp.ExecuteProcedureReturnTable("usp_get_user_menu", paras); } //取出ADMIN用戶(最高管理權限用戶)的菜單模板 strsql = string.Format( @"SELECT A.menu_id,A.menu_parent_id,A.window_id,A.relatively_station,B.[col_name] FROM sys_menu_window A INNER JOIN sys_dictionary B ON A.menu_id=B.col_code WHERE A.co_id='' and A.[language_id]=2 and A.user_id='ADMIN' and A.visible='1' and B.[language_id]='{0}' ORDER by A.relatively_station", lang_id); dtAllMenu = clsApp.GetDataTable(strsql); try { if (dtTopMenu.Rows.Count > 0) { InitMenu(); myTree.ExpandAll(); //展開 myTree.SelectedNode = myTree.Nodes[0]; //選中第上個節點 } else { MessageBox.Show("请首先添加好超级管理用户[ADMIN],并设置程序菜单!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); myTree.Nodes.Clear(); } } catch { myTree.Nodes.Clear(); } }
private void frmSysFuntionMenu_Load(object sender, EventArgs e) { //頂層菜單 string strsql = string.Format( @"SELECT A.menu_id,A.menu_parent_id,A.window_id,A.relatively_station,A.pkey,B.[col_name] FROM sys_menu_window A INNER JOIN sys_dictionary B ON A.menu_id=B.col_code WHERE A.co_id='' and A.[language_id]='2' and A.user_id='{0}' and Isnull(A.menu_parent_id,'')='' and A.visible='1' and B.[language_id]='{1}' and Isnull(status,'0')='0' ORDER BY A.relatively_station", DBUtility._user_id, lang_id); dtTopMenu = clsApp.GetDataTable(strsql); //全部菜單 strsql = string.Format( @"SELECT A.co_id, A.menu_id,Isnull(A.menu_parent_id,'') as menu_parent_id,Isnull(A.window_id,'') as window_id,A.relatively_station,Isnull(A.visible,0) as visible, A.remark,A.createby,A.createdate,A.modifyby,A.modifydate,A.pkey,B.[col_name],A.menu_id+' ['+Isnull(B.col_name,'')+']' AS menu_id_name FROM sys_menu_window A INNER JOIN sys_dictionary B ON A.menu_id=B.col_code WHERE A.co_id='' and A.[language_id]='2' and A.user_id='{0}' and A.visible='1' and B.[language_id]='{1}' and Isnull(status,'0')='0' ORDER by A.relatively_station", DBUtility._user_id, lang_id); dtAllMenu = clsApp.GetDataTable(strsql); try { if (dtTopMenu.Rows.Count > 0) { InitMenu(); //myTree1.ExpandAll();//展開 myTree.Nodes[0].Expand();//只展開頂層節點 //myTree.SelectedNode = myTree.Nodes[0];//選中第上個節點 } else { MessageBox.Show("请先添加超级管理用户[ADMIN],并设置程序菜单!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); myTree.Nodes.Clear(); } } catch { myTree.Nodes.Clear(); } DataTable dtPrent_menu = dtAllMenu.Clone(); DataRow[] arydtr = dtAllMenu.Select("window_id=''"); foreach (DataRow dr in arydtr) { dtPrent_menu.ImportRow(dr); } arydtr = null; dtPrent_menu.DefaultView.Sort = "menu_id ASC"; txtPrent_menu_id.Properties.DataSource = dtPrent_menu; txtPrent_menu_id.Properties.ValueMember = "menu_id"; txtPrent_menu_id.Properties.DisplayMember = "menu_id_name"; }
private void frmDelivery_Load(object sender, EventArgs e) { const string sql_h = @"SELECT * From dbo.delivery_mostly Where 1=0 "; dtMostly = clsApp.GetDataTable(sql_h); myBDS1.DataSource = dtMostly; try { //數據綁定主档 txtID.DataBindings.Add("Text", myBDS1, "id"); dtDelivery_date.DataBindings.Add("EditValue", myBDS1, "delivery_date"); txtcustomer_name.DataBindings.Add("Text", myBDS1, "customer_name"); txtcustomer_address.DataBindings.Add("Text", myBDS1, "customer_address"); txtcompany_id.DataBindings.Add("EditValue", myBDS1, "company_id"); // 绑定需是EditValue,否则将显示长日期格式 txtserial_no.DataBindings.Add("Text", myBDS1, "serial_no"); txtserial_name.DataBindings.Add("Text", myBDS1, "serial_name"); txtamt_sum.DataBindings.Add("Text", myBDS1, "amt_sum"); txtcontact.DataBindings.Add("Text", myBDS1, "contact"); txtcustomer_tel.DataBindings.Add("Text", myBDS1, "customer_tel"); txtcustomer_fax.DataBindings.Add("Text", myBDS1, "customer_fax"); txtState.DataBindings.Add("Text", myBDS1, "state"); txtremark.DataBindings.Add("Text", myBDS1, "remark"); lkeProvince.DataBindings.Add("EditValue", myBDS1, "province"); txtCreate_by.DataBindings.Add("Text", myBDS1, "create_by"); txtCreate_date.DataBindings.Add("Text", myBDS1, "create_date"); txtupdate_by.DataBindings.Add("Text", myBDS1, "update_by"); txtupdate_date.DataBindings.Add("Text", myBDS1, "update_date"); clsState.Set_Province(lkeProvince); //生成明細表結構 const string sql_d = @"Select * From dbo.delivery_details Where 1=0"; dtDetails = clsApp.GetDataTable(sql_d); myBDS2.DataSource = dtDetails; gridControl1.DataSource = myBDS2; txtWeightCost.Text = "25.00"; } catch (Exception E) { throw new Exception(E.Message); } //公司资料 clsState.Set_DropBox_For_Company(txtcompany_id); clsState.Set_DropBox_For_Company(lkecompany_id1); clsState.Set_DropBox_For_Company(lkecompany_id2); //臨時項目刪除表結構 dtTempDel = dtDetails.Clone(); //欄位表頭居中 for (int i = 0; i < dgvDetails.Columns.Count; i++) { dgvDetails.Columns[i].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; } //txtDat1.EditValue = DateTime.Now.ToString("yyyy-MM-dd"); //txtDat2.EditValue = DateTime.Now.ToString("yyyy-MM-dd"); }
private void frmCdGoodsCodeA_Load(object sender, EventArgs e) { Load_Date(); //數據綁定 Set_DataBindings(); //系統狀態 clsGoodsCode.Set_DropBox_For_State(state, DBUtility._language); //管制類型 string sql = @"SELECT id,english_name+'('+ name +')' as name FROM cd_goodscode_modality"; DataTable dtModality = new DataTable(); dtModality = clsApp.GetDataTable(sql); modality.Properties.DataSource = dtModality; modality.Properties.ValueMember = "id"; modality.Properties.DisplayMember = "name"; //log_no.MaxLength = 10; //txtName.textBox.DataBindings.Add("Text", bds1, "name"); //txtTel.textBox.DataBindings.Add("Text", bds1, "tel"); //txtFax.textBox.DataBindings.Add("Text", bds1, "fax"); //txtContact.textBox.DataBindings.Add("Text", bds1, "contact"); //txtContact_tel.textBox.DataBindings.Add("Text", bds1, "contact_tel"); //txtRemark.textBox.DataBindings.Add("Text", bds1, "remark"); //txtCreate_by.textBox.DataBindings.Add("Text", bds1, "create_by"); //txtCreate_date.textBox.DataBindings.Add("Text", bds1, "create_date"); //txtUpdate_by.textBox.DataBindings.Add("Text", bds1, "update_by"); //txtUpdate_date.textBox.DataBindings.Add("Text", bds1, "Update_date"); }
private void Find_Doc(string temp_id) //非新增或編號狀態下帶出的資料 { if (!String.IsNullOrEmpty(temp_id)) { string strsql = String.Format( @"SELECT * FROM dbo.bs_customer Where state='0' order by id ", temp_id); DataTable dt = clsApp.GetDataTable(strsql); dgvDetails.DataSource = dt; if (dt.Rows.Count == 0) { if (mLanguage == "2") { msgCustom = "Customer ID does not exist."; } else { msgCustom = "客戶編號資料不存在!"; } MessageBox.Show(msgCustom, myMsg.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Information); SetObjValue.ClearObjValue(this.Controls, "2"); return; } else { mID = txtid.Text;//保存臨時的ID號 } } }
/// <summary> /// 綁定組別 /// </summary> private void BindGroup() { const string strSql = @" SELECT id,english_name,name FROM dbo.bs_country "; DataTable dtCountry = clsApp.GetDataTable(strSql); luecountry.Properties.DataSource = dtCountry; luecountry.Properties.DisplayMember = "id"; luecountry.Properties.ValueMember = "id"; }
private void frmMaterialType_Load(object sender, EventArgs e) { dgvDetails.AutoGenerateColumns = false; //系統狀態 clsGoodsCode.Set_DropBox_For_State(luestate, DBUtility._language); //原料種類 DataTable dtdatum = clsApp.GetDataTable("SELECT '' as id,'' as name Union Select id,name FROM dbo.bs_type WHERE group_id='L'"); luedatum.Properties.DataSource = dtdatum; luedatum.Properties.ValueMember = "id"; luedatum.Properties.DisplayMember = "name"; dtDetail = clsApp.GetDataTable("Select * From dbo.bs_mat_type Where 1=0"); bds1.DataSource = dtDetail; dgvDetails.DataSource = bds1; Set_DataBindings(); Find_Data(); }
private bool Valid_Doc() //主建是否已存在 { bool flag; string doc = txtID.Text.Trim(); string strSql = String.Format("Select '1' FROM dbo.bs_season WHERE id='{0}'", doc); DataTable dt = clsApp.GetDataTable(strSql); if (dt.Rows.Count > 0) { MessageBox.Show(myMsg.msgIsExists + String.Format("【{0}】", doc), myMsg.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); flag = true; } else { flag = false; } dt.Dispose(); return(flag); }
private void frmProductType_Load(object sender, EventArgs e) { dgvDetails.AutoGenerateColumns = false; //系統狀態 clsGoodsCode.Set_DropBox_For_State(luestate, DBUtility._language); //種類 DataTable dtCategory = clsApp.GetDataTable("SELECT id,name FROM bs_type WHERE group_id='M'"); lueCategory.Properties.DataSource = dtCategory; lueCategory.Properties.ValueMember = "id"; lueCategory.Properties.DisplayMember = "name"; dtDetail = clsApp.GetDataTable("Select * From dbo.bs_product_type Where 1=0"); bds1.DataSource = dtDetail; dgvDetails.DataSource = bds1; Set_DataBindings(); Find_Data(); }
private void btnFind_Click(object sender, EventArgs e) { string ls_sql; if (goods_id.Text == "" && goods_name.Text == "" && goods_name_eng.Text == "") { ls_sql = @"Select TOP 1000 * FROM dbo.it_goods with(nolock) Where state='0'"; } else { ls_sql = @"Select * FROM dbo.it_goods with(nolock) "; if (goods_id.Text != "") { if (!ls_sql.Contains("Where")) { ls_sql += string.Format(" Where id like '%{0}%'", goods_id.Text); } else { ls_sql += string.Format(" and id like '%{0}%'", goods_id.Text); } } if (goods_name.Text != "") { if (ls_sql.Contains("Where")) { ls_sql += string.Format(" and name like '%{0}%'", goods_name.Text); } else { ls_sql += string.Format(" Where name like '%{0}%'", goods_name.Text); } } if (goods_name.Text != "") { if (ls_sql.Contains("Where")) { ls_sql += string.Format(" and english_name like '%{0}%'", goods_name_eng.Text); } else { ls_sql += string.Format(" Where english_name like '%{0}%'", goods_name_eng.Text); } } ls_sql += " and state='0'"; } dtDetail = clsApp.GetDataTable(ls_sql); bds1.DataSource = dtDetail; dgvDetails.DataSource = bds1; if (dtDetail.Rows.Count == 0) { DBUtility.myMessageBox("No data matching the search condition!", mTitle); } tabControl1.SelectedIndex = 0; }
private void frmSysPassword_Load(object sender, EventArgs e) { //string sql = @"SELECT user_id,user_name,password FROM dbo.sys_user WHERE user_id ='" + txtUser_id.Text + "'"; string sql = string.Format(@"SELECT user_id,user_name,password FROM dbo.sys_user WHERE user_id ='{0}'", DBUtility._user_id); DataTable dt = clsApp.GetDataTable(sql); if (dt.Rows.Count > 0) { txtUser_name.Text = dt.Rows[0]["user_name"].ToString(); txtPassword.Text = dt.Rows[0]["password"].ToString(); } }
private void frmCode_Load(object sender, EventArgs e) { //1级资料 DataTable dtLeave1 = clsApp.GetDataTable(@"Select serial_no,name,parent_id From dbo.level1 Order By serial_no"); lueLevel1.Properties.DataSource = dtLeave1; lueLevel1.Properties.ValueMember = "serial_no"; lueLevel1.Properties.DisplayMember = "name"; lueLevel1.EditValue = "44";//默认省份为广东 //2级资料 string strSql = @"Select '' as serial_no,'' as name,'' as parent_id,'' as name_parent Union Select A.serial_no,A.name,A.parent_id ,B.name as name_parent From dbo.levelall A Inner join dbo.levelall B ON A.parent_id=B.serial_no Where A.levels='2'"; DataTable dtLeave2 = clsApp.GetDataTable(strSql); //DataTable dtLeave2 = clsApp.GetDataTable(@"Select serial_no,name,parent_id From dbo.level2 Order By serial_no"); lueLevel2.Properties.DataSource = dtLeave2; lueLevel2.Properties.ValueMember = "serial_no"; lueLevel2.Properties.DisplayMember = "name"; //3级资料 strSql = @"Select '' as serial_no,'' as name,'' as parent_id,'' as name_parent Union Select A.serial_no,A.name,A.parent_id ,B.name as name_parent From dbo.levelall A Inner join dbo.levelall B ON A.parent_id=B.serial_no Where A.levels='3'"; DataTable dtLeave3 = clsApp.GetDataTable(strSql); //DataTable dtLeave3 = clsApp.GetDataTable(@"Select serial_no,name,parent_id From dbo.level3 Order By serial_no"); lueLevel3.Properties.DataSource = dtLeave3; lueLevel3.Properties.ValueMember = "serial_no"; lueLevel3.Properties.DisplayMember = "name"; }
private bool checkExistId(int type) { string clr_grp = txtClr_Grp.Text; if (type == 0) { string strSql = string.Format(" Select clr_grp From mm_color_group Where clr_grp='{0}", clr_grp); DataTable dtId = clsApp.GetDataTable(strSql); if (dtId.Rows.Count > 0) { return(true); } } else if (type == 1) { string strSql = String.Format(" Select clr_grp From mm_color_group_details Where clr_id='{0}'", txtClr_Id.Text); DataTable dtId = clsApp.GetDataTable(strSql); if (dtId.Rows.Count > 0) { return(true); } } return(false); }
private void frmSysUserEdit_Load(object sender, EventArgs e) { cmbInherit_type.Text = "Y"; if (form_type == "E") { txtUser_id.ReadOnly = true; string sql = String.Format(@"SELECT user_id,user_name,password,ava_date,mis_date,createby,createdate,modifyby,modifydate,inherit_type FROM dbo.sys_user WHERE user_id ='{0}'", txtUser_id.Text); DataTable dt = clsApp.GetDataTable(sql); if (dt.Rows.Count > 0) { txtUser_name.Text = dt.Rows[0]["user_name"].ToString(); txtPassword.Text = dt.Rows[0]["password"].ToString(); cmbInherit_type.Text = dt.Rows[0]["inherit_type"].ToString(); mskAva_date.Text = dt.Rows[0]["ava_date"].ToString(); mskMis_date.Text = dt.Rows[0]["mis_date"].ToString(); txtCreateby.Text = dt.Rows[0]["createby"].ToString(); txtCreatedate.Text = dt.Rows[0]["createdate"].ToString(); txtModifyby.Text = dt.Rows[0]["modifyby"].ToString(); txtModifydate.Text = dt.Rows[0]["modifydate"].ToString(); } } else { txtUser_id.ReadOnly = false; txtUser_name.Text = ""; txtPassword.Text = ""; cmbInherit_type.Text = "Y"; mskAva_date.Text = DateTime.Now.Date.ToString("yyyy/MM/dd"); mskMis_date.Text = ""; txtCreateby.Text = DBUtility._user_id;; txtCreatedate.Text = DateTime.Now.Date.ToString("yyyy/MM/dd"); txtModifyby.Text = DBUtility._user_id;; txtModifydate.Text = DateTime.Now.Date.ToString("yyyy/MM/dd"); } }
private void frmBsStockLocation_Load(object sender, EventArgs e) { //狀態 clsGoodsCode.Set_DropBox_For_State(luestate, DBUtility._language); //主表結構 const string ls_mostly = @"SELECT * FROM dbo.bs_productline WHERE 1=0"; dtMostly = clsApp.GetDataTable(ls_mostly); bds_h.DataSource = dtMostly; //生成明細結構 string ls_details = @"SELECT *,id as origin_id FROM dbo.bs_carton_code WHERE 1=0"; dtDetail = clsApp.GetDataTable(ls_details); bds_d.DataSource = dtDetail; gridControl1.DataSource = bds_d; //生成臨時項目刪除表結構 dtTempDel = dtDetail.Clone(); //主表數據綁定 Set_DataBindings(); }
private void frmBsBrand_Load(object sender, EventArgs e) { //系統狀態 clsGoodsCode.Set_DropBox_For_State(luestate, DBUtility._language); dtCountry = clsApp.GetDataTable("SELECT id,name,english_name FROM dbo.bs_country with(nolock) Where state='0'"); DataRow dr1 = dtCountry.NewRow(); //插一空行 dr1["id"] = ""; dtCountry.Rows.InsertAt(dr1, 0); txtOrigin.Properties.DataSource = dtCountry; txtOrigin.Properties.ValueMember = "id"; txtOrigin.Properties.DisplayMember = "id"; dtParentBrand = clsApp.GetDataTable("SELECT id,name,english_name FROM dbo.bs_brand with(nolock) WHERE state='0'"); DataRow dr2 = dtParentBrand.NewRow(); //插一空行 dr2["id"] = ""; dtParentBrand.Rows.InsertAt(dr2, 0); txtParent_id.Properties.DataSource = dtParentBrand; txtParent_id.Properties.ValueMember = "id"; txtParent_id.Properties.DisplayMember = "id"; dtBrand_group = clsApp.GetDataTable("SELECT * FROM dbo.bs_brand_group WHERE 1=0"); dtBrand_office = clsApp.GetDataTable("SELECT * FROM dbo.bs_brand_office WHERE 1=0"); gridControl1.DataSource = dtBrand_group; gridControl2.DataSource = dtBrand_office; //臨時項目刪除表結構 dtGroupDel = dtBrand_group.Clone(); dtOfficeDel = dtBrand_office.Clone(); //組別 dtGroup = clsApp.GetDataTable("SELECT id,name FROM dbo.bs_group WITH(nolock) WHERE state='0'"); DataRow dr3 = dtGroup.NewRow(); //插一空行 dr3["id"] = ""; dtGroup.Rows.InsertAt(dr3, 0); colGroup_id.DataSource = dtGroup; colGroup_id.ValueMember = "id"; colGroup_id.DisplayMember = "name"; //區域 dtArea = clsApp.GetDataTable("SELECT id,name,english_name FROM dbo.bs_area WITH(nolock) WHERE state='0'"); DataRow dr4 = dtArea.NewRow(); //插一空行 dr4["id"] = ""; dtArea.Rows.InsertAt(dr4, 0); colArea_id.DataSource = dtArea; colArea_id.ValueMember = "id"; colArea_id.DisplayMember = "name"; //寫字樓 dtOffice = clsApp.GetDataTable("SELECT id,name FROM dbo.bs_office WITH(nolock) WHERE state='0'"); DataRow dr5 = dtOffice.NewRow(); //插一空行 dr5["id"] = ""; dtOffice.Rows.InsertAt(dr5, 0); colOffice_id.DataSource = dtOffice; colOffice_id.ValueMember = "id"; colOffice_id.DisplayMember = "name"; //聯系人 // dtContact = DBUtility.GetDataTable("SELECT sale_code,sale_cdesc,sale_desc,sale_group FROM dbo.bs_sale WITH(nolock) ORDER BY sale_group,sale_code"); dtContact = clsApp.GetDataTable("SELECT id,(id+'['+ name+']') AS name FROM dbo.bs_sales WITH(nolock) WHERE state='0' ORDER BY sales_group,id"); DataRow dr6 = dtContact.NewRow(); //插一空行 dr6["id"] = ""; dtContact.Rows.InsertAt(dr6, 0); colContact.DataSource = dtContact; colContact.ValueMember = "id"; colContact.DisplayMember = "name"; SetTreeView(); }
private void frmFormula_Load(object sender, EventArgs e) { const string sql_h = @"SELECT * From dbo.formula_mostly Where 1=0 "; dtMostly = clsApp.GetDataTable(sql_h); bds1.DataSource = dtMostly; try { //數據綁定主档 txtID.DataBindings.Add("EditValue", bds1, "id"); txtName.DataBindings.Add("Text", bds1, "name"); txtremark.DataBindings.Add("Text", bds1, "remark"); txtCreate_by.DataBindings.Add("Text", bds1, "create_by"); txtCreate_date.DataBindings.Add("Text", bds1, "create_date"); txtupdate_by.DataBindings.Add("Text", bds1, "update_by"); txtupdate_date.DataBindings.Add("Text", bds1, "update_date"); txtState.DataBindings.Add("Text", bds1, "state"); const string sql_d = @"Select * from dbo.formula_details Where 1=0"; dtDetails = clsApp.GetDataTable(sql_d); bds2.DataSource = dtDetails; gridControl1.DataSource = bds2; //數據綁定明细 txtserial_no.DataBindings.Add("EditValue", bds2, "serial_no"); txtname_d.DataBindings.Add("Text", bds2, "name"); txtminimum_weight.DataBindings.Add("Text", bds2, "minimum_weight"); txtminimum_amt.DataBindings.Add("Text", bds2, "minimum_amt"); txtover_weight_amt.DataBindings.Add("Text", bds2, "over_weight_amt"); txtamt_other.DataBindings.Add("Text", bds2, "amt_other"); chkIs_large.DataBindings.Add("Checked", bds2, "is_large"); txtbegin_qty1.DataBindings.Add("Text", bds2, "begin_qty1"); txtend_qty1.DataBindings.Add("Text", bds2, "end_qty1"); txtamt_rang1.DataBindings.Add("Text", bds2, "amt_rang1"); txtbegin_qty2.DataBindings.Add("Text", bds2, "begin_qty2"); txtend_qty2.DataBindings.Add("Text", bds2, "end_qty2"); txtamt_rang2.DataBindings.Add("Text", bds2, "amt_rang2"); txtbegin_qty3.DataBindings.Add("Text", bds2, "begin_qty3"); txtend_qty3.DataBindings.Add("Text", bds2, "end_qty3"); txtamt_rang3.DataBindings.Add("Text", bds2, "amt_rang3"); txtbegin_qty4.DataBindings.Add("Text", bds2, "begin_qty4"); txtend_qty4.DataBindings.Add("Text", bds2, "end_qty4"); txtamt_rang4.DataBindings.Add("Text", bds2, "amt_rang4"); txtbegin_qty5.DataBindings.Add("Text", bds2, "begin_qty5"); txtend_qty5.DataBindings.Add("Text", bds2, "end_qty5"); txtamt_rang5.DataBindings.Add("Text", bds2, "amt_rang5"); txtbegin_qty6.DataBindings.Add("Text", bds2, "begin_qty6"); txtend_qty6.DataBindings.Add("Text", bds2, "end_qty6"); txtamt_rang6.DataBindings.Add("Text", bds2, "amt_rang6"); txtRemark1.DataBindings.Add("Text", bds2, "remark"); } catch (Exception E) { throw new Exception(E.Message); } //公司资料 DataTable dtCompany = clsApp.GetDataTable(@"Select '' as id,'' as name UNION SELECT id,name From dbo.cd_company Order By id"); txtID.Properties.DataSource = dtCompany; txtID.Properties.ValueMember = "id"; txtID.Properties.DisplayMember = "id"; //生成明細表,附加費表結構 //dtDetails = clsPublicOfCF01.GetDataTable("Select * From dbo.custom_delivery_details Where 1=0"); //gridControl1.DataSource = dtDetails; //臨時項目刪除表結構 dtTempDel = dtDetails.Clone(); //欄位表頭居中 for (int i = 0; i < dgvDetails.Columns.Count; i++) { dgvDetails.Columns[i].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; } txtDat1.EditValue = DateTime.Now.ToString("yyyy-MM-dd"); txtDat2.EditValue = DateTime.Now.ToString("yyyy-MM-dd"); splitContainer1.Panel1Collapsed = true; }
private void frmFormulaList_Load(object sender, EventArgs e) { const string sql_h = @"SELECT * From dbo.formula Where 1=0 "; dtMostly = clsApp.GetDataTable(sql_h); myBds.DataSource = dtMostly; try { //數據綁定主档 txtPkey.DataBindings.Add("Text", myBds, "pkey"); txtID.DataBindings.Add("EditValue", myBds, "id"); txtName.DataBindings.Add("Text", myBds, "name"); txtserial_no.DataBindings.Add("EditValue", myBds, "serial_no"); chkIs_large.DataBindings.Add("Checked", myBds, "is_large"); txtName.DataBindings.Add("Text", myBds, "serial_name"); txtminimum_weight.DataBindings.Add("Text", myBds, "minimum_weight"); txtminimum_amt.DataBindings.Add("Text", myBds, "minimum_amt"); txtover_weight_amt.DataBindings.Add("Text", myBds, "over_weight_amt"); txtamt_other.DataBindings.Add("Text", myBds, "amt_other"); txtbegin_qty1.DataBindings.Add("Text", myBds, "begin_qty1"); txtend_qty1.DataBindings.Add("Text", myBds, "end_qty1"); txtamt_rang1.DataBindings.Add("Text", myBds, "amt_rang1"); txtbegin_qty2.DataBindings.Add("Text", myBds, "begin_qty2"); txtend_qty2.DataBindings.Add("Text", myBds, "end_qty2"); txtamt_rang2.DataBindings.Add("Text", myBds, "amt_rang2"); txtbegin_qty3.DataBindings.Add("Text", myBds, "begin_qty3"); txtend_qty3.DataBindings.Add("Text", myBds, "end_qty3"); txtamt_rang3.DataBindings.Add("Text", myBds, "amt_rang3"); txtbegin_qty4.DataBindings.Add("Text", myBds, "begin_qty4"); txtend_qty4.DataBindings.Add("Text", myBds, "end_qty4"); txtamt_rang4.DataBindings.Add("Text", myBds, "amt_rang4"); txtbegin_qty5.DataBindings.Add("Text", myBds, "begin_qty5"); txtend_qty5.DataBindings.Add("Text", myBds, "end_qty5"); txtamt_rang5.DataBindings.Add("Text", myBds, "amt_rang5"); txtbegin_qty6.DataBindings.Add("Text", myBds, "begin_qty6"); txtend_qty6.DataBindings.Add("Text", myBds, "end_qty6"); txtamt_rang6.DataBindings.Add("Text", myBds, "amt_rang6"); txtremark.DataBindings.Add("Text", myBds, "remark"); txtCreate_by.DataBindings.Add("Text", myBds, "create_by"); txtCreate_date.DataBindings.Add("Text", myBds, "create_date"); txtupdate_by.DataBindings.Add("Text", myBds, "update_by"); txtupdate_date.DataBindings.Add("Text", myBds, "update_date"); txtState.DataBindings.Add("Text", myBds, "state"); } catch (Exception E) { throw new Exception(E.Message); } gridControl1.DataSource = myBds; //公司资料 DataTable dtCompany = clsApp.GetDataTable(@"Select '' as id,'' as name UNION SELECT id,name From dbo.cd_company Order By id"); txtID.Properties.DataSource = dtCompany; txtID.Properties.ValueMember = "id"; txtID.Properties.DisplayMember = "id"; //欄位表頭居中 for (int i = 0; i < dgvDetails.Columns.Count; i++) { dgvDetails.Columns[i].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; } }
private void frmTempReceipt_Load(object sender, EventArgs e) { //狀態 clsGoodsCode.Set_DropBox_For_State(luestate, DBUtility._language); //供應商 DataTable dtVendor = clsCommon.GetVendor(); luevendor_id.Properties.DataSource = dtVendor; luevendor_id.Properties.ValueMember = "id"; luevendor_id.Properties.DisplayMember = "id"; //查詢介面中的供應商 luevendor_id1.Properties.DataSource = dtVendor; luevendor_id1.Properties.ValueMember = "id"; luevendor_id1.Properties.DisplayMember = "id"; luevendor_id2.Properties.DataSource = dtVendor; luevendor_id2.Properties.ValueMember = "id"; luevendor_id2.Properties.DisplayMember = "id"; //開單來源 DataTable dtBbill_Origin = clsCommon.Get_Bill_Origin("PO03"); lueseparate.Properties.DataSource = dtBbill_Origin; lueseparate.Properties.ValueMember = "id"; lueseparate.Properties.DisplayMember = "name"; //部門 clsCommon.Set_Drop_Box_Value(luedepartment_id, DBUtility._language, "bs_department"); //查詢介面中的部門 clsCommon.Set_Drop_Box_Value(luedept_id1, DBUtility._language, "bs_department"); clsCommon.Set_Drop_Box_Value(luedept_id2, DBUtility._language, "bs_department"); //單位 dtUnit = clsCommon.GetUnit(); cl_unit_code.DataSource = dtUnit; cl_unit_code.ValueMember = "id"; cl_unit_code.DisplayMember = "id"; //重量單位 dtSec_Unit = clsCommon.GetSecUnit(); cl_unit_code_sec.DataSource = dtSec_Unit; cl_unit_code_sec.ValueMember = "id"; cl_unit_code_sec.DisplayMember = "id"; //倉庫 cl_location_id.DataSource = clsCommon.GetDepartment(); cl_location_id.ValueMember = "id"; cl_location_id.DisplayMember = "name"; //QC狀態 cl_qc_state.DataSource = clsCommon.Get_Iqc_State(); cl_qc_state.ValueMember = "id"; cl_qc_state.DisplayMember = "name"; //QC結果 cl_qc_result.DataSource = clsCommon.Get_Iqc_Result(); cl_qc_result.ValueMember = "id"; cl_qc_result.DisplayMember = "name"; //主表結構 const string ls_mostly = @"SELECT * FROM dbo.po_receipt_goods_temp WHERE 1=0"; dtMostly = clsApp.GetDataTable(ls_mostly); bds_h.DataSource = dtMostly; //生成明細結構 string ls_details = @"SELECT a.*,b.name as goods_name FROM dbo.po_receipt_details_temp a,it_goods b WHERE 1=0"; dtDetail = clsApp.GetDataTable(ls_details); bds_d.DataSource = dtDetail; gridControl1.DataSource = bds_d; //生成臨時項目刪除表結構 dtTempDel = dtDetail.Clone(); //主表數據綁定 Set_DataBindings(); }
private void frmColor_Load(object sender, EventArgs e) { //系統狀態 clsGoodsCode.Set_DropBox_For_State(luestate, DBUtility._language); string sql_working, sql_group, sql_plate_effect, sql_color_effect, sql_outer_layer; if (str_language == "2") { sql_working = @"SELECT id,english_name as name FROM dbo.bs_working Where kind='C'"; sql_group = @"SELECT id,english_name as name FROM dbo.bs_group"; sql_plate_effect = @"SELECT id,english_name as name FROM dbo.bs_plate_effect"; sql_color_effect = @"Select '' as id,'' as name Union SELECT id,english_name FROM dbo.bs_color_effect"; sql_outer_layer = @"Select '' as id,'' as name Union SELECT id,english_name FROM dbo.bs_outer"; } else { sql_working = @"SELECT id,name FROM dbo.bs_working Where kind='C'"; sql_group = @"SELECT id,name FROM dbo.bs_group"; sql_plate_effect = @"SELECT id,name FROM dbo.bs_plate_effect"; sql_color_effect = @"Select '' as id,'' as name Union SELECT id,name FROM dbo.bs_color_effect"; sql_outer_layer = @"Select '' as id,'' as name Union SELECT id,name FROM dbo.bs_outer"; } //工序代碼 DataTable dtWorking = clsApp.GetDataTable(sql_working); DataRow row1 = dtWorking.NewRow();//插一空行 dtWorking.Rows.Add(row1); dtWorking.DefaultView.Sort = "id ASC"; //排序 dtWorking = dtWorking.DefaultView.ToTable(); //排序後重新賦值 luework_id.Properties.DataSource = dtWorking; luework_id.Properties.ValueMember = "id"; luework_id.Properties.DisplayMember = "name"; //組別 DataTable dtGroup = clsApp.GetDataTable(sql_group); DataRow row2 = dtGroup.NewRow(); dtGroup.Rows.Add(row2); dtGroup.DefaultView.Sort = "id ASC"; dtGroup = dtGroup.DefaultView.ToTable(); luecolor_sale_group.Properties.DataSource = dtGroup; luecolor_sale_group.Properties.ValueMember = "id"; luecolor_sale_group.Properties.DisplayMember = "name"; //電鍍效果 DataTable dtPlate = clsApp.GetDataTable(sql_plate_effect); DataRow row3 = dtPlate.NewRow(); dtPlate.Rows.Add(row3); dtPlate.DefaultView.Sort = "id ASC"; dtPlate = dtPlate.DefaultView.ToTable(); lueple_code.Properties.DataSource = dtPlate; lueple_code.Properties.ValueMember = "id"; lueple_code.Properties.DisplayMember = "name"; //做色效果 DataTable dtColor = clsApp.GetDataTable(sql_color_effect); dtColor.DefaultView.Sort = "id ASC"; dtColor = dtColor.DefaultView.ToTable(); luecolor_code.Properties.DataSource = dtColor; luecolor_code.Properties.ValueMember = "id"; luecolor_code.Properties.DisplayMember = "name"; //外層 DataTable dtOuter = clsApp.GetDataTable(sql_outer_layer); dtOuter.DefaultView.Sort = "id ASC"; dtOuter = dtOuter.DefaultView.ToTable(); lueouter_layer.Properties.DataSource = dtOuter; lueouter_layer.Properties.ValueMember = "id"; lueouter_layer.Properties.DisplayMember = "name"; }