Esempio n. 1
0
        private void UpdatePayInfo(M_T_PAYMENT ety)
        {
            CRUD dbiz = new CRUD(DbVendor.Oracle, Runtime.OracleConnStrLocal, true);

            try
            {
                dbiz.Update(ety, "paymentid");
                dbiz.Commit();
            }
            catch (Exception)
            {
                dbiz.Abort();
                throw;
            }
        }
Esempio n. 2
0
        private void Save2Log(Model.M_Sys_Log ety)
        {
            CRUD biz2 = new CRUD(DbVendor.Oracle, Runtime.OracleConnStrLocal, true);

            try
            {
                biz2.Create(ety);
                biz2.Commit();
            }
            catch (Exception err)
            {
                biz2.Abort();
                throw err;
            }
        }
Esempio n. 3
0
        private void UpdateLoginAccount(DataRow dr)
        {
            CRUD biz = new CRUD(DbVendor.Oracle, Runtime.OracleConnStrLocal, true);

            try
            {
                biz.Update <Model.M_Sys_Login_Account>(dr, "UserId");
                biz.Commit();
            }
            catch (Exception err)
            {
                biz.Abort();
                throw err;
            }
        }
Esempio n. 4
0
        private int UpdateLoginAcc(Model.M_Sys_Login_Account ety)
        {
            BLL.CRUD biz = new CRUD(DbVendor.Oracle, Runtime.OracleConnStrLocal, true);
            try
            {
                int cnt = biz.Update(ety, "UserId");
                biz.Commit();

                return(cnt);
            }
            catch (Exception)
            {
                biz.Abort();
                throw;
            }
        }
Esempio n. 5
0
        private DataTable GetPendingPay(string leaseNum)
        {
            string sql = "";

            sql += " select ai.customer_number,";
            sql += "ac.customer_name as customername,";
            sql += "'' as shopname, ";
            sql += "l.premise_name1 as premisename, ";
            sql += "'' as shoparea, ";
            sql += "0 as totalamount, ";
            sql += " 0 as payinfonum, ";
            //sql += "---- start payinfo detail ";
            sql += "ai.invoice_number as transno, ";
            sql += "ail.invoice_line_number as invoicelinenum,";
            sql += "ail.charge_code as chargeitem, ";
            sql += "ail.charge_description as descr, ";
            sql += "ail.invoice_amount as amount, ";
            sql += " ail.outstanding_amount as outstanding, ";
            sql += " ai.payment_due_date as duedate ";
            //sql += " ---- end payinfo detail ";
            sql += "from ar_invoice ai, ar_invoice_line ail, ar_customer ac,lm_lease l,ar_customer_site acs ";
            sql += " where 1 = 1 ";

            sql += " and ai.invoice_number = ail.invoice_number ";
            sql += " and Upper(SUBSTR(ail.PAY_STATUS, 1, 1)) in ('U', 'P') and ail.outstanding_amount > 0 ";
            sql += " and ai.lease_number = trim(l.lease_number) and l.status = 'A' and l.active = 'A' ";
            sql += " and ai.customer_number = ac.customer_number and ac.customer_number = acs.customer_number ";
            sql += " and trim(l.site_number) = trim(acs.site_number) ";
            sql += " and ai.lease_number ='" + leaseNum + "'";

            CRUD biz = new CRUD(DbVendor.Oracle, Runtime.OracleConnStr, false);

            try
            {
                DataTable dt = biz.ExecuteDataTable(sql);
                dt.TableName = "PayInfo";
                biz.Commit();

                return(dt);
            }
            catch (Exception)
            {
                biz.Abort();
                throw;
            }
        }
Esempio n. 6
0
        private M_Receipt CreateReceipt()
        {
            CRUD dbiz = new CRUD(DbVendor.Oracle, Runtime.OracleConnStr, true);

            try
            {
                Receipt r = new Receipt(dbiz);
                r.Create(this.req.data);
                dbiz.Commit();

                return(r.ety);
            }
            catch (Exception)
            {
                dbiz.Abort();
                throw;
            }
        }
Esempio n. 7
0
        private List <Model.M_Sys_Login_Account> GetLogUser()
        {
            CRUD biz01 = new CRUD(DbVendor.Oracle, Runtime.OracleConnStrLocal, false);

            try
            {
                Clause c = new Clause();
                c.Add("trim(LoginName)", this.req.data.userid);
                List <Model.M_Sys_Login_Account> etyLst = biz01.Retrieve <Model.M_Sys_Login_Account>(c.Get());
                biz01.Commit();

                return(etyLst);
            }
            catch (Exception err)
            {
                biz01.Abort();
                throw err;
            }
        }
Esempio n. 8
0
        private DataTable GetUserInfo()
        {
            CRUD biz = new CRUD(DbVendor.Oracle, Runtime.OracleConnStrLocal, false);

            try
            {
                Clause c = new Clause();

                string sql = "";
                switch (this.req.data.logintype) //判断登录用户类型
                {
                case "S":
                    sql += "select * from " + M_Sys_Login_System.TableName + " where 1=1 ";
                    sql += " and trim(LoginName)='" + req.data.username + "'";
                    break;

                case "L":
                    sql += "select * from " + M_Sys_Login_Lease.TableName + " where 1=1 ";
                    sql += " and trim(LeaseNumber)='" + req.data.username + "'";
                    break;

                case "E":
                case "C":
                    c.Add("trim(LoginName)", req.data.username);
                    break;

                default:
                    throw new Exception("Unknown login type!");
                }
                DataTable dt = biz.RetrieveDataTable <Model.M_Sys_Login_Account>(c.Get());
                biz.Commit();
                return(dt);
            }
            catch (Exception err)
            {
                biz.Abort();
                throw err;
            }
        }
Esempio n. 9
0
        private void CreateDisribution(string reNum, string reType)
        {
            BLL.CRUD dbiz = new CRUD(DbVendor.Oracle, Runtime.OracleConnStr, true);
            try
            {
                COA       c       = new COA(dbiz);
                ArrayList al      = c.Generate_Distribution(reNum, reType);
                string    strType = "R";
                if (reType == "UD")
                {
                    strType = "U";
                }

                dbiz.ExecuteNonQuery("delete from AR_Line_Distribution where TRANSACTION_NO='" + reNum + "' and TRANSACTION_TYPE='" + strType + "' and post_status<>'P'");
                c.Insert_Distribution(al);
                dbiz.Commit();
            }
            catch (Exception)
            {
                dbiz.Abort();
                throw;
            }
        }
Esempio n. 10
0
        private List <string> GetGroupLease(int userid)
        {
            CRUD biz = new CRUD(DbVendor.Oracle, Runtime.OracleConnStrLocal, false);

            try
            {
                string    sql = "select trim(leasenumber) as leasenumber from SYS_USERS_GROUP_LEASE where UserId=" + userid.ToString();
                DataTable dt  = biz.ExecuteDataTable(sql);
                biz.Commit();

                List <string> leases = new List <string>();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    leases.Add(dt.Rows[i][0].ToString());
                }
                return(leases);
            }
            catch (Exception)
            {
                biz.Abort();
                throw;
            }
        }
Esempio n. 11
0
        /// <summary>
        /// 创建receipt后保存支付信息
        /// </summary>
        private void Save()
        {
            BLL.CRUD biz = new CRUD(DbVendor.Oracle, Runtime.OracleConnStrLocal, true);
            try
            {
                etyH             = new M_T_PAYMENT();
                etyH.paymentid   = Bizhub.FetchPaymentId(biz) + 1;
                etyH.amount      = this.req.data.actualamount;
                etyH.leasenumber = this.req.data.leasenum;
                etyH.paydate     = DateTime.Parse(this.req.data.actualpaydate);
                etyH.paytype     = this.req.data.actualpaytype;
                etyH.status      = "0"; // Status取值定义:0=本地保存完成;1=Receipt创建完成;2=分录创建完成。状态必须从0~2顺序转换。
                biz.Create(etyH);


                Model.Req35dataDtl detail = null;
                etyD = new M_T_PAYMENT_INFO();
                for (int i = 0; i < this.req.data.actualpayinfo.Count; i++)
                {
                    detail = this.req.data.actualpayinfo[i];

                    etyD.actualpay      = detail.actualpay;
                    etyD.amount         = detail.amount;
                    etyD.chargecode     = detail.chargecode;
                    etyD.invoicenumber  = detail.transno;
                    etyD.invoicelinenum = detail.invoicelinenum;
                    etyD.paymentid      = etyH.paymentid;
                    biz.Create(etyD);
                }
                biz.Commit();
            }
            catch (Exception err)
            {
                biz.Abort();
                throw err;
            }
        }
Esempio n. 12
0
        public string InvokeRequest(string postStr)
        {
            Helper.LogWrite("SI31 Request:" + postStr);
            Model.Rsp31 rsp = new Model.Rsp31();
            this.req = Common.Helper.JsonDeserialize <Model.Req31>(postStr);

            DataTable dtUser = this.GetUserInfo(); //取登录用户信息

            if (dtUser.Rows.Count > 0)
            {
                string status = Helper.DbNull2Str(dtUser.Rows[0]["Status"]);
                string pwd    = Helper.DbNull2Str(dtUser.Rows[0]["PASSWORD"]);

                if (this.req.data.password == pwd) // 如果密码正确
                {
                    rsp.data.result            = "100";
                    rsp.data.message           = "验证成功";
                    rsp.data.lastlogin         = dtUser.Rows[0]["updatedate"].ToString(); //上次登录
                    Common.Runtime.CurrentUser = this.req.data.username;

                    if (this.req.data.logintype == "C" || this.req.data.logintype == "E")
                    {
                        //取租约信息
                        rsp.data.leaseinfo  = this.GetGroupLease(int.Parse(dtUser.Rows[0]["userid"].ToString()));
                        rsp.data.leasecount = rsp.data.leaseinfo.Count;
                    }

                    //更新最后登录时间
                    dtUser.Rows[0]["UpdateDate"] = DateTime.Now.ToString(); //本次登录更新
                    if (this.req.data.logintype != "E")
                    {
                        CRUD biz = new CRUD(DbVendor.Oracle, Runtime.OracleConnStrLocal, true);
                        int  cnt = biz.Update <Model.M_Sys_Login_Account>(dtUser.Rows[0], "UserId");
                        biz.Commit();
                    }
                }
                else
                {
                    rsp.data.result  = "200";
                    rsp.data.message = "Wrong password!";
                }
                rsp.data.userid = Helper.DbNull2Int(dtUser.Rows[0]["UserId"]);
                rsp.data.status = Helper.DbNull2Str(dtUser.Rows[0]["Status"]);

                /// 判断用户状态
                switch (status)
                {
                case "A":
                case "F":
                case "C":
                    break;

                case "I":
                    rsp.data.result  = "200";
                    rsp.data.message = "Forbidden User!";
                    break;

                case "T":
                    if (this.req.data.password == Helper.DbNull2Str(dtUser.Rows[0]["TempPsw"]))
                    {
                        rsp.data.result     = "100";
                        rsp.data.message    = "Success!";
                        Runtime.CurrentUser = this.req.data.username;

                        dtUser.Rows[0]["TempPsw"] = "";
                        dtUser.Rows[0]["Status"]  = "A";
                        UpdateLoginAccount(dtUser.Rows[0]);
                    }
                    break;
                }
            }
            else
            {
                rsp.data.result  = "200";
                rsp.data.message = "User not exist!";
            }

            return(Common.Helper.JsonSerialize(rsp));
        }