Пример #1
0
 public List<XObjs.Scard> GenerateGuidNum(int amt, int cnt)
 {
     List<XObjs.Scard> list = new List<XObjs.Scard>();
     string str = "1";
     string str2 = "0";
     string str3 = DateTime.Now.ToString("yyyy-MM-dd");
     string str4 = "1";
     string str5 = "1";
     for (int i = 0; i < cnt; i++)
     {
         XObjs.Scard item = new XObjs.Scard {
             xnum = Guid.NewGuid().ToString("n").Substring(0, amt).ToUpper(),
             xlogstaff = str4,
             xreg_date = str3,
             xsync = str2,
             xvisible = str,
             xvalid = str5
         };
         if (!list.Contains(item))
         {
             list.Add(item);
         }
     }
     return list;
 }
Пример #2
0
 protected void AddFeeList()
 {
     if (this.Session["c_app"] != null)
     {
         this.c_app = (XObjs.Applicant) this.Session["c_app"];
     }
     int num = this.reg.addApplicant(this.c_app);
     if ((num > 0) && ((this.Session["AgentType"] != null) && (this.Session["AgentType"].ToString() != "")))
     {
         this.agentType = this.Session["AgentType"].ToString();
         if (this.agentType == "Agent")
         {
             if (this.Session["c_reg"] != null)
             {
                 this.c_reg = (XObjs.Registration) this.Session["c_reg"];
             }
             this.fullname = this.c_reg.Firstname + " " + this.c_reg.Surname;
             this.Session["fullname"] = this.fullname;
             this.email = this.c_reg.Email;
             this.Session["email"] = this.email;
             this.mobile = this.c_reg.PhoneNumber;
             this.Session["mobile"] = this.mobile;
         }
         else
         {
             if (this.Session["c_sub"] != null)
             {
                 this.c_sub = (XObjs.Subagent) this.Session["c_sub"];
             }
             this.fullname = this.c_sub.Firstname + " " + this.c_sub.Surname;
             this.Session["fullname"] = this.fullname;
             this.email = this.c_sub.Email;
             this.Session["email"] = this.email;
             this.mobile = this.c_sub.Telephone;
             this.Session["mobile"] = this.mobile;
         }
         this.scard = this.ret.getRandomScard();
         this.lt_twall = this.ret.getTwalletByMemberID(this.adminID, this.scard.xnum, this.Session["AgentType"].ToString());
         if (this.lt_twall.Count == 0)
         {
             this.transID = this.scard.xnum.ToUpper();
             int num2 = 0;
             int num3 = 0;
             this.twall.ref_no = "X" + this.adminID + "-" + DateTime.Now.ToString("yyyy") + "-" + this.scard.xnum;
             this.ref_no = this.twall.ref_no;
             this.twall.transID = this.scard.xnum;
             this.twall.xbankerID = "0";
             this.twall.xgt = "xpay";
             this.twall.xmemberID = this.adminID;
             this.twall.xmembertype = this.Session["AgentType"].ToString();
             this.twall.xpay_status = "2";
             this.twall.applicantID = num.ToString();
             this.twall.xreg_date = this.xreg_date;
             this.twall.xsync = "0";
             this.twall.xvisible = "1";
             num2 = this.reg.addTwallet(this.twall);
             if (num2 > 0)
             {
                 if (this.Session["SCart"] != null)
                 {
                     this.lt_cart = (List<XObjs.Shopping_card>) this.Session["SCart"];
                 }
                 if (this.Session["Sl_init"] != null)
                 {
                     this.sl_init_amt = (SortedList<string, string>) this.Session["Sl_init"];
                 }
                 if (this.Session["Sl_tech"] != null)
                 {
                     this.sl_tech_amt = (SortedList<string, string>) this.Session["Sl_tech"];
                 }
                 int num4 = 0;
                 foreach (XObjs.Shopping_card _card in this.lt_cart)
                 {
                     this.f_dets.twalletID = num2.ToString();
                     this.f_dets.fee_listID = _card.xid;
                     this.f_dets.xlogstaff = this.adminID;
                     this.f_dets.xqty = _card.qty;
                     this.f_dets.xused = "0";
                     this.f_dets.tot_amt = _card.total_amt.ToString();
                     this.xtotal_amt += Convert.ToInt32(_card.total_amt);
                     this.f_dets.init_amt = this.sl_init_amt[_card.xid];
                     this.f_dets.tech_amt = this.sl_tech_amt[_card.xid];
                     this.f_dets.xreg_date = this.xreg_date;
                     this.f_dets.xsync = "0";
                     this.f_dets.xvisible = "1";
                     num3 = this.reg.addFee_details(this.f_dets);
                     num4++;
                     for (int i = 0; i < Convert.ToInt32(_card.qty); i++)
                     {
                         int num6 = 0;
                         this.c_hwall.transID = this.scard.xnum;
                         this.c_hwall.used_status = "Not Used";
                         this.c_hwall.product_title = "";
                         this.c_hwall.xreg_date = this.xreg_date;
                         this.c_hwall.used_date = "";
                         this.c_hwall.fee_detailsID = num3.ToString();
                         num6 = this.reg.addHwallet(this.c_hwall);
                     }
                 }
                 if (num4 == this.lt_cart.Count<XObjs.Shopping_card>())
                 {
                     base.Response.Redirect("./m_invoicet.aspx?mx=" + this.adminID + "&tx=" + this.scard.xnum);
                 }
             }
         }
         else
         {
             this.AddFeeList();
         }
     }
 }
Пример #3
0
        protected void AddFeeList()
        {
            if (Session["c_app"] != null)
            {
                c_app = (XObjs.Applicant) Session["c_app"];
            }
            int num = reg.addApplicant(c_app);
            if ((num > 0) && ((Session["AgentType"] != null) && (Session["AgentType"].ToString() != "")))
            {
                agentType = Session["AgentType"].ToString();
                if (agentType == "agent")
                {
                    agentType = "Agent";
                    Session["AgentType"] = agentType;
                }
                if (agentType == "Agent")
                {
                    if (Session["c_reg"] != null)
                    {
                        c_reg = (XObjs.Registration) Session["c_reg"];
                    }

                    fullname = c_reg.Firstname + " " + c_reg.Surname;
                    Session["fullname"] = fullname;
                    email = c_reg.Email;
                    Session["email"] = email;
                    mobile = c_reg.PhoneNumber;
                    Session["mobile"] = mobile;
                }
                else
                {
                    if (Session["c_sub"] != null)
                    {
                        c_sub = (XObjs.Subagent) Session["c_sub"];
                    }
                    fullname = c_sub.Firstname + " " + c_sub.Surname;
                    Session["fullname"] = fullname;
                    email = c_sub.Email;
                    Session["email"] = email;
                    mobile = c_sub.Telephone;
                    Session["mobile"] = mobile;
                }
                scard = ret.getRandomScard();
                string vtransid = Generate15UniqueDigits(); ;
              //  lt_twall = ret.getTwalletByMemberID(adminID, scard.xnum, Session["AgentType"].ToString());
                lt_twall = ret.getTwalletByMemberID(adminID, vtransid, Session["AgentType"].ToString());
                if (lt_twall.Count == 0)
                {

                   // transID = scard.xnum.ToUpper();
                    transID = vtransid;
                    int num2 = 0;
                    int num3 = 0;
                   // twall.ref_no = "X" + adminID + "-" + DateTime.Now.ToString("yyyy") + "-" + scard.xnum;

                    twall.ref_no = "X" + adminID + "-" + DateTime.Now.ToString("yyyy") + "-" + transID;
                    ref_no = twall.ref_no;
                 //   twall.transID = scard.xnum;
                    twall.transID = transID;
                    twall.xbankerID = "0";
                    twall.xgt = "xpay";
                    twall.xmemberID = adminID;
                    twall.xmembertype = Session["AgentType"].ToString();
                    twall.xpay_status = "2";
                    twall.applicantID = num.ToString();
                    twall.xreg_date = xreg_date;
                    twall.xsync = "0";
                    twall.xvisible = "1";
                    num2 = reg.addTwallet(twall);
                    if (num2 > 0)
                    {
                        if (Session["SCart"] != null)
                        {
                            lt_cart = (List<XObjs.Shopping_card>) Session["SCart"];
                        }
                        if (Session["Sl_init"] != null)
                        {
                            sl_init_amt = (SortedList<string, string>) Session["Sl_init"];
                        }
                        if (Session["Sl_tech"] != null)
                        {
                            sl_tech_amt = (SortedList<string, string>) Session["Sl_tech"];
                        }
                        int num4 = 0;
                        foreach (XObjs.Shopping_card _card in lt_cart)
                        {
                            f_dets.twalletID = num2.ToString();
                            f_dets.fee_listID = _card.xid;
                            f_dets.xlogstaff = adminID;
                            f_dets.xqty = _card.qty;
                            f_dets.xused = "0";
                            f_dets.tot_amt = _card.total_amt.ToString();
                            xtotal_amt += Convert.ToInt32(_card.total_amt);
                            f_dets.init_amt = sl_init_amt[_card.xid];
                            f_dets.tech_amt = sl_tech_amt[_card.xid];
                            f_dets.xreg_date = xreg_date;
                            f_dets.xsync = "0";
                            f_dets.xvisible = "1";
                            num3 = reg.addFee_details(f_dets);
                            num4++;
                            for (int i = 0; i < Convert.ToInt32(_card.qty); i++)
                            {
                                int num6 = 0;
                                c_hwall.transID = transID;// scard.xnum;
                                c_hwall.used_status = "Not Used";
                                c_hwall.product_title = "";
                                c_hwall.xreg_date = xreg_date;
                                c_hwall.used_date = "";
                                c_hwall.fee_detailsID = num3.ToString();
                                num6 = reg.addHwallet(c_hwall);
                            }
                        }
                        if (num4 == lt_cart.Count<XObjs.Shopping_card>())
                        {
                           // base.Response.Redirect("./m_invoicex.aspx?mx=" + adminID + "&tx=" + scard.xnum);

                            base.Response.Redirect("./m_invoicex.aspx?mx=" + adminID + "&tx=" + transID);
                        }
                    }
                }
                else
                {
                    AddFeeList();
                }
            }
        }
Пример #4
0
 public XObjs.Scard getRandomScard()
 {
     XObjs.Scard scard = new XObjs.Scard();
     SqlConnection connection = new SqlConnection(hf.ConnectXpay());
     SqlCommand command = new SqlCommand("SELECT top 1 * FROM scard WHERE xid >= RAND() * (SELECT MAX(xid) FROM scard)   ", connection);
     connection.Open(); command.CommandTimeout = 0;
     SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
     while (reader.Read())
     {
         scard.xid = reader["xid"].ToString();
         scard.xnum = reader["xnum"].ToString();
         scard.xvalid = reader["xvalid"].ToString();
         scard.xlogstaff = reader["xlogstaff"].ToString();
         scard.xvalid = reader["xvalid"].ToString();
         scard.xreg_date = reader["xreg_date"].ToString();
         scard.xsync = reader["xsync"].ToString();
         scard.xvisible = reader["xvisible"].ToString();
     }
     reader.Close();
     return scard;
 }