Esempio n. 1
0
        protected void SupplierBtnClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            string strSQL = "select F_ID,F_Name from t_Supplier";

            DataLib.DataHelper myHelper = new DataLib.DataHelper();
            DataSet            ds       = myHelper.GetDs(strSQL);

            myControl.frmDataList myDataList = new myControl.frmDataList();

            myDataList.gcQuery.DataSource = ds.Tables[0].DefaultView;
            myDataList.keyField           = "F_ID";
            myDataList.DisplayField       = "F_Name";
            myDataList.gvQuery.Columns.ColumnByFieldName("F_ID").Caption   = "编码";
            myDataList.gvQuery.Columns.ColumnByFieldName("F_ID").Width     = 100;
            myDataList.gvQuery.Columns.ColumnByFieldName("F_Name").Caption = "名称";
            myDataList.gvQuery.Columns.ColumnByFieldName("F_Name").Width   = 150;

            if (myDataList.ShowDialog() == DialogResult.OK)
            {
                DataRow dr    = myDataList.gvQuery.GetDataRow(myDataList.gvQuery.FocusedRowHandle);
                DataRow drDes = gvBase.GetDataRow(gvBase.FocusedRowHandle);
                drDes["F_SupplierID"] = dr["F_ID"];
                drDes["F_Supplier"]   = dr["F_Name"];
                gvBase.UpdateCurrentRow();
            }
            myDataList.Dispose();
        }
Esempio n. 2
0
        private void sbSel_Click(object sender, EventArgs e)
        {
            myControl.frmDataList F        = new myControl.frmDataList();
            DataLib.DataHelper    myHelper = new DataLib.DataHelper();
            DataSet ds = myHelper.GetDs("select F_ID,F_Name,(case isnull(F_Login,0) when 0 then '离线' else '在线' end) as F_Flag from t_User");

            F.gcQuery.DataSource = ds.Tables[0].DefaultView;
            F.keyField           = "F_ID";
            F.DisplayField       = "F_Name";
            F.gvQuery.Columns["F_ID"].Caption      = "用户编码";
            F.gvQuery.Columns["F_Name"].Caption    = "用户名称";
            F.gvQuery.Columns["F_Flag"].Caption    = "状态";
            F.gvQuery.OptionsSelection.MultiSelect = true;
            if (F.ShowDialog() == DialogResult.OK)
            {
                int[] iRows = F.gvQuery.GetSelectedRows();

                foreach (int i in iRows)
                {
                    DataRow dr    = F.gvQuery.GetDataRow(i);
                    DataRow drEmp = ((DataRowView)binEmp.AddNew()).Row;
                    drEmp["Aid"]       = ((DataRowView)binData.Current).Row["Aid"];
                    drEmp["F_EmpID"]   = dr["F_ID"];
                    drEmp["F_EmpName"] = dr["F_Name"];
                }
                binEmp.EndEdit();
            }
            F.Dispose();
        }
Esempio n. 3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            myControl.frmDataList myDataList = new myControl.frmDataList();
            DataLib.DataHelper    myHelper   = new DataLib.DataHelper();
            DataSet ds = myHelper.GetDs("select a.F_ID,a.F_Name,b.F_Name as F_Dept,dbo.fn_GetPy(a.F_Name) as F_Spell from t_Emp a left join t_Class b on a.F_Type = b.F_ID");

            myDataList.gcQuery.DataSource = ds.Tables[0].DefaultView;
            myDataList.strDisplayCaption  = "员工编号,员工名称,部门,拼音码";
            myDataList.keyField           = "F_ID";
            myDataList.DisplayField       = "F_Name";
            myDataList.sbNew.Visible      = false;
            myDataList.gvQuery.OptionsSelection.MultiSelect = true;
            if (myDataList.ShowDialog() == DialogResult.OK)
            {
                int[] Rows = myDataList.gvQuery.GetSelectedRows();

                DataTable dt = (DataTable)gridEmp.DataSource;
                foreach (int i in Rows)
                {
                    DataRow dr = myDataList.gvQuery.GetDataRow(i);
                    if (dt.Select("F_ID = '" + dr["F_ID"].ToString() + "'").Length > 0)
                    {
                        continue;
                    }
                    DataRow drNew = dt.NewRow();
                    drNew["F_ID"]   = dr["F_ID"];
                    drNew["F_Name"] = dr["F_Name"];
                    drNew["F_Dept"] = dr["F_Dept"];
                    dt.Rows.Add(drNew);
                }
            }
            myDataList.Dispose();
        }
Esempio n. 4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string    strSQL = "select F_ID,F_Name from t_Emp";
            DataTable dt     = ((DataView)gcEmp.DataSource).Table;

            DataLib.DataHelper myHelper = new DataLib.DataHelper();
            DataSet            ds       = myHelper.GetDs(strSQL);

            myControl.frmDataList F = new myControl.frmDataList();
            F.sbNew.Visible      = false;
            F.gcQuery.DataSource = ds.Tables[0].DefaultView;
            if (F.ShowDialog() == DialogResult.OK)
            {
                DataRow dr    = F.gvQuery.GetDataRow(F.gvQuery.FocusedRowHandle);
                DataRow drNew = dt.NewRow();
                drNew["F_EmpID"] = dr["F_ID"];
                drNew["F_Name"]  = dr["F_Name"];
                dt.Rows.Add(drNew);
            }
            F.Dispose();
        }