Exemple #1
0
        public int SellGoodsUpdate(getMaihuo tbChGood)
        {
            int intFalg = 0;

            try
            {
                string str_Update = "update SellGoods set ";
                str_Update += "KcID='" + tbChGood.getKcID + "',GoodsID='" + tbChGood.getGoodsID + "',";
                str_Update += "EmpId='" + tbChGood.getEmpId + "',GoodsName='" + tbChGood.getGoodsName + "',SellGoodsNum=" + tbChGood.getSellGoodsNum + ",";
                str_Update += "SellGoodsTime='" + tbChGood.getSellGoodsTime + "',SellPrice=" + tbChGood.getSellPrice + ",";
                str_Update += "SellFalg=" + tbChGood.getSellFalg + "";
                str_Update += " where  SellID= '" + tbChGood.getSellID + "'";

                getSqlConnection getConnection = new getSqlConnection();
                conn    = getConnection.GetCon();
                cmd     = new SqlCommand(str_Update, conn);
                intFalg = cmd.ExecuteNonQuery();
                conn.Dispose();
                return(intFalg);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return(intFalg);
            }
        }
Exemple #2
0
        public int SellGoodsAdd(getMaihuo tbChGood)
        {
            int intFalg = 0;

            try
            {
                string str_Add = "insert into SellGoods values( ";
                str_Add += "'" + tbChGood.getSellID + "','" + tbChGood.getKcID + "','" + tbChGood.getGoodsID + "',";
                str_Add += "'" + tbChGood.getEmpId + "','" + tbChGood.getGoodsName + "'," + tbChGood.getSellGoodsNum + ",";
                str_Add += "'" + tbChGood.getSellGoodsTime + "'," + tbChGood.getSellPrice + ",";
                str_Add += tbChGood.getSellFalg + ")";
                str_Add += "update  KcGoods set KcNum=KcNum-" + tbChGood.getSellGoodsNum + "where KcGoodsName='" + tbChGood.getGoodsName + "'";
                getSqlConnection getConnection = new getSqlConnection();
                conn    = getConnection.GetCon();
                cmd     = new SqlCommand(str_Add, conn);
                intFalg = cmd.ExecuteNonQuery();
                conn.Dispose();
                return(intFalg);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return(intFalg);
            }
        }
Exemple #3
0
        public int JhGoodsAdd(getJinhuo tbGood)
        {
            int intFalg = 0;

            try
            {
                string str_Add = "insert into test values( ";
                str_Add += "'" + tbGood.getGoodsID + "','" + tbGood.getEmpId + "','" + tbGood.getJhCompName + "',";
                str_Add += "'" + tbGood.getDepotName + "','" + tbGood.getGoodsName + "','" + tbGood.getGoodsNum + "',";
                str_Add += "'" + tbGood.getGoodsJhPrice + "',";
                str_Add += "'" + tbGood.getGoodTime + "','" + tbGood.getFalg + "')";

                str_Add += "insert into KcGoods(KcID,KcGoodsName,KcNum,KcDeptName) values( ";
                str_Add += "'" + tbGood.getGoodsID + "','" + tbGood.getGoodsName + "',";
                str_Add += tbGood.getGoodsNum + ",'" + tbGood.getDepotName + "')";
                getSqlConnection getConnection = new getSqlConnection();
                conn    = getConnection.GetCon();
                cmd     = new SqlCommand(str_Add, conn);
                intFalg = cmd.ExecuteNonQuery();
                conn.Dispose();
                return(intFalg);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return(intFalg);
            }
        }
Exemple #4
0
        public SqlDataReader JhGoodsFind(string strObject, int intFalg)
        {
            int    intCount = 0;
            string strSecar = null;

            try
            {
                switch (intFalg)
                {
                case 1:
                    strSecar = "select * from test where GoodsID = '" + strObject + "'";
                    break;

                case 2:
                    strSecar = "select  * from  test";
                    break;
                }
                getSqlConnection getConnection = new getSqlConnection();
                conn = getConnection.GetCon();
                cmd  = new SqlCommand(strSecar, conn);
                hs   = cmd.ExecuteReader();
                return(hs);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());

                return(hs);
            }
        }
Exemple #5
0
        public int CompanyUpDate(getGongsi Company)
        {
            int intFalg = 0;

            try
            {
                string str_Update = "update Company  set ";
                str_Update += "CompanyName='" + Company.getCompanyName + "',CompanyDirector='" + Company.getCompanyDirector + "',";
                str_Update += "CompanyPhone='" + Company.getCompanyPhone + "',CompanyAddress='" + Company.getCompanyAddress + "',";
                str_Update += "Falg='" + Company.getEmpFalg + "' where CompanyID ='" + Company.getCompanyID + "'";


                getSqlConnection getConnection = new getSqlConnection();
                conn    = getConnection.GetCon();
                cmd     = new SqlCommand(str_Update, conn);
                intFalg = cmd.ExecuteNonQuery();
                conn.Dispose();
                return(intFalg);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return(intFalg);
            }
        }
Exemple #6
0
        public void filltProd(object objTreeView, object obimage)
        {
            try
            {
                getSqlConnection getConnection = new getSqlConnection();
                conn = getConnection.GetCon();
                string strSecar = "select * from tb_SellGoods ";
                cmd = new SqlCommand(strSecar, conn);
                hs  = cmd.ExecuteReader();

                if (objTreeView.GetType().ToString() == "System.Windows.Forms.TreeView")
                {
                    System.Windows.Forms.ImageList imlist = (System.Windows.Forms.ImageList)obimage;

                    System.Windows.Forms.TreeView TV = (System.Windows.Forms.TreeView)objTreeView;
                    TV.Nodes.Clear();

                    TV.ImageList = imlist;
                    System.Windows.Forms.TreeNode TN = TV.Nodes.Add("A", "商品销售信息", 0, 1);

                    while (hs.Read())
                    {
                        TreeNode newNode12 = new TreeNode(hs[0].ToString(), 0, 1);
                        newNode12.Nodes.Add("A", hs[4].ToString(), 0, 1);
                        TN.Nodes.Add(newNode12);
                    }
                    hs.Close();
                    TV.ExpandAll();
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
            }
        }
Exemple #7
0
        public int ThGoodsUpdate(getTuihuo tbChGood)
        {
            int intFalg = 0;

            try
            {
                string str_Update = "update tb_ThGoodsInfo set ";
                str_Update += "KcID='" + tbChGood.strKcID + "',GoodsID='" + tbChGood.strGoodsID + "',";
                str_Update += "SellID='" + tbChGood.strSellID + "',EmpId='" + tbChGood.intEmpId + "',ThGoodsName='" + tbChGood.strThGoodsName + "',";
                str_Update += "ThGoodsNum=" + tbChGood.intThGoodsNum + ",ThGoodsTime='" + tbChGood.daThGoodsTime + "',ThGoodsPrice=" + tbChGood.deThGoodsPrice + ",";
                str_Update += "ThHasPay=" + tbChGood.deThHasPay + ",ThNeedPay=" + tbChGood.deThNeedPay + ",ThGoodsResult='" + tbChGood.deThGoodsResult + "' where  ThGoodsID='" + tbChGood.strThGoodsID + "'";


                getSqlConnection getConnection = new getSqlConnection();
                conn    = getConnection.GetCon();
                cmd     = new SqlCommand(str_Update, conn);
                intFalg = cmd.ExecuteNonQuery();
                conn.Dispose();
                return(intFalg);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return(intFalg);
            }
        }
Exemple #8
0
        public SqlDataReader EmpInfoFind(string strObject, int intFalg)
        {
            int    intCount = 0;
            string strSecar = null;

            try
            {
                switch (intFalg)
                {
                case 1:
                    strSecar = "select * from EmpIoy where EmpId= '" + strObject + "' and EmpFalg=0";
                    break;

                case 2:
                    strSecar = "select * from EmpIoy where EmpFalg=0";
                    break;
                }
                strSecar = "select * from EmpIoy where EmpId= '" + strObject + "' and EmpFalg=0";

                getSqlConnection getConnection = new getSqlConnection();
                conn = getConnection.GetCon();
                cmd  = new SqlCommand(strSecar, conn);

                hs = cmd.ExecuteReader();


                return(hs);
            }
            catch (Exception ee)
            {
                return(hs);
            }
        }
Exemple #9
0
        public void KcGoodsFind(object DataObject)
        {
            int    intCount = 0;
            string strSecar = null;

            try
            {
                strSecar = "select * from KcGoods";
                getSqlConnection getConnection = new getSqlConnection();
                conn = getConnection.GetCon();
                cmd  = new SqlCommand(strSecar, conn);
                int ii = 0;
                hs = cmd.ExecuteReader();
                while (hs.Read())
                {
                    ii++;
                }
                hs.Close();


                System.Windows.Forms.DataGridView dv = (DataGridView)DataObject;

                if (ii != 0)
                {
                    int i = 0;
                    dv.RowCount = ii;
                    hs          = cmd.ExecuteReader();
                    while (hs.Read())
                    {
                        dv[0, i].Value = hs[0].ToString();
                        dv[1, i].Value = hs[1].ToString();
                        dv[2, i].Value = hs[2].ToString();
                        dv[3, i].Value = hs[3].ToString();
                        i++;
                    }
                    hs.Close();
                }
                else
                {
                    if (dv.RowCount != 0)
                    {
                        int i = 0;
                        do
                        {
                            dv[0, i].Value = "";
                            dv[1, i].Value = "";
                            dv[2, i].Value = "";
                            dv[3, i].Value = "";
                            i++;
                        } while (i < dv.RowCount);
                    }
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
            }
        }
Exemple #10
0
        public int KcGoodsDelete(getKucun KcGoods)
        {
            int intFalg = 0;

            try
            {
                string           str_Del       = "delete from KcGoods  where KcID='" + KcGoods.getKcID + "'";
                getSqlConnection getConnection = new getSqlConnection();
                conn    = getConnection.GetCon();
                cmd     = new SqlCommand(str_Del, conn);
                intFalg = cmd.ExecuteNonQuery();
                conn.Dispose();
                return(intFalg);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return(intFalg);
            }
        }
Exemple #11
0
        public int EmpInfoDelete(getZhigong Empinfo)
        {
            int intFalg = 0;

            try
            {
                string str_Del = "update EmpIoy set ";
                str_Del += "EmpFalg='" + Empinfo.getEmpFalg + "' where  EmpId='" + Empinfo.getEmpId + "'";
                getSqlConnection getConnection = new getSqlConnection();
                conn    = getConnection.GetCon();
                cmd     = new SqlCommand(str_Del, conn);
                intFalg = cmd.ExecuteNonQuery();
                conn.Dispose();
                return(intFalg);
            }
            catch (Exception ee)
            {
                return(intFalg);
            }
        }
Exemple #12
0
        }// end if

        #endregion
        #region  除
        public int ThGoodsDelete(string striThid)
        {
            int intFalg = 0;

            try
            {
                string           str_Del       = "delete from tb_thgoodsinfo  where ThGoodsID='" + striThid + "'";
                getSqlConnection getConnection = new getSqlConnection();
                conn    = getConnection.GetCon();
                cmd     = new SqlCommand(str_Del, conn);
                intFalg = cmd.ExecuteNonQuery();
                conn.Dispose();
                return(intFalg);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return(intFalg);
            }
        }
Exemple #13
0
        public SqlDataReader SellGoodsFind(string DataObject)
        {
            string strSecar = null;

            try
            {
                strSecar = "select * from SellGoods where SellID='" + DataObject + "'";

                getSqlConnection getConnection = new getSqlConnection();
                conn = getConnection.GetCon();
                cmd  = new SqlCommand(strSecar, conn);

                hs = cmd.ExecuteReader();
                return(hs);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return(hs);
            }
        }
Exemple #14
0
        public int JhGoodsDelete(getJinhuo tbGood)
        {
            int intFalg = 0;

            try
            {
                string str_Del = "delete from test where GoodsID ='" + tbGood.getGoodsID + "'";
                str_Del += "delete from KcGoods where KcGoodsName = '" + tbGood.getGoodsName + "'";
                getSqlConnection getConnection = new getSqlConnection();
                conn    = getConnection.GetCon();
                cmd     = new SqlCommand(str_Del, conn);
                intFalg = cmd.ExecuteNonQuery();
                conn.Dispose();
                return(intFalg);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return(intFalg);
            }
        }
Exemple #15
0
        public int CompanyAdd(getGongsi Company)
        {
            int intFalg = 0;

            try
            {
                string str_Add = "insert into Company values( ";
                str_Add += "'" + Company.getCompanyID + "','" + Company.getCompanyName + "','" + Company.getCompanyDirector + "',";
                str_Add += "'" + Company.getCompanyPhone + "','" + Company.getCompanyAddress + "',";
                str_Add += "'" + Company.getEmpFalg + "')";
                getSqlConnection getConnection = new getSqlConnection();
                conn    = getConnection.GetCon();
                cmd     = new SqlCommand(str_Add, conn);
                intFalg = cmd.ExecuteNonQuery();
                conn.Dispose();
                return(intFalg);
            }
            catch (Exception ee)
            {
                return(intFalg);
            }
        }
Exemple #16
0
        public int KcGoodsAdd(getKucun kcGood)
        {
            int intFalg = 0;

            try
            {
                string str_Add = "insert into KcGoods(KcID,KcGoodsName,KcNum,KcDeptName) values( ";
                str_Add += "'" + kcGood.getKcID + "','" + kcGood.getKcGoodsName + "',";
                str_Add += "'" + kcGood.getKcNum + "','" + kcGood.getKcDeptName + "')";
                getSqlConnection getConnection = new getSqlConnection();
                conn    = getConnection.GetCon();
                cmd     = new SqlCommand(str_Add, conn);
                intFalg = cmd.ExecuteNonQuery();
                conn.Dispose();
                return(intFalg);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return(intFalg);
            }
        }
Exemple #17
0
        public int KcGoodsUpdate(string kcGood, int striID)
        {
            int intFalg = 0;

            try
            {
                string str_Update = "update KcGoods set  ";
                str_Update += "KcAlarmNum=" + striID + " ";
                str_Update += " where GoodsID ='" + kcGood + "'";
                getSqlConnection getConnection = new getSqlConnection();
                conn    = getConnection.GetCon();
                cmd     = new SqlCommand(str_Update, conn);
                intFalg = cmd.ExecuteNonQuery();
                conn.Dispose();
                return(intFalg);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return(intFalg);
            }
        }
Exemple #18
0
        public SqlDataReader JhGoodsInfoFind(string strObject)
        {
            int    intCount = 0;
            string strSecar = null;

            try
            {
                strSecar = "select * from tb_thgoodsinfo  where thGoodsid= '" + strObject + "'";


                getSqlConnection getConnection = new getSqlConnection();
                conn = getConnection.GetCon();
                cmd  = new SqlCommand(strSecar, conn);
                hs   = cmd.ExecuteReader();
                return(hs);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return(hs);
            }
        }
Exemple #19
0
        public int KcGoodsUpdate(getKucun kcGood)
        {
            int intFalg = 0;

            try
            {
                string str_Update = "update KcGoods set ";
                str_Update += "KcID='" + kcGood.getKcID + "',KcGoodsName='" + kcGood.getKcGoodsName + "',";
                str_Update += "KcNum='" + kcGood.getKcNum + "',KcDeptName='" + kcGood.getKcDeptName + "' where KcID='" + kcGood.getKcID + "'";
                getSqlConnection getConnection = new getSqlConnection();
                conn    = getConnection.GetCon();
                cmd     = new SqlCommand(str_Update, conn);
                intFalg = cmd.ExecuteNonQuery();
                conn.Dispose();
                return(intFalg);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return(intFalg);
            }
        }
Exemple #20
0
        public SqlDataReader CompanyFind(string strObject)
        {
            string strSecar = null;

            try
            {
                strSecar = "select * from Company  where CompanyID =  '" + strObject + "' and Falg= 0";


                getSqlConnection getConnection = new getSqlConnection();
                conn = getConnection.GetCon();
                cmd  = new SqlCommand(strSecar, conn);
                int ii = 0;
                hs = cmd.ExecuteReader();
                return(hs);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());

                return(hs);
            }
        }
Exemple #21
0
        public int CompanyDelete(getGongsi Company)
        {
            int intFalg = 0;

            try
            {
                string str_Del = "update Company  set ";
                str_Del += "Falg='" + Company.getEmpFalg + "' where CompanyID ='" + Company.getCompanyID + "'";


                getSqlConnection getConnection = new getSqlConnection();
                conn    = getConnection.GetCon();
                cmd     = new SqlCommand(str_Del, conn);
                intFalg = cmd.ExecuteNonQuery();
                conn.Dispose();
                return(intFalg);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return(intFalg);
            }
        }
Exemple #22
0
        public int EmpInfoFind(string strObject, string pwwd, int intFalg)
        {
            int    intCount = 0;
            string strSecar = null;

            try
            {
                switch (intFalg)
                {
                case 1:
                    strSecar = "select * from EmpIoy where EmpLoginName= '" + strObject + "' and EmpFalg=0";
                    break;

                case 2:
                    strSecar = "select * from EmpIoy where EmpLoginName= '" + strObject + "' and EmpFalg=0 and EmpLoginPwd='" + pwwd + "'";
                    break;
                }

                getSqlConnection getConnection = new getSqlConnection();
                conn = getConnection.GetCon();
                cmd  = new SqlCommand(strSecar, conn);
                hs   = cmd.ExecuteReader();
                hs.Read();
                if (hs.HasRows)
                {
                    intCount = 1;
                }


                return(intCount);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message.ToString());
                return(intCount = 2);
            }
        }
Exemple #23
0
        public int EmpInfoAdd(getZhigong Empinfo)
        {
            int intFalg = 0;

            try
            {
                string str_Add = "insert into EmpIoy values( ";
                str_Add += " '" + Empinfo.getEmpId + "','" + Empinfo.getEmpName + "','" + Empinfo.getEmpLoginName + "',";
                str_Add += " '" + Empinfo.getEmpLoginPwd + "','" + Empinfo.getEmpSex + "','" + Empinfo.getEmpBirthday + "',";
                str_Add += " '" + Empinfo.getEmpPhone + "',";
                str_Add += Empinfo.getEmpFalg + ")";
                getSqlConnection getConnection = new getSqlConnection();
                conn    = getConnection.GetCon();
                cmd     = new SqlCommand(str_Add, conn);
                intFalg = cmd.ExecuteNonQuery();
                conn.Dispose();
                return(intFalg);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return(intFalg);
            }
        }
Exemple #24
0
        public int EmpInfoUpdate(getZhigong Empinfo)
        {
            int intFalg = 0;

            try
            {
                string str_Update = "update EmpIoy set ";
                str_Update += "EmpName='" + Empinfo.getEmpName + "',EmpLoginName='" + Empinfo.getEmpLoginName + "',";
                str_Update += "EmpLoginPwd='" + Empinfo.getEmpLoginPwd + "',EmpSex='" + Empinfo.getEmpSex + "',EmpBirthday='" + Empinfo.getEmpBirthday + "',";
                str_Update += "EmpPhone='" + Empinfo.getEmpPhone + "',";
                str_Update += "EmpFalg=" + Empinfo.getEmpFalg + " where  EmpId='" + Empinfo.getEmpId + "'";
                getSqlConnection getConnection = new getSqlConnection();
                conn    = getConnection.GetCon();
                cmd     = new SqlCommand(str_Update, conn);
                intFalg = cmd.ExecuteNonQuery();
                conn.Dispose();
                return(intFalg);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return(intFalg);
            }
        }
Exemple #25
0
        public int ThGoodsAdd(getTuihuo tbChGood)
        {
            int intFalg = 0;

            try
            {
                string str_Add = "insert into tb_ThGoodsInfo values( ";
                str_Add += "'" + tbChGood.strThGoodsID + "','" + tbChGood.strKcID + "','" + tbChGood.strGoodsID + "',";
                str_Add += "'" + tbChGood.strSellID + "','" + tbChGood.intEmpId + "','" + tbChGood.strThGoodsName + "',";
                str_Add += "" + tbChGood.intThGoodsNum + ",'" + tbChGood.daThGoodsTime + "'," + tbChGood.deThGoodsPrice + ",";
                str_Add += "" + tbChGood.deThHasPay + "," + tbChGood.deThNeedPay + ",'" + tbChGood.deThGoodsResult + "')";
                getSqlConnection getConnection = new getSqlConnection();
                conn    = getConnection.GetCon();
                cmd     = new SqlCommand(str_Add, conn);
                intFalg = cmd.ExecuteNonQuery();
                conn.Dispose();
                return(intFalg);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return(intFalg);
            }
        }
Exemple #26
0
        public int JhGoodsUpdate(getJinhuo tbGood)
        {
            int intFalg = 0;

            try
            {
                string str_Update = "update test set ";
                str_Update += "EmpId='" + tbGood.getEmpId + "',JhCompName='" + tbGood.getJhCompName + "',";
                str_Update += "DepotName='" + tbGood.getDepotName + "',GoodsName='" + tbGood.getGoodsName + "',GoodsNum='" + tbGood.getGoodsNum + "',";
                str_Update += "GoodsJhPrice=" + tbGood.getGoodsJhPrice + ",";
                str_Update += "GoodTime='" + tbGood.getGoodTime + "',Falg='" + tbGood.getFalg + "' where GoodsID ='" + tbGood.getGoodsID + "'";
                getSqlConnection getConnection = new getSqlConnection();
                conn    = getConnection.GetCon();
                cmd     = new SqlCommand(str_Update, conn);
                intFalg = cmd.ExecuteNonQuery();
                conn.Dispose();
                return(intFalg);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return(intFalg);
            }
        }
Exemple #27
0
        public int SellGoodsDelete(getMaihuo tbChGood)
        {
            int intFalg = 0;

            try
            {
                string str_Del = "update SellGoods set ";

                str_Del += "SellFalg=" + tbChGood.getSellFalg + "";
                str_Del += " where  SellID= '" + tbChGood.getSellID + "'";

                getSqlConnection getConnection = new getSqlConnection();
                conn    = getConnection.GetCon();
                cmd     = new SqlCommand(str_Del, conn);
                intFalg = cmd.ExecuteNonQuery();
                conn.Dispose();
                return(intFalg);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return(intFalg);
            }
        }
Exemple #28
0
        public void JhGoodsFind(string strObject, int intFalg, Object DataObject)
        {
            int    intCount = 0;
            string strSecar = null;

            try
            {
                switch (intFalg)
                {
                case 1:
                    strSecar = "select * from test where GoodsID like  '%" + strObject + "%' ";
                    break;

                case 2:
                    strSecar = "select  * from  test  where GoodsName like '%" + strObject + "%'";
                    break;

                case 5:
                    strSecar = "select * from test";
                    break;
                }
                getSqlConnection getConnection = new getSqlConnection();
                conn = getConnection.GetCon();
                cmd  = new SqlCommand(strSecar, conn);
                int ii = 0;
                hs = cmd.ExecuteReader();
                while (hs.Read())
                {
                    ii++;
                }
                hs.Close();


                System.Windows.Forms.DataGridView dv = (DataGridView)DataObject;

                if (ii != 0)
                {
                    int i = 0;
                    dv.RowCount = ii;
                    hs          = cmd.ExecuteReader();
                    while (hs.Read())
                    {
                        dv[0, i].Value = hs[0].ToString();
                        dv[1, i].Value = hs[4].ToString();
                        dv[2, i].Value = hs[2].ToString();
                        dv[3, i].Value = hs[3].ToString();
                        dv[4, i].Value = hs[5].ToString();
                        dv[5, i].Value = hs[6].ToString();
                        i++;
                    }
                    hs.Close();
                }
                else
                {
                    if (dv.RowCount != 0)
                    {
                        int i = 0;
                        do
                        {
                            dv[0, i].Value = "";
                            dv[1, i].Value = "";
                            dv[2, i].Value = "";
                            dv[3, i].Value = "";
                            dv[4, i].Value = "";
                            dv[5, i].Value = "";
                            i++;
                        } while (i < dv.RowCount);
                    }
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
            }
        }
Exemple #29
0
        public void EmpInfoFind(string strObject, int intFalg, Object DataObject)
        {
            int    intCount = 0;
            string strSecar = null;

            try
            {
                switch (intFalg)
                {
                case 1:
                    strSecar = "select * from EmpIoy where EmpName like  '%" + strObject + "%' and EmpFalg=0";
                    break;

                case 2:

                    strSecar = "select  * from  EmpIoy  where  EmpSex  = '" + strObject + "' and EmpFalg=0";
                    break;

                case 3:
                    strSecar = "select * from EmpIoy where EmpDept like '%" + strObject + "%' and EmpFalg=0";
                    break;

                case 4:
                    strSecar = "select * from EmpIoy where EmpPost like '%" + strObject + "%' and EmpFalg=0";
                    break;

                case 5:
                    strSecar = "select * from EmpIoy where EmpFalg=0";
                    break;
                }
                getSqlConnection getConnection = new getSqlConnection();
                conn = getConnection.GetCon();
                cmd  = new SqlCommand(strSecar, conn);
                int ii = 0;
                hs = cmd.ExecuteReader();
                while (hs.Read())
                {
                    ii++;
                }
                hs.Close();
                System.Windows.Forms.DataGridView dv = (DataGridView)DataObject;
                if (ii != 0)
                {
                    int i = 0;
                    dv.RowCount = ii;
                    hs          = cmd.ExecuteReader();
                    while (hs.Read())
                    {
                        dv[0, i].Value = hs[0].ToString();
                        dv[1, i].Value = hs[1].ToString();
                        dv[2, i].Value = hs[4].ToString();
                        dv[3, i].Value = hs[6].ToString();
                        dv[4, i].Value = hs[5].ToString();
                        i++;
                    }
                    hs.Close();
                }
                else
                {
                    for (int i = 0; i < dv.RowCount; i++)
                    {
                        dv[0, i].Value = "";
                        dv[1, i].Value = "";
                        dv[2, i].Value = "";
                        dv[3, i].Value = "";
                        dv[4, i].Value = "";
                    }
                }
            }
            catch (Exception ee)
            {
            }
        }
Exemple #30
0
        public void CompanyFind(string strObject, int intFalg, Object DataObject)
        {
            int    intCount = 0;
            string strSecar = null;

            try
            {
                switch (intFalg)
                {
                case 1:
                    strSecar = "select * from Company  where CompanyName like  '%" + strObject + "%' and Falg= 0";
                    break;

                case 2:

                    strSecar = "select * from Company  where CompanyDirector like '%" + strObject + "%' and Falg= 0";
                    break;

                case 3:
                    strSecar = "select * from Company  where Falg= 0";
                    break;
                }
                getSqlConnection getConnection = new getSqlConnection();
                conn = getConnection.GetCon();
                cmd  = new SqlCommand(strSecar, conn);
                int ii = 0;
                hs = cmd.ExecuteReader();
                while (hs.Read())
                {
                    ii++;
                }
                hs.Close();
                System.Windows.Forms.DataGridView dv = (DataGridView)DataObject;

                if (ii != 0)
                {
                    int i = 0;
                    dv.RowCount = ii;
                    hs          = cmd.ExecuteReader();
                    while (hs.Read())
                    {
                        dv[0, i].Value = hs[0].ToString();
                        dv[1, i].Value = hs[1].ToString();
                        dv[2, i].Value = hs[2].ToString();
                        dv[3, i].Value = hs[3].ToString();
                        dv[4, i].Value = hs[4].ToString();
                        i++;
                    }
                    hs.Close();
                }
                else
                {
                    for (int i = 0; i < dv.RowCount; i++)
                    {
                        dv[0, i].Value = "";
                        dv[1, i].Value = "";
                        dv[2, i].Value = "";
                        dv[3, i].Value = "";
                        dv[4, i].Value = "";
                    }
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
            }
        }