예제 #1
0
        public static string GetNewPid()
        {
            string    strCID    = "";
            string    strYMD    = DateTime.Now.ToString("yyyyMMdd");
            string    strSelPID = "select * from PurchaseApplication where DateRecord='" + strYMD + "'";
            DataTable dtPMaxID  = SQLBase.FillTable(strSelPID, "MainPP");
            int       intNewID  = 0;

            if (dtPMaxID == null)
            {
                return(strCID);
            }
            if (dtPMaxID.Rows.Count == 0)
            {
                string strInsertID = "insert into PIDNo (PID,PidNo,DateRecord) values('S',0,'" + strYMD + "')";
                SQLBase.ExecuteNonQuery(strInsertID, "SalesDBCnn");
                intNewID = 0;
            }
            else
            {
                intNewID = Convert.ToInt32(dtPMaxID.Rows[0]["PidNo"]);
            }

            intNewID++;
            string str = "select PID, PidNo,DateRecord from PIDNo where DateRecord='" + strYMD + "'";

            dtPMaxID = SQLBase.FillTable(strSelPID, "SalesDBCnn");
            strCID   = dtPMaxID.Rows[0]["CID"].ToString() + DateTime.Now.ToString("yyyyMMdd") + GFun.GetNum(intNewID, 3);
            return(strCID);
        }
예제 #2
0
        public static string GetSPid(string folderBack)
        {
            string[]    arr     = folderBack.Split('/');
            Acc_Account account = GAccount.GetAccountInfo();
            int         unitId  = Convert.ToInt16(account.UnitID);
            string      strPID  = "";
            string      strYMD  = DateTime.Now.ToString("yyMMdd");

            string    strSelPID = "select SPID, SPidNo from [" + arr[0] + "].." + arr[6] + " where DateRecord='" + strYMD + "'";
            DataTable dtPMaxID  = SQLBase.FillTable(strSelPID);
            int       intNewID  = 0;

            if (dtPMaxID == null)
            {
                return(strPID);
            }
            if (dtPMaxID.Rows.Count == 0)
            {
                string strInsertID = "insert into [" + arr[0] + "].." + arr[6] + " (SPID,SPidNo,DateRecord) values('P',0,'" + strYMD + "')";
                SQLBase.ExecuteNonQuery(strInsertID);
                intNewID = 0;
            }
            else
            {
                intNewID = Convert.ToInt32(dtPMaxID.Rows[0]["SPidNo"]);
            }

            intNewID++;
            string strUpdateID = "update [" + arr[0] + "].." + arr[6] + " set SPidNo='" + intNewID + "' where DateRecord ='" + strYMD + "'";

            SQLBase.ExecuteNonQuery(strUpdateID);

            strPID = dtPMaxID.Rows[0]["SPID"].ToString() + DateTime.Now.ToString("yyMMdd") + GFun.GetNum(unitId, 4) + GFun.GetNum(intNewID, 4);
            return(strPID);
        }