Beispiel #1
0
        public string SelPorceLainSerialNum()
        {
            int    intYear   = DateTime.Now.Year;
            int    intMonth  = DateTime.Now.Month;
            int    intDate   = DateTime.Now.Day;
            int    intHour   = DateTime.Now.Hour;
            int    intSecond = DateTime.Now.Second;
            int    intMinute = DateTime.Now.Minute;
            string strTime   = null;

            strTime += "SP-";
            strTime += intYear.ToString();
            strTime += intMonth < 10 ? "0" + intMonth.ToString() : intMonth.ToString();
            string selnum = "SELECT top 1 RIGHT(PlSerialNum,6) FROM SelPorcelain where  LEFT(PlSerialNum,9)='" + strTime + "' order by PlSerialNum desc";

            //getSqlConnection getConnection = new getSqlConnection();
            conn = Dbconnection.Dblink();
            conn.Open();
            cmd = new SqlCommand(selnum, conn);
            int    maxNum    = 1;
            string strMaxnum = "";

            qlddr = cmd.ExecuteReader();
            if (qlddr.Read())
            {
                maxNum = Convert.ToInt32(qlddr.GetString(0)) + 1;
            }
            if (maxNum > 0 && maxNum < 10)
            {
                strMaxnum = "00000" + maxNum;
            }
            else if (maxNum >= 10 && maxNum < 100)
            {
                strMaxnum = "0000" + maxNum;
            }
            else if (maxNum >= 100 && maxNum < 1000)
            {
                strMaxnum = "000" + maxNum;
            }
            else if (maxNum >= 1000 && maxNum < 10000)
            {
                strMaxnum = "00" + maxNum;
            }
            else if (maxNum >= 10000 && maxNum < 100000)
            {
                strMaxnum = "0" + maxNum;
            }
            else
            {
                strMaxnum = Convert.ToString(maxNum);
            }
            qlddr.Close();

            return(strTime + strMaxnum);
        }
Beispiel #2
0
        }// end if

        #endregion

        static Boolean isGm(string _id)
        {
            Boolean      result = false;
            Dbconnection db     = new Dbconnection();
            string       sql    = "select empfalg from tb_empinfo where empid='" + _id + "'";

            if (db.ExeInfochange(sql) != 0)
            {
                result = true;
            }
            return(result);
        }
Beispiel #3
0
        public int WareInOutFind(string strObject, string pwwd, int intFalg)
        {
            int    intCount = 0;
            string strSecar = null;

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

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


                conn = Dbconnection.Dblink();
                conn.Open();
                cmd = new SqlCommand(strSecar, conn);

                qlddr = cmd.ExecuteReader();
                qlddr.Read();
                if (qlddr.HasRows)
                {
                    intCount = 1;
                }


                return(intCount);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message.ToString());
                return(intCount = 2);
            }
        }
Beispiel #4
0
        public string WareInOutSerialNum(int _FTYPE)
        {
            int    intYear   = DateTime.Now.Year;
            int    intMonth  = DateTime.Now.Month;
            int    intDate   = DateTime.Now.Day;
            int    intHour   = DateTime.Now.Hour;
            int    intSecond = DateTime.Now.Second;
            int    intMinute = DateTime.Now.Minute;
            string strTime   = null;

            if (_FTYPE == 0)
            {
                strTime += "RK-";
            }
            else
            {
                strTime += "CK-";
            }
            strTime += intYear.ToString();
            string selnum = "SELECT top 1 RIGHT(FSerialNum,6) FROM WareInOut where FTYPE = " + _FTYPE + " AND LEFT(FSerialNum,7)='" + strTime + "' order by FSerialNum desc";

            //getSqlConnection getConnection = new getSqlConnection();
            conn = Dbconnection.Dblink();
            conn.Open();
            cmd = new SqlCommand(selnum, conn);
            int    maxNum    = 1;
            string strMaxnum = "";

            qlddr = cmd.ExecuteReader();
            if (qlddr.Read())
            {
                maxNum = Convert.ToInt32(qlddr.GetString(0)) + 1;
            }
            if (maxNum > 0 && maxNum < 10)
            {
                strMaxnum = "00000" + maxNum;
            }
            else if (maxNum >= 10 && maxNum < 100)
            {
                strMaxnum = "0000" + maxNum;
            }
            else if (maxNum >= 100 && maxNum < 1000)
            {
                strMaxnum = "000" + maxNum;
            }
            else if (maxNum >= 1000 && maxNum < 10000)
            {
                strMaxnum = "00" + maxNum;
            }
            else if (maxNum >= 10000 && maxNum < 100000)
            {
                strMaxnum = "0" + maxNum;
            }
            else
            {
                strMaxnum = Convert.ToString(maxNum);
            }
            qlddr.Close();

            /* if (intHour < 10)
             * {
             *   strTime += "0" + intHour.ToString();
             * }
             * else
             * {
             *   strTime += intHour.ToString();
             * }
             * if (intMinute < 10)
             * {
             *
             *   strTime += "0" + intMinute.ToString();
             * }
             * else
             * {
             *   strTime += intMinute.ToString();
             * }
             * if (intSecond < 10)
             * {
             *
             *   strTime += "0" + intSecond.ToString();
             * }
             * else
             * {
             *   strTime += intSecond.ToString();
             * }
             */
            return(strTime + strMaxnum);
        }