Exemple #1
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.payment   bll   = new BLL.payment();
            Model.payment model = bll.GetModel(_id);

            model.title = txtTitle.Text.Trim();
            if (cbIsLock.Checked == true)
            {
                model.is_lock = 0;
            }
            else
            {
                model.is_lock = 1;
            }
            model.sort_id         = int.Parse(txtSortId.Text.Trim());
            model.poundage_type   = int.Parse(rblPoundageType.SelectedValue);
            model.poundage_amount = decimal.Parse(txtPoundageAmount.Text.Trim());
            model.img_url         = txtImgUrl.Text.Trim();
            model.remark          = txtRemark.Text;
            int payid = MyCommFun.Str2Int(hidPayId.Value);


            if (bll.Update(model))
            {
                AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改支付方式:" + model.title); //记录日志
                result = true;
            }

            return(result);
        }
 private void ShowInfo(int _id)
 {
     BLL.payment bll = new BLL.payment();
     model = bll.GetModel(_id);
     txtTitle.Text = model.title;
     rblType.SelectedValue = model.type.ToString();
     rblIsLock.SelectedValue = model.is_lock.ToString();
     txtSortId.Text = model.sort_id.ToString();
     rblPoundageType.SelectedValue = model.poundage_type.ToString();
     txtPoundageAmount.Text = model.poundage_amount.ToString();
     //txtApiPath.Text = model.api_path;
     txtImgUrl.Text = model.img_url;
     txtRemark.Text = model.remark;
     if (model.api_path.ToLower() == "alipay")
     {
         //支付宝
         XmlDocument doc = XmlHelper.LoadXmlDoc(Utils.GetMapPath("~/xmlconfig/alipay.config"));
         txtAlipayPartner.Text = doc.SelectSingleNode(@"Root/partner").InnerText;
         txtAlipayKey.Text = doc.SelectSingleNode(@"Root/key").InnerText;
         txtAlipaySellerEmail.Text = doc.SelectSingleNode(@"Root/seller_email").InnerText;
     }
     else if (model.api_path.ToLower() == "tenpay")
     {
         //财付通
         XmlDocument doc1 = XmlHelper.LoadXmlDoc(Utils.GetMapPath("~/xmlconfig/tenpay.config"));
         txtTenpayBargainorId.Text = doc1.SelectSingleNode(@"Root/bargainor_id").InnerText;
         txtTenpayKey.Text = doc1.SelectSingleNode(@"Root/tenpay_key").InnerText;
     }
 }
Exemple #3
0
 /// <summary>
 /// 重写虚方法,此方法在Init事件执行
 /// </summary>
 protected override void InitPage()
 {
     id = DTRequest.GetQueryInt("id");
     BLL.orders bll = new BLL.orders();
     if (!bll.Exists(id))
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您要浏览的页面不存在或已删除!")));
         return;
     }
     model = bll.GetModel(id);
     if (model.user_id != userModel.id)
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您所查看的并非自己的订单信息!")));
         return;
     }
     payModel = new BLL.payment().GetModel(model.payment_id);
     if (payModel == null)
     {
         payModel = new Model.payment();
     }
     //根据订单状态和物流单号跟踪物流信息
     if (model.status > 1 && model.status < 4 && model.express_status == 2 && model.express_no.Trim().Length > 0)
     {
         Model.express modelt = new BLL.express().GetModel(model.express_id);
         Model.orderconfig orderConfig = new BLL.orderconfig().loadConfig();
     }
 }
Exemple #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.payment GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();
            StringBuilder str1   = new StringBuilder();

            Model.payment model = new Model.payment();
            //利用反射获得属性的所有公共属性
            PropertyInfo[] pros = model.GetType().GetProperties();
            foreach (PropertyInfo p in pros)
            {
                str1.Append(p.Name + ",");//拼接字段
            }
            strSql.Append("select top 1 " + str1.ToString().Trim(','));
            strSql.Append(" from " + databaseprefix + "payment");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;
            DataTable dt = DbHelperSQL.Query(strSql.ToString(), parameters).Tables[0];

            if (dt.Rows.Count > 0)
            {
                return(DataRowToModel(dt.Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemple #5
0
 /// <summary>
 /// 重写虚方法,此方法在Init事件执行
 /// </summary>
 protected override void InitPage()
 {
     id = DTRequest.GetQueryInt("id");
     BLL.orders bll = new BLL.orders();
     if (!bll.Exists(id))
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您要浏览的页面不存在或已删除!")));
         return;
     }
     model = bll.GetModel(id);
     if (model.user_id != userModel.id)
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您所查看的并非自己的订单信息!")));
         return;
     }
     payModel = new BLL.payment().GetModel(model.payment_id);
     if (payModel == null)
     {
         payModel = new Model.payment();
     }
     //根据订单状态和物流单号跟踪物流信息
     if (model.status > 1 && model.status < 4 && model.express_status == 2 && model.express_no.Trim().Length > 0)
     {
         Model.express     modelt      = new BLL.express().GetModel(model.express_id);
         Model.orderconfig orderConfig = new BLL.orderconfig().loadConfig();
     }
 }
Exemple #6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.payment model)
        {
            StringBuilder strSql = new StringBuilder();
            StringBuilder str1   = new StringBuilder();

            //利用反射获得属性的所有公共属性
            PropertyInfo[]      pros  = model.GetType().GetProperties();
            List <SqlParameter> paras = new List <SqlParameter>();

            strSql.Append("update  " + databaseprefix + "payment set ");
            foreach (PropertyInfo pi in pros)
            {
                //如果不是主键则追加sql字符串
                if (!pi.Name.Equals("id"))
                {
                    //判断属性值是否为空
                    if (pi.GetValue(model, null) != null)
                    {
                        str1.Append(pi.Name + "=@" + pi.Name + ",");                          //声明参数
                        paras.Add(new SqlParameter("@" + pi.Name, pi.GetValue(model, null))); //对参数赋值
                    }
                }
            }
            strSql.Append(str1.ToString().Trim(','));
            strSql.Append(" where id=@id ");
            paras.Add(new SqlParameter("@id", model.id));
            return(DbHelperSQL.ExecuteSql(strSql.ToString(), paras.ToArray()) > 0);
        }
Exemple #7
0
 private void ShowInfo(int _id)
 {
     BLL.payment bll = new BLL.payment();
     model                         = bll.GetModel(_id);
     txtTitle.Text                 = model.title;
     rblType.SelectedValue         = model.type.ToString();
     rblIsLock.SelectedValue       = model.is_lock.ToString();
     txtSortId.Text                = model.sort_id.ToString();
     rblPoundageType.SelectedValue = model.poundage_type.ToString();
     txtPoundageAmount.Text        = model.poundage_amount.ToString();
     //txtApiPath.Text = model.api_path;
     txtImgUrl.Text = model.img_url;
     txtRemark.Text = model.remark;
     if (model.api_path.ToLower() == "alipay")
     {
         //支付宝
         XmlDocument doc = XmlHelper.LoadXmlDoc(Utils.GetMapPath("~/xmlconfig/alipay.config"));
         txtAlipayPartner.Text     = doc.SelectSingleNode(@"Root/partner").InnerText;
         txtAlipayKey.Text         = doc.SelectSingleNode(@"Root/key").InnerText;
         txtAlipaySellerEmail.Text = doc.SelectSingleNode(@"Root/seller_email").InnerText;
     }
     else if (model.api_path.ToLower() == "tenpay")
     {
         //财付通
         XmlDocument doc1 = XmlHelper.LoadXmlDoc(Utils.GetMapPath("~/xmlconfig/tenpay.config"));
         txtTenpayBargainorId.Text = doc1.SelectSingleNode(@"Root/bargainor_id").InnerText;
         txtTenpayKey.Text         = doc1.SelectSingleNode(@"Root/tenpay_key").InnerText;
     }
 }
Exemple #8
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.payment GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select id,title,img_url,remark,type,poundage_type,poundage_amount,sort_id,is_lock,api_path");
            strSql.Append(" from " + databaseprefix + "payment");
            strSql.Append(" where id=@id limit 1");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@id", MySqlDbType.Int32, 4)
            };
            parameters[0].Value = id;

            Model.payment model = new Model.payment();
            DataSet       ds    = DbHelperMySql.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemple #9
0
        private bool DoAdd()
        {
            bool result = false;

            Model.payment model = new Model.payment();
            BLL.payment   bll   = new BLL.payment();

            model.title           = txtTitle.Text.Trim();
            model.img_url         = txtImgUrl.Text.Trim();
            model.remark          = txtRemark.Text;
            model.type            = int.Parse(rblType.SelectedValue);
            model.poundage_type   = int.Parse(rblPoundageType.SelectedValue);
            model.poundage_amount = decimal.Parse(txtPoundageAmount.Text.Trim());
            model.api_path        = txtApiPath.Text.Trim();
            model.redirect_url    = txtRedirectUrl.Text.Trim();
            model.return_url      = txtReturnUrl.Text.Trim();
            model.notify_url      = txtNotifyUrl.Text.Trim();
            if (cbIsLock.Checked == true)
            {
                model.is_lock = 0;
            }
            else
            {
                model.is_lock = 1;
            }
            model.sort_id = ConvertTool.ToInt(txtSortId.Text.Trim(), 99);

            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加支付平台:" + model.title); //记录日志
                result = true;
            }
            return(result);
        }
Exemple #10
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.payment model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update " + databaseprefix + "payment set ");
            strSql.Append("title=@title,");
            strSql.Append("img_url=@img_url,");
            strSql.Append("remark=@remark,");
            strSql.Append("type=@type,");
            strSql.Append("poundage_type=@poundage_type,");
            strSql.Append("poundage_amount=@poundage_amount,");
            strSql.Append("sort_id=@sort_id,");
            strSql.Append("is_lock=@is_lock,");
            strSql.Append("api_path=@api_path,");
            strSql.Append("wid=@wid,");
            strSql.Append("pTypeId=@pTypeId");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@title",           SqlDbType.NVarChar, 100),
                new SqlParameter("@img_url",         SqlDbType.NVarChar, 255),
                new SqlParameter("@remark",          SqlDbType.NVarChar, 500),
                new SqlParameter("@type",            SqlDbType.TinyInt,    1),
                new SqlParameter("@poundage_type",   SqlDbType.TinyInt,    1),
                new SqlParameter("@poundage_amount", SqlDbType.Decimal,    5),
                new SqlParameter("@sort_id",         SqlDbType.Int,        4),
                new SqlParameter("@is_lock",         SqlDbType.TinyInt,    1),
                new SqlParameter("@api_path",        SqlDbType.NVarChar, 100),
                new SqlParameter("@wid",             SqlDbType.Int,        4),
                new SqlParameter("@pTypeId",         SqlDbType.Int,        4),
                new SqlParameter("@id",              SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.title;
            parameters[1].Value  = model.img_url;
            parameters[2].Value  = model.remark;
            parameters[3].Value  = model.type;
            parameters[4].Value  = model.poundage_type;
            parameters[5].Value  = model.poundage_amount;
            parameters[6].Value  = model.sort_id;
            parameters[7].Value  = model.is_lock;
            parameters[8].Value  = model.api_path;
            parameters[9].Value  = model.wid;
            parameters[10].Value = model.pTypeId;
            parameters[11].Value = model.id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #11
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.payment   bll   = new BLL.payment();
            Model.payment model = bll.GetModel(_id);

            model.title = txtTitle.Text.Trim();
            if (cbIsLock.Checked == true)
            {
                model.is_lock = 0;
            }
            else
            {
                model.is_lock = 1;
            }
            model.sort_id         = int.Parse(txtSortId.Text.Trim());
            model.poundage_type   = int.Parse(rblPoundageType.SelectedValue);
            model.poundage_amount = decimal.Parse(txtPoundageAmount.Text.Trim());
            model.img_url         = txtImgUrl.Text.Trim();
            model.remark          = txtRemark.Text;
            int payid = MyCommFun.Str2Int(hidPayId.Value);

            if (model.pTypeId == 2)
            {
                //支付宝

                Model.wx_payment_alipay alipay = aliBll.GetModel(payid);
                alipay.ownerName   = txtAlipaySellerEmail.Text.Trim();
                alipay.partner     = txtAlipayPartner.Text.Trim();
                alipay.e_key       = txtAlipayKey.Text.Trim();
                alipay.private_key = txtprivate_key.Text.Trim();
                alipay.public_key  = txtpublic_key.Text.Trim();
                aliBll.Update(alipay);
            }
            else if (model.pTypeId == 3)
            {
                //微支付
                Model.wx_payment_wxpay wxpay = wxBll.GetModel(payid);
                wxpay.paySignKey = txtpaySignKey.Text.Trim();
                wxpay.partnerId  = txtTenpayPartnerId.Text.Trim();
                wxpay.partnerKey = txtTenpayKey.Text.Trim();
                wxpay.quicklyFH  = rblQuicklyFH.SelectedItem.Value == "1" ? true : false;
                wxpay.appId      = lblAppId.Text.Trim();
                wxBll.Update(wxpay);
            }


            if (bll.Update(model))
            {
                AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改支付方式:" + model.title); //记录日志
                result = true;
            }

            return(result);
        }
Exemple #12
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.payment   bll   = new BLL.payment();
            Model.payment model = bll.GetModel(_id);

            model.title = txtTitle.Text.Trim();
            if (cbIsLock.Checked == true)
            {
                model.is_lock = 0;
            }
            else
            {
                model.is_lock = 1;
            }
            model.is_mobile       = int.Parse(rblIsMobile.SelectedValue);
            model.sort_id         = int.Parse(txtSortId.Text.Trim());
            model.poundage_type   = int.Parse(rblPoundageType.SelectedValue);
            model.poundage_amount = decimal.Parse(txtPoundageAmount.Text.Trim());
            model.img_url         = txtImgUrl.Text.Trim();
            model.remark          = txtRemark.Text;
            if (model.api_path.ToLower() == "alipaypc")
            {
                //支付宝
                string alipayFilePath = Utils.GetMapPath(siteConfig.webpath + "xmlconfig/alipaypc.config");
                XmlHelper.UpdateNodeInnerText(alipayFilePath, @"Root/partner", txtAlipayPartner.Text);
                XmlHelper.UpdateNodeInnerText(alipayFilePath, @"Root/key", txtAlipayKey.Text);
                XmlHelper.UpdateNodeInnerText(alipayFilePath, @"Root/email", txtAlipaySellerEmail.Text);
                XmlHelper.UpdateNodeInnerText(alipayFilePath, @"Root/type", rblAlipayType.SelectedValue);
            }
            else if (model.api_path.ToLower() == "tenpaypc")
            {
                //财付通
                string tenpayFilePath = Utils.GetMapPath(siteConfig.webpath + "xmlconfig/tenpaypc.config");
                XmlHelper.UpdateNodeInnerText(tenpayFilePath, @"Root/partner", txtTenpayBargainorId.Text);
                XmlHelper.UpdateNodeInnerText(tenpayFilePath, @"Root/key", txtTenpayKey.Text);
                XmlHelper.UpdateNodeInnerText(tenpayFilePath, @"Root/type", rblTenpayType.SelectedValue);
            }
            else if (model.api_path.ToLower().StartsWith("chinabankpc"))
            {
                //网银在线
                string chinaBankFilePath = Utils.GetMapPath(siteConfig.webpath + "xmlconfig/chinabankpc.config");
                XmlHelper.UpdateNodeInnerText(chinaBankFilePath, @"Root/partner", txtChinaBankPartner.Text);
                XmlHelper.UpdateNodeInnerText(chinaBankFilePath, @"Root/key", txtChinaBankKey.Text);
            }

            if (bll.Update(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改支付方式:" + model.title); //记录日志
                result = true;
            }

            return(result);
        }
Exemple #13
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.payment model)
        {
            int newId;

            using (OleDbConnection conn = new OleDbConnection(DbHelperOleDb.connectionString))
            {
                conn.Open();
                using (OleDbTransaction trans = conn.BeginTransaction())
                {
                    try
                    {
                        StringBuilder strSql = new StringBuilder();
                        strSql.Append("insert into " + databaseprefix + "payment(");
                        strSql.Append("title,img_url,[remark],type,poundage_type,poundage_amount,sort_id,is_mobile,is_lock,api_path)");
                        strSql.Append(" values (");
                        strSql.Append("@title,@img_url,@remark,@type,@poundage_type,@poundage_amount,@sort_id,@is_mobile,@is_lock,@api_path)");
                        OleDbParameter[] parameters =
                        {
                            new OleDbParameter("@title",           OleDbType.VarChar, 100),
                            new OleDbParameter("@img_url",         OleDbType.VarChar, 255),
                            new OleDbParameter("@remark",          OleDbType.VarChar, 500),
                            new OleDbParameter("@type",            OleDbType.Integer,   4),
                            new OleDbParameter("@poundage_type",   OleDbType.Integer,   4),
                            new OleDbParameter("@poundage_amount", OleDbType.Decimal,   5),
                            new OleDbParameter("@sort_id",         OleDbType.Integer,   4),
                            new OleDbParameter("@is_mobile",       OleDbType.Integer,   4),
                            new OleDbParameter("@is_lock",         OleDbType.Integer,   4),
                            new OleDbParameter("@api_path",        OleDbType.VarChar, 100)
                        };
                        parameters[0].Value = model.title;
                        parameters[1].Value = model.img_url;
                        parameters[2].Value = model.remark;
                        parameters[3].Value = model.type;
                        parameters[4].Value = model.poundage_type;
                        parameters[5].Value = model.poundage_amount;
                        parameters[6].Value = model.sort_id;
                        parameters[7].Value = model.is_mobile;
                        parameters[8].Value = model.is_lock;
                        parameters[9].Value = model.api_path;
                        DbHelperOleDb.ExecuteSql(conn, trans, strSql.ToString(), parameters);
                        //取得新插入的ID
                        newId = GetMaxId(conn, trans);
                        trans.Commit();
                    }
                    catch
                    {
                        trans.Rollback();
                        return(-1);
                    }
                }
            }
            return(newId);
        }
Exemple #14
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.payment DataRowToModel(DataRow row)
 {
     Model.payment model = new Model.payment();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["title"] != null)
         {
             model.title = row["title"].ToString();
         }
         if (row["img_url"] != null)
         {
             model.img_url = row["img_url"].ToString();
         }
         if (row["remark"] != null)
         {
             model.remark = row["remark"].ToString();
         }
         if (row["type"] != null && row["type"].ToString() != "")
         {
             model.type = int.Parse(row["type"].ToString());
         }
         if (row["poundage_type"] != null && row["poundage_type"].ToString() != "")
         {
             model.poundage_type = int.Parse(row["poundage_type"].ToString());
         }
         if (row["poundage_amount"] != null && row["poundage_amount"].ToString() != "")
         {
             model.poundage_amount = decimal.Parse(row["poundage_amount"].ToString());
         }
         if (row["sort_id"] != null && row["sort_id"].ToString() != "")
         {
             model.sort_id = int.Parse(row["sort_id"].ToString());
         }
         if (row["is_mobile"] != null && row["is_mobile"].ToString() != "")
         {
             model.is_mobile = int.Parse(row["is_mobile"].ToString());
         }
         if (row["is_lock"] != null && row["is_lock"].ToString() != "")
         {
             model.is_lock = int.Parse(row["is_lock"].ToString());
         }
         if (row["api_path"] != null)
         {
             model.api_path = row["api_path"].ToString();
         }
     }
     return model;
 }
Exemple #15
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.payment GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,title,img_url,remark,type,poundage_type,poundage_amount,sort_id,is_lock,api_path from " + databaseprefix + "payment ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            Model.payment model = new Model.payment();
            DataSet       ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                model.title   = ds.Tables[0].Rows[0]["title"].ToString();
                model.img_url = ds.Tables[0].Rows[0]["img_url"].ToString();
                model.remark  = ds.Tables[0].Rows[0]["remark"].ToString();
                if (ds.Tables[0].Rows[0]["type"].ToString() != "")
                {
                    model.type = int.Parse(ds.Tables[0].Rows[0]["type"].ToString());
                }
                if (ds.Tables[0].Rows[0]["poundage_type"].ToString() != "")
                {
                    model.poundage_type = int.Parse(ds.Tables[0].Rows[0]["poundage_type"].ToString());
                }
                if (ds.Tables[0].Rows[0]["poundage_amount"].ToString() != "")
                {
                    model.poundage_amount = decimal.Parse(ds.Tables[0].Rows[0]["poundage_amount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["sort_id"].ToString() != "")
                {
                    model.sort_id = int.Parse(ds.Tables[0].Rows[0]["sort_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["is_lock"].ToString() != "")
                {
                    model.is_lock = int.Parse(ds.Tables[0].Rows[0]["is_lock"].ToString());
                }
                model.api_path = ds.Tables[0].Rows[0]["api_path"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemple #16
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.payment DataRowToModel(DataRow row)
 {
     Model.payment model = new Model.payment();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["title"] != null)
         {
             model.title = row["title"].ToString();
         }
         if (row["img_url"] != null)
         {
             model.img_url = row["img_url"].ToString();
         }
         if (row["remark"] != null)
         {
             model.remark = row["remark"].ToString();
         }
         if (row["type"] != null && row["type"].ToString() != "")
         {
             model.type = int.Parse(row["type"].ToString());
         }
         if (row["poundage_type"] != null && row["poundage_type"].ToString() != "")
         {
             model.poundage_type = int.Parse(row["poundage_type"].ToString());
         }
         if (row["poundage_amount"] != null && row["poundage_amount"].ToString() != "")
         {
             model.poundage_amount = decimal.Parse(row["poundage_amount"].ToString());
         }
         if (row["sort_id"] != null && row["sort_id"].ToString() != "")
         {
             model.sort_id = int.Parse(row["sort_id"].ToString());
         }
         if (row["is_mobile"] != null && row["is_mobile"].ToString() != "")
         {
             model.is_mobile = int.Parse(row["is_mobile"].ToString());
         }
         if (row["is_lock"] != null && row["is_lock"].ToString() != "")
         {
             model.is_lock = int.Parse(row["is_lock"].ToString());
         }
         if (row["api_path"] != null)
         {
             model.api_path = row["api_path"].ToString();
         }
     }
     return(model);
 }
 private void ShowInfo(int _id)
 {
     BLL.orders bll = new BLL.orders();
     model = bll.GetModel(_id);
     payModel = new BLL.payment().GetModel(model.payment_id);
     userModel = new BLL.users().GetModel(model.user_id);
     if (userModel != null)
     {
         groupModel = new BLL.user_groups().GetModel(userModel.group_id);
     }
     if (payModel == null)
     {
         payModel = new Model.payment();
     }
     this.rptList.DataSource = model.order_goods;
     this.rptList.DataBind();
     //订单状态
     if (model.status == 1)
     {
         if (payModel != null && payModel.type == 1)
         {
             if (model.payment_status > 1)
             {
                 this.lbtnConfirm.Enabled = true;
             }
         }
         else
         {
             this.lbtnConfirm.Enabled = true;
         }
     }
     else if (model.status == 2 && model.distribution_status == 1)
     {
         this.lbtnSend.Enabled = true;
     }
     else if (model.status == 2 && model.distribution_status == 2)
     {
         this.lbtnComplete.Enabled = true;
     }
     if (model.status < 3)
     {
         this.btnCancel.Visible = true;
     }
     //如果订单为已完成时,不能取消订单
     if (model.status == 3)
     {
         this.btnInvalid.Visible = true;
     }
 }
 private void ShowInfo(int _id)
 {
     BLL.orders bll = new BLL.orders();
     model     = bll.GetModel(_id);
     payModel  = new BLL.payment().GetModel(model.payment_id);
     userModel = new BLL.users().GetModel(model.user_id);
     if (userModel != null)
     {
         groupModel = new BLL.user_groups().GetModel(userModel.group_id);
     }
     if (payModel == null)
     {
         payModel = new Model.payment();
     }
     this.rptList.DataSource = model.order_goods;
     this.rptList.DataBind();
     //订单状态
     if (model.status == 1)
     {
         if (payModel != null && payModel.type == 1)
         {
             if (model.payment_status > 1)
             {
                 this.lbtnConfirm.Enabled = true;
             }
         }
         else
         {
             this.lbtnConfirm.Enabled = true;
         }
     }
     else if (model.status == 2 && model.distribution_status == 1)
     {
         this.lbtnSend.Enabled = true;
     }
     else if (model.status == 2 && model.distribution_status == 2)
     {
         this.lbtnComplete.Enabled = true;
     }
     if (model.status < 3)
     {
         this.btnCancel.Visible = true;
     }
     //如果订单为已完成时,不能取消订单
     if (model.status == 3)
     {
         this.btnInvalid.Visible = true;
     }
 }
Exemple #19
0
 /// <summary>
 /// 重写虚方法,此方法在Init事件执行
 /// </summary>
 protected override void InitPage()
 {
     id = AXRequest.GetQueryInt("id");
     BLL.orders bll = new BLL.orders();
     if (!bll.Exists(id))
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "error.aspx?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!")));
         return;
     }
     model    = bll.GetModel(id);
     payModel = new BLL.payment().GetModel(model.payment_id);
     if (payModel == null)
     {
         payModel = new Model.payment();
     }
 }
 /// <summary>
 /// 重写虚方法,此方法在Init事件执行
 /// </summary>
 protected override void InitPage()
 {
     id = MXRequest.GetQueryInt("id");
     BLL.orders bll = new BLL.orders();
     if (!bll.Exists(id))
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "error.aspx?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!")));
         return;
     }
     model = bll.GetModel(id);
     payModel = new BLL.payment().GetModel(model.payment_id);
     if (payModel == null)
     {
         payModel = new Model.payment();
     }
 }
Exemple #21
0
 /// <summary>
 /// 重写虚方法,此方法在Init事件执行
 /// </summary>
 protected override void InitPage()
 {
     id = DTRequest.GetQueryInt("id");
     BLL.orders bll = new BLL.orders();
     if (!bll.Exists(id))
     {
         HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出錯啦,您要瀏覽的頁面不存在或已刪除啦!"));
         return;
     }
     model    = bll.GetModel(id);
     payModel = new BLL.payment().GetModel(model.payment_id);
     if (payModel == null)
     {
         payModel = new Model.payment();
     }
 }
Exemple #22
0
 private void ShowInfo(int _id)
 {
     BLL.payment bll = new BLL.payment();
     model                 = bll.GetModel(_id);
     txtTitle.Text         = model.title;
     rblType.SelectedValue = model.type.ToString();
     rblType.Enabled       = false;
     if (model.is_lock == 0)
     {
         cbIsLock.Checked = true;
     }
     else
     {
         cbIsLock.Checked = false;
     }
     rblIsMobile.SelectedValue     = model.is_mobile.ToString();
     txtSortId.Text                = model.sort_id.ToString();
     rblPoundageType.SelectedValue = model.poundage_type.ToString();
     txtPoundageAmount.Text        = model.poundage_amount.ToString();
     txtImgUrl.Text                = model.img_url;
     txtRemark.Text                = model.remark;
     if (model.api_path.ToLower() == "alipaypc")
     {
         //支付宝
         XmlDocument doc = XmlHelper.LoadXmlDoc(Utils.GetMapPath(siteConfig.webpath + "xmlconfig/alipaypc.config"));
         txtAlipayPartner.Text       = doc.SelectSingleNode(@"Root/partner").InnerText;
         txtAlipayKey.Text           = doc.SelectSingleNode(@"Root/key").InnerText;
         txtAlipaySellerEmail.Text   = doc.SelectSingleNode(@"Root/email").InnerText;
         rblAlipayType.SelectedValue = doc.SelectSingleNode(@"Root/type").InnerText;
     }
     else if (model.api_path.ToLower() == "tenpaypc")
     {
         //财付通
         XmlDocument doc = XmlHelper.LoadXmlDoc(Utils.GetMapPath(siteConfig.webpath + "xmlconfig/tenpaypc.config"));
         txtTenpayBargainorId.Text   = doc.SelectSingleNode(@"Root/partner").InnerText;
         txtTenpayKey.Text           = doc.SelectSingleNode(@"Root/key").InnerText;
         rblTenpayType.SelectedValue = doc.SelectSingleNode(@"Root/type").InnerText;
     }
     else if (model.api_path.ToLower() == "chinabankpc")
     {
         //网银在线
         XmlDocument doc = XmlHelper.LoadXmlDoc(Utils.GetMapPath(siteConfig.webpath + "xmlconfig/chinabankpc.config"));
         txtChinaBankPartner.Text = doc.SelectSingleNode(@"Root/partner").InnerText;
         txtChinaBankKey.Text     = doc.SelectSingleNode(@"Root/key").InnerText;
     }
 }
Exemple #23
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.payment model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into " + databaseprefix + "payment(");
            strSql.Append("title,img_url,remark,type,poundage_type,poundage_amount,sort_id,is_lock,api_path,wid,pTypeId)");
            strSql.Append(" values (");
            strSql.Append("@title,@img_url,@remark,@type,@poundage_type,@poundage_amount,@sort_id,@is_lock,@api_path,@wid,@pTypeId)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@title",           SqlDbType.NVarChar, 100),
                new SqlParameter("@img_url",         SqlDbType.NVarChar, 255),
                new SqlParameter("@remark",          SqlDbType.NVarChar, 500),
                new SqlParameter("@type",            SqlDbType.TinyInt,    1),
                new SqlParameter("@poundage_type",   SqlDbType.TinyInt,    1),
                new SqlParameter("@poundage_amount", SqlDbType.Decimal,    5),
                new SqlParameter("@sort_id",         SqlDbType.Int,        4),
                new SqlParameter("@is_lock",         SqlDbType.TinyInt,    1),
                new SqlParameter("@api_path",        SqlDbType.NVarChar, 100),
                new SqlParameter("@wid",             SqlDbType.Int,        4),
                new SqlParameter("@pTypeId",         SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.title;
            parameters[1].Value  = model.img_url;
            parameters[2].Value  = model.remark;
            parameters[3].Value  = model.type;
            parameters[4].Value  = model.poundage_type;
            parameters[5].Value  = model.poundage_amount;
            parameters[6].Value  = model.sort_id;
            parameters[7].Value  = model.is_lock;
            parameters[8].Value  = model.api_path;
            parameters[9].Value  = model.wid;
            parameters[10].Value = model.pTypeId;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemple #24
0
        private void ShowInfo(int _id)
        {
            Model.wx_userweixin weixin = GetWeiXinCode();
            BLL.payment         bll    = new BLL.payment();
            model         = bll.GetModel(_id);
            txtTitle.Text = model.title;

            if (model.is_lock == 0)
            {
                cbIsLock.Checked = true;
            }
            else
            {
                cbIsLock.Checked = false;
            }
            txtSortId.Text = model.sort_id.ToString();
            rblPoundageType.SelectedValue = model.poundage_type.ToString();
            txtPoundageAmount.Text        = model.poundage_amount.ToString();
            txtImgUrl.Text = model.img_url;
            txtRemark.Text = model.remark;
            if (model.pTypeId == 2)
            {
                //支付宝
                Model.wx_payment_alipay alipay = aliBll.GetModelList("wid=" + weixin.id)[0];
                txtAlipaySellerEmail.Text = alipay.ownerName;
                txtAlipayPartner.Text     = alipay.partner;
                txtAlipayKey.Text         = alipay.e_key;
                txtprivate_key.Text       = alipay.private_key;
                txtpublic_key.Text        = alipay.public_key;
                hidPayId.Value            = alipay.id.ToString();
            }
            else if (model.pTypeId == 3)
            {
                //微信支付
                Model.wx_payment_wxpay wxpay = wxBll.GetModelByWid(weixin.id);
                txtpaySignKey.Text         = wxpay.paySignKey;
                txtTenpayPartnerId.Text    = wxpay.partnerId;
                txtTenpayKey.Text          = wxpay.partnerKey;
                hidPayId.Value             = wxpay.id.ToString();
                rblQuicklyFH.SelectedValue = wxpay.quicklyFH.ToString().ToLower() == "true" ? "1" : "0";
                BLL.wx_userweixin   uwBll    = new BLL.wx_userweixin();
                Model.wx_userweixin uwEneity = uwBll.GetModel(weixin.id);

                lblAppId.Text = uwEneity.AppId;
            }
        }
 private void ShowInfo(int _id)
 {
     BLL.payment bll = new BLL.payment();
     model = bll.GetModel(_id);
     txtTitle.Text = model.title;
     rblType.SelectedValue = model.type.ToString();
     rblType.Enabled = false;
     if (model.is_lock == 0)
     {
         cbIsLock.Checked = true;
     }
     else
     {
         cbIsLock.Checked = false;
     }
     rblIsMobile.SelectedValue = model.is_mobile.ToString();
     txtSortId.Text = model.sort_id.ToString();
     rblPoundageType.SelectedValue = model.poundage_type.ToString();
     txtPoundageAmount.Text = model.poundage_amount.ToString();
     txtImgUrl.Text = model.img_url;
     txtRemark.Text = model.remark;
     if (model.api_path.ToLower() == "alipaypc")
     {
         //支付宝
         XmlDocument doc = XmlHelper.LoadXmlDoc(Utils.GetMapPath(siteConfig.webpath + "xmlconfig/alipaypc.config"));
         txtAlipayPartner.Text = doc.SelectSingleNode(@"Root/partner").InnerText;
         txtAlipayKey.Text = doc.SelectSingleNode(@"Root/key").InnerText;
         txtAlipaySellerEmail.Text = doc.SelectSingleNode(@"Root/email").InnerText;
         rblAlipayType.SelectedValue = doc.SelectSingleNode(@"Root/type").InnerText;
     }
     else if (model.api_path.ToLower() == "tenpaypc")
     {
         //财付通
         XmlDocument doc = XmlHelper.LoadXmlDoc(Utils.GetMapPath(siteConfig.webpath + "xmlconfig/tenpaypc.config"));
         txtTenpayBargainorId.Text = doc.SelectSingleNode(@"Root/partner").InnerText;
         txtTenpayKey.Text = doc.SelectSingleNode(@"Root/key").InnerText;
         rblTenpayType.SelectedValue = doc.SelectSingleNode(@"Root/type").InnerText;
     }
     else if (model.api_path.ToLower() == "chinabankpc")
     {
         //网银在线
         XmlDocument doc = XmlHelper.LoadXmlDoc(Utils.GetMapPath(siteConfig.webpath + "xmlconfig/chinabankpc.config"));
         txtChinaBankPartner.Text = doc.SelectSingleNode(@"Root/partner").InnerText;
         txtChinaBankKey.Text = doc.SelectSingleNode(@"Root/key").InnerText;
     }
 }
        private void ShowInfo(int _id)
        {
            Model.wx_userweixin weixin = GetWeiXinCode();
            BLL.payment bll = new BLL.payment();
            model = bll.GetModel(_id);
            txtTitle.Text = model.title;
          
            if (model.is_lock == 0)
            {
                cbIsLock.Checked = true;
            }
            else
            {
                cbIsLock.Checked = false;
            }
            txtSortId.Text = model.sort_id.ToString();
            rblPoundageType.SelectedValue = model.poundage_type.ToString();
            txtPoundageAmount.Text = model.poundage_amount.ToString();
            txtImgUrl.Text = model.img_url;
            txtRemark.Text = model.remark;
            if (model.pTypeId==2)
            {
                //支付宝
                Model.wx_payment_alipay alipay = aliBll.GetModelList("wid=" + weixin.id)[0];
                txtAlipaySellerEmail.Text = alipay.ownerName;
                txtAlipayPartner.Text = alipay.partner;
                txtAlipayKey.Text = alipay.e_key;
                txtprivate_key.Text = alipay.private_key;
                txtpublic_key.Text = alipay.public_key;
                hidPayId.Value = alipay.id.ToString();

            }
            else if (model.pTypeId==3)
            {
                //微信支付
                Model.wx_payment_wxpay wxpay = wxBll.GetModelByWid(weixin.id);
                txtpaySignKey.Text = wxpay.paySignKey;
                txtTenpayPartnerId.Text = wxpay.partnerId;
                txtTenpayKey.Text = wxpay.partnerKey;
                hidPayId.Value = wxpay.id.ToString();
                rblQuicklyFH.SelectedValue = wxpay.quicklyFH.ToString().ToLower()=="true" ? "1" : "0";
                txtAppId.Text=wxpay.appId ;

            }
            
        }
Exemple #27
0
 /// <summary>
 /// 将对象转换实体
 /// </summary>
 public Model.payment DataRowToModel(DataRow row)
 {
     Model.payment model = new Model.payment();
     if (row != null)
     {
         //利用反射获得属性的所有公共属性
         Type modelType = model.GetType();
         for (int i = 0; i < row.Table.Columns.Count; i++)
         {
             //查找实体是否存在列表相同的公共属性
             PropertyInfo proInfo = modelType.GetProperty(row.Table.Columns[i].ColumnName);
             if (proInfo != null && row[i] != DBNull.Value)
             {
                 proInfo.SetValue(model, row[i], null);//用索引值设置属性值
             }
         }
     }
     return(model);
 }
Exemple #28
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.payment model)
        {
            StringBuilder strSql = new StringBuilder();
            StringBuilder str1   = new StringBuilder(); //数据字段
            StringBuilder str2   = new StringBuilder(); //数据参数

            //利用反射获得属性的所有公共属性
            PropertyInfo[]      pros  = model.GetType().GetProperties();
            List <SqlParameter> paras = new List <SqlParameter>();

            strSql.Append("insert into  " + databaseprefix + "payment(");
            foreach (PropertyInfo pi in pros)
            {
                //如果不是主键则追加sql字符串
                if (!pi.Name.Equals("id"))
                {
                    //判断属性值是否为空
                    if (pi.GetValue(model, null) != null)
                    {
                        str1.Append(pi.Name + ",");                                           //拼接字段
                        str2.Append("@" + pi.Name + ",");                                     //声明参数
                        paras.Add(new SqlParameter("@" + pi.Name, pi.GetValue(model, null))); //对参数赋值
                    }
                }
            }
            strSql.Append(str1.ToString().Trim(','));
            strSql.Append(") values (");
            strSql.Append(str2.ToString().Trim(','));
            strSql.Append(") ");
            strSql.Append(";select @@IDENTITY;");
            object obj = DbHelperSQL.GetSingle(strSql.ToString(), paras.ToArray());

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemple #29
0
 /// <summary>
 /// 重写虚方法,此方法在Init事件执行
 /// </summary>
 protected override void InitPage()
 {
     id = DTRequest.GetQueryInt("id");
     BLL.orders bll = new BLL.orders();
     if (!bll.Exists(id))
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您要浏览的页面不存在或已删除!")));
         return;
     }
     model = bll.GetModel(id);
     if (model.user_id != userModel.id)
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您所查看的并非自己的订单信息!")));
         return;
     }
     payModel = new BLL.site_payment().GetPaymentModel(model.payment_id);
     if (payModel == null)
     {
         payModel = new Model.payment();
     }
 }
Exemple #30
0
        private void ShowInfo(int _id)
        {
            Model.wx_userweixin weixin = GetWeiXinCode();
            BLL.payment         bll    = new BLL.payment();
            model         = bll.GetModel(_id);
            txtTitle.Text = model.title;

            if (model.is_lock == 0)
            {
                cbIsLock.Checked = true;
            }
            else
            {
                cbIsLock.Checked = false;
            }
            txtSortId.Text = model.sort_id.ToString();
            rblPoundageType.SelectedValue = model.poundage_type.ToString();
            txtPoundageAmount.Text        = model.poundage_amount.ToString();
            txtImgUrl.Text = model.img_url;
            txtRemark.Text = model.remark;
        }
Exemple #31
0
        private bool DoEdit(int _id)
        {
            bool result = true;

            BLL.payment   bll   = new BLL.payment();
            Model.payment model = bll.GetModel(_id);

            model.title           = txtTitle.Text.Trim();
            model.type            = int.Parse(rblType.SelectedValue);
            model.is_lock         = int.Parse(rblIsLock.SelectedValue);
            model.sort_id         = int.Parse(txtSortId.Text.Trim());
            model.poundage_type   = int.Parse(rblPoundageType.SelectedValue);
            model.poundage_amount = decimal.Parse(txtPoundageAmount.Text.Trim());
            //model.api_path = txtApiPath.Text.Trim();
            model.img_url = txtImgUrl.Text.Trim();
            model.remark  = txtRemark.Text;
            if (model.api_path.ToLower() == "alipay")
            {
                //支付宝
                string alipayFilePath = Utils.GetMapPath("~/xmlconfig/alipay.config");
                XmlHelper.UpdateNodeInnerText(alipayFilePath, @"Root/partner", txtAlipayPartner.Text);
                XmlHelper.UpdateNodeInnerText(alipayFilePath, @"Root/key", txtAlipayKey.Text);
                XmlHelper.UpdateNodeInnerText(alipayFilePath, @"Root/seller_email", txtAlipaySellerEmail.Text);
            }
            else if (model.api_path.ToLower() == "tenpay")
            {
                //财付通
                string tenpayFilePath = Utils.GetMapPath("~/xmlconfig/tenpay.config");
                XmlHelper.UpdateNodeInnerText(tenpayFilePath, @"Root/bargainor_id", txtTenpayBargainorId.Text);
                XmlHelper.UpdateNodeInnerText(tenpayFilePath, @"Root/tenpay_key", txtTenpayKey.Text);
            }

            if (!bll.Update(model))
            {
                result = false;
            }

            return(result);
        }
Exemple #32
0
        private bool DoAdd(int _id)
        {
            Model.wx_userweixin weixin = GetWeiXinCode();

            bool result = false;

            BLL.payment   bll   = new BLL.payment();
            Model.payment model = new Model.payment();

            model.title = txtTitle.Text.Trim();
            if (cbIsLock.Checked == true)
            {
                model.is_lock = 0;
            }
            else
            {
                model.is_lock = 1;
            }
            model.sort_id         = int.Parse(txtSortId.Text.Trim());
            model.poundage_type   = int.Parse(rblPoundageType.SelectedValue);
            model.poundage_amount = decimal.Parse(txtPoundageAmount.Text.Trim());
            model.img_url         = txtImgUrl.Text.Trim();
            model.remark          = txtRemark.Text;
            model.pTypeId         = _id;
            model.wid             = weixin.id;
            model.api_path        = hidApi_path.Value;


            if (bll.Add(model) > 0)
            {
                AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "添加支付方式:" + model.title); //记录日志
                result = true;
            }

            return(result);
        }
Exemple #33
0
 /// <summary>
 /// 重写虚方法,此方法在Init事件执行
 /// </summary>
 protected override void InitPage()
 {
     id = DTRequest.GetQueryInt("id");
     BLL.orders bll = new BLL.orders();
     if (!bll.Exists(id))
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您要浏览的页面不存在或已删除!")));
         return;
     }
     model = bll.GetModel(id);
     if (model.user_id != userModel.id)
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您所查看的并非自己的订单信息!")));
         return;
     }
     payModel = new BLL.payment().GetModel(model.payment_id);
     if (payModel == null)
     {
         payModel = new Model.payment();
     }
     //根据订单状态和物流单号跟踪物流信息
     if (model.status > 1 && model.status < 4 && model.express_status == 2 && model.express_no.Trim().Length > 0)
     {
         Model.express modelt = new BLL.express().GetModel(model.express_id);
         Model.orderconfig orderConfig = new BLL.orderconfig().loadConfig();
         if (modelt != null && modelt.express_code.Trim().Length > 0 && orderConfig.kuaidiapi != "")
         {
             string apiurl = orderConfig.kuaidiapi + "?id=" + orderConfig.kuaidikey + "&com=" + modelt.express_code + "&nu=" + model.express_no + "&show=" + orderConfig.kuaidishow + "&muti=" + orderConfig.kuaidimuti + "&order=" + orderConfig.kuaidiorder;
             string detail = Utils.HttpGet(@apiurl);
             if (detail != null)
             {
                 expressdetail = Utils.ToHtml(detail);
             }
         }
     }
 }
Exemple #34
0
 /// <summary>
 /// 重写虚方法,此方法在Init事件执行
 /// </summary>
 protected override void InitPage()
 {
     id = DTRequest.GetQueryInt("id");
     BLL.orders bll = new BLL.orders();
     if (!bll.Exists(id))
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您要浏览的页面不存在或已删除!")));
         return;
     }
     model = bll.GetModel(id);
     if (model.user_id != userModel.id)
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您所查看的并非自己的订单信息!")));
         return;
     }
     payModel = new BLL.site_payment().GetPaymentModel(model.payment_id);
     if (payModel == null)
     {
         payModel = new Model.payment();
     }
     //根据订单状态和物流单号跟踪物流信息
     if (model.status > 1 && model.status < 4 && model.express_status == 2 && model.express_no.Trim().Length > 0)
     {
         Model.express     modelt      = new BLL.express().GetModel(model.express_id);
         Model.orderconfig orderConfig = new BLL.orderconfig().loadConfig();
         if (modelt != null && modelt.express_code.Trim().Length > 0 && orderConfig.kuaidiapi != "")
         {
             string apiurl = orderConfig.kuaidiapi + "?id=" + orderConfig.kuaidikey + "&com=" + modelt.express_code + "&nu=" + model.express_no + "&show=" + orderConfig.kuaidishow + "&muti=" + orderConfig.kuaidimuti + "&order=" + orderConfig.kuaidiorder;
             string detail = Utils.HttpGet(@apiurl);
             if (detail != null)
             {
                 expressdetail = Utils.ToHtml(detail);
             }
         }
     }
 }
Exemple #35
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.payment GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 id,title,img_url,remark,[type],poundage_type,poundage_amount,sort_id,is_lock,api_path from dt_payment ");
            strSql.Append(" where id=@id");
            OleDbParameter[] parameters = {
					new OleDbParameter("@id", OleDbType.Integer,4)};
            parameters[0].Value = id;

            Model.payment model = new Model.payment();
            DataSet ds = DbHelperOleDb.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["title"] != null && ds.Tables[0].Rows[0]["title"].ToString() != "")
                {
                    model.title = ds.Tables[0].Rows[0]["title"].ToString();
                }
                if (ds.Tables[0].Rows[0]["img_url"] != null && ds.Tables[0].Rows[0]["img_url"].ToString() != "")
                {
                    model.img_url = ds.Tables[0].Rows[0]["img_url"].ToString();
                }
                if (ds.Tables[0].Rows[0]["remark"] != null && ds.Tables[0].Rows[0]["remark"].ToString() != "")
                {
                    model.remark = ds.Tables[0].Rows[0]["remark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["type"] != null && ds.Tables[0].Rows[0]["type"].ToString() != "")
                {
                    model.type = int.Parse(ds.Tables[0].Rows[0]["type"].ToString());
                }
                if (ds.Tables[0].Rows[0]["poundage_type"] != null && ds.Tables[0].Rows[0]["poundage_type"].ToString() != "")
                {
                    model.poundage_type = int.Parse(ds.Tables[0].Rows[0]["poundage_type"].ToString());
                }
                if (ds.Tables[0].Rows[0]["poundage_amount"] != null && ds.Tables[0].Rows[0]["poundage_amount"].ToString() != "")
                {
                    model.poundage_amount = decimal.Parse(ds.Tables[0].Rows[0]["poundage_amount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["sort_id"] != null && ds.Tables[0].Rows[0]["sort_id"].ToString() != "")
                {
                    model.sort_id = int.Parse(ds.Tables[0].Rows[0]["sort_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["is_lock"] != null && ds.Tables[0].Rows[0]["is_lock"].ToString() != "")
                {
                    model.is_lock = int.Parse(ds.Tables[0].Rows[0]["is_lock"].ToString());
                }
                if (ds.Tables[0].Rows[0]["api_path"] != null && ds.Tables[0].Rows[0]["api_path"].ToString() != "")
                {
                    model.api_path = ds.Tables[0].Rows[0]["api_path"].ToString();
                }
                return model;
            }
            else
            {
                return null;
            }
        }
Exemple #36
0
        private void order_pay(HttpContext context)
        {
            Model.users model = new BasePage().GetUserInfo();
            if (model == null)
            {
                context.Response.Write("{\"status\":\"0\", \"msg\":\"对不起,请重新登录!\"}");
                return;
            }

            string pay_type = DTRequest.GetQueryString("pay_type");//支付类型
            int pay_ment = DTRequest.GetQueryInt("pay_ment");//支付方式
            int order_id = DTRequest.GetQueryInt("order_id");

            BLL.orders bll = new BLL.orders();
            Model.orders model_order = bll.GetModel(order_id);
            if (model_order == null)
            {
                context.Response.Write("{\"status\":\"0\", \"msg\":\"订单不存在!\"}");
                return;
            }

            switch (pay_type)
            {
                case "month":
                    model_order.is_up = 3;
                    break;
                case "is_up":
                    model_order.is_up = 2;
                    break;
                case "payno":
                    model_order.is_up = 1;
                    break;
            }

            //直接支付
            BLL.payment bll_pay = new BLL.payment();
            Model.payment model_pay = new Model.payment();
            string url = "";
            if (pay_type == "payno")
            {
                model_pay = bll_pay.GetModel(pay_ment);
                if (model_pay == null)
                {
                    context.Response.Write("{\"status\":\"0\", \"msg\":\"支付方式不存在或已删除!\"}");
                    return;
                }
                model_order.payment_id = model_pay.id;
                if (model_pay.type == 1)
                {
                    //用户余额
                    if (model_pay.api_path == "balance")
                    {
                        if (model.amount < model_order.order_amount)
                        {
                            context.Response.Write("{\"status\":\"0\", \"msg\":\"对不起,您的用户余额不足请充值!\"}");
                            return;
                        }
                        decimal user_amount = model.amount - model_order.order_amount;
                        if (new BLL.users().UpdateField(model.id, "amount=" + user_amount) <= 0)
                        {
                            context.Response.Write("{\"status\":\"0\", \"msg\":\"扣除余额失败,支付失败!\"}");
                            return;
                        }
                        model_order.status = 2;
                        model_order.payment_status = 2;
                    }
                    else
                    {
                        url = siteConfig.webpath + "api/payment/" + model_pay.api_path + "/index.aspx?action=pay&pay_user_name=" + model.nick_name.Trim()
                                  + "&pay_order_type=" + DTEnums.AmountTypeEnum.BuyGoods.ToString() + "&pay_order_no=" + model_order.order_no + "&pay_order_amount=" + model_order.order_amount + "&pay_subject=商品订单";
                    }
                }
                else
                {
                    //货到付款
                }
            }

            if (!bll.Update(model_order))
            {
                context.Response.Write("{\"status\":\"0\", \"msg\":\"支付方式保存失败!\"}");
                return;
            }
            else
            {
                context.Response.Write("{\"status\":\"1\", \"msg\":\"支付成功!\",\"url\":\"" + url + "\"}");
                return;
            }
        }
Exemple #37
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.payment GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select top 1 id,title,img_url,[remark],type,poundage_type,poundage_amount,sort_id,is_lock,api_path");
            strSql.Append(" from " + databaseprefix + "payment");
            strSql.Append(" where id=@id");
            OleDbParameter[] parameters = {
                    new OleDbParameter("@id", OleDbType.Integer,4)};
            parameters[0].Value = id;

            Model.payment model = new Model.payment();
            DataSet ds = DbHelperOleDb.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }
Exemple #38
0
        /// <summary>
        /// 将在Init事件执行
        /// </summary>
        protected void payment_Init(object sender, EventArgs e)
        {
            //取得处事类型
            action = DTRequest.GetString("action");
            order_type = DTRequest.GetString("order_type");
            order_no = DTRequest.GetString("order_no");
            
            switch (action)
            {
                case "confirm":
                    if (string.IsNullOrEmpty(action) || string.IsNullOrEmpty(order_type) || string.IsNullOrEmpty(order_no))
                    {
                        HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,URL传输参数有误!"));
                        return;
                    }
                    //检查用户是否登录
                    userModel = new Web.UI.BasePage().GetUserInfo();
                    if (userModel == null)
                    {
                        //用户未登录
                        HttpContext.Current.Response.Redirect(linkurl("payment", "login"));
                        return;
                    }
                    //检查订单的类型(充值或购物)
                    if (order_type == DTEnums.AmountTypeEnum.Recharge.ToString()) //充值
                    {
                        amountModel = new BLL.amount_log().GetModel(order_no);
                        if (amountModel == null)
                        {
                            HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!"));
                            return;
                        }
                        //检查订单号是否已支付
                        if (amountModel.status == 1)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("payment1", "succeed", order_type, amountModel.order_no));
                            return;
                        }
                        //检查支付方式
                        payModel = new BLL.payment().GetModel(amountModel.payment_id);
                        if (payModel == null)
                        {
                            HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,支付方式不存在或已删除!"));
                            return;
                        }
                        //检查是否线上支付
                        if (payModel.type == 2)
                        {
                            HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,账户充值不允许线下支付!"));
                            return;
                        }
                        order_amount = amountModel.value; //订单金额
                    }
                    else if (order_type == DTEnums.AmountTypeEnum.BuyGoods.ToString()) //购物
                    {
                        //检查订单是否存在
                        orderModel = new BLL.orders().GetModel(order_no);
                        if (orderModel == null)
                        {
                            HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!"));
                            return;
                        }
                        //检查是否已支付过
                        if (orderModel.payment_status == 2)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("payment1", "succeed", order_type, orderModel.order_no));
                            return;
                        }
                        //检查支付方式
                        payModel = new BLL.payment().GetModel(orderModel.payment_id);
                        if (payModel == null)
                        {
                            HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,支付方式不存在或已删除!"));
                            return;
                        }
                        //检查是否线下付款
                        if (payModel.type == 2)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("payment1", "succeed", order_type, orderModel.order_no));
                            return;
                        }
                        //检查是否积分换购,直接跳转成功页面
                        if (orderModel.order_amount == 0)
                        {
                            //修改订单状态
                            bool result = new BLL.orders().UpdateField(orderModel.order_no, "payment_status=2,payment_time='" + DateTime.Now + "'");
                            if (!result)
                            {
                                HttpContext.Current.Response.Redirect(linkurl("payment", "error"));
                                return;
                            }
                            HttpContext.Current.Response.Redirect(linkurl("payment1", "succeed", order_type, orderModel.order_no));
                            return;
                        }
                        order_amount = orderModel.order_amount; //订单金额
                    }
                    else
                    {
                        HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,找不到您要提交的订单类型!"));
                        return;
                    }
                    break;
                case "succeed":
                    //检查订单的类型(充值或购物)
                    if (order_type == DTEnums.AmountTypeEnum.Recharge.ToString()) //充值
                    {
                        amountModel = new BLL.amount_log().GetModel(order_no);
                        if (amountModel == null)
                        {
                            HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!"));
                            return;
                        }

                    }
                    else if (order_type == DTEnums.AmountTypeEnum.BuyGoods.ToString()) //购物
                    {
                        orderModel = new BLL.orders().GetModel(order_no);
                        if (orderModel == null)
                        {
                            HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!"));
                            return;
                        }
                    }
                    else
                    {
                        HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,找不到您要提交的订单类型!"));
                        return;
                    }
                    break;
            }
        }
Exemple #39
0
        /// <summary>
        /// 将在Init事件执行
        /// </summary>
        protected void payment_Init(object sender, EventArgs e)
        {
            //取得处事类型
            action = DTRequest.GetString("action");
            order_no = DTRequest.GetString("order_no");
            if (order_no.ToUpper().StartsWith("R")) //充值订单
            {
                order_type = DTEnums.AmountTypeEnum.Recharge.ToString().ToLower();
            }
            else if (order_no.ToUpper().StartsWith("B")) //商品订单
            {
                order_type = DTEnums.AmountTypeEnum.BuyGoods.ToString().ToLower();
            }
            
            switch (action)
            {
                case "confirm":
                    if (string.IsNullOrEmpty(action) || string.IsNullOrEmpty(order_no))
                    {
                        HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,URL传输参数有误!")));
                        return;
                    }
                    //是否需要支持匿名购物
                    userModel = new Web.UI.BasePage().GetUserInfo(); //取得用户登录信息
                    if (orderConfig.anonymous == 0 || order_no.ToUpper().StartsWith("R"))
                    {
                        if (userModel == null)
                        {
                            //用户未登录
                            HttpContext.Current.Response.Redirect(linkurl("payment", "?action=login"));
                            return;
                        }
                    }
                    else if (userModel == null)
                    {
                        userModel = new Model.users();
                    }
                    //检查订单的类型(充值或购物)
                    if (order_no.ToUpper().StartsWith("R")) //充值订单
                    {
                        rechargeModel = new BLL.user_recharge().GetModel(order_no);
                        if (rechargeModel == null)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!")));
                            return;
                        }
                        //检查订单号是否已支付
                        if (rechargeModel.status == 1)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("payment", "?action=succeed&order_no=" + rechargeModel.recharge_no));
                            return;
                        }
                        //检查支付方式
                        payModel = new BLL.payment().GetModel(rechargeModel.payment_id);
                        if (payModel == null)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,支付方式不存在或已删除!")));
                            return;
                        }
                        //检查是否线上支付
                        if (payModel.type == 2)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,账户充值不允许线下支付!")));
                            return;
                        }
                        order_amount = rechargeModel.amount; //订单金额
                    }
                    else if (order_no.ToUpper().StartsWith("B")) //商品订单
                    {
                        //检查订单是否存在
                        orderModel = new BLL.orders().GetModel(order_no);
                        if (orderModel == null)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!")));
                            return;
                        }
                        //检查是否已支付过
                        if (orderModel.payment_status == 2)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("payment", "?action=succeed&order_no=" + orderModel.order_no));
                            return;
                        }
                        //检查支付方式
                        payModel = new BLL.payment().GetModel(orderModel.payment_id);
                        if (payModel == null)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,支付方式不存在或已删除!")));
                            return;
                        }
                        //检查是否线下付款
                        if (orderModel.payment_status == 0)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("payment", "?action=succeed&order_no=" + orderModel.order_no));
                            return;
                        }
                        //检查是否积分换购,直接跳转成功页面
                        if (orderModel.order_amount == 0)
                        {
                            //修改订单状态
                            bool result = new BLL.orders().UpdateField(orderModel.order_no, "status=2,payment_status=2,payment_time='" + DateTime.Now + "'");
                            if (!result)
                            {
                                HttpContext.Current.Response.Redirect(linkurl("payment", "?action=error"));
                                return;
                            }
                            HttpContext.Current.Response.Redirect(linkurl("payment", "?action=succeed&order_no=" + orderModel.order_no));
                            return;
                        }
                        order_amount = orderModel.order_amount; //订单金额
                    }
                    else
                    {
                        HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,找不到您要提交的订单类型!")));
                        return;
                    }
                    break;
                case "succeed":
                    //检查订单的类型(充值或购物)
                    if (order_no.ToUpper().StartsWith("R")) //充值订单
                    {
                        rechargeModel = new BLL.user_recharge().GetModel(order_no);
                        if (rechargeModel == null)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!")));
                            return;
                        }

                    }
                    else if (order_no.ToUpper().StartsWith("B")) //商品订单
                    {
                        orderModel = new BLL.orders().GetModel(order_no);
                        if (orderModel == null)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!")));
                            return;
                        }
                    }
                    else
                    {
                        HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,找不到您要提交的订单类型!")));
                        return;
                    }
                    break;
            }
        }
Exemple #40
0
        /// <summary>
        /// 将在Init事件执行
        /// </summary>
        protected void payment_Init(object sender, EventArgs e)
        {
            //取得处事类型
            action   = DTRequest.GetString("action");
            order_no = DTRequest.GetString("order_no");
            if (order_no.ToUpper().StartsWith("R")) //充值订单
            {
                order_type = DTEnums.AmountTypeEnum.Recharge.ToString().ToLower();
            }
            else if (order_no.ToUpper().StartsWith("B")) //商品订单
            {
                order_type = DTEnums.AmountTypeEnum.BuyGoods.ToString().ToLower();
            }

            switch (action)
            {
            case "confirm":
                if (string.IsNullOrEmpty(action) || string.IsNullOrEmpty(order_no))
                {
                    HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,URL传输参数有误!")));
                    return;
                }
                //是否需要支持匿名购物
                userModel = new Web.UI.BasePage().GetUserInfo();     //取得用户登录信息
                if (orderConfig.anonymous == 0 || order_no.ToUpper().StartsWith("R"))
                {
                    if (userModel == null)
                    {
                        //用户未登录
                        HttpContext.Current.Response.Redirect(linkurl("payment", "?action=login"));
                        return;
                    }
                }
                else if (userModel == null)
                {
                    userModel = new Model.users();
                }
                //检查订单的类型(充值或购物)
                if (order_no.ToUpper().StartsWith("R"))     //充值订单
                {
                    rechargeModel = new BLL.user_recharge().GetModel(order_no);
                    if (rechargeModel == null)
                    {
                        HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!")));
                        return;
                    }
                    //检查订单号是否已支付
                    if (rechargeModel.status == 1)
                    {
                        HttpContext.Current.Response.Redirect(linkurl("payment", "?action=succeed&order_no=" + rechargeModel.recharge_no));
                        return;
                    }
                    //检查支付方式
                    payModel = new BLL.site_payment().GetPaymentModel(rechargeModel.payment_id);
                    if (payModel == null)
                    {
                        HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,支付方式不存在或已删除!")));
                        return;
                    }
                    //检查是否线上支付
                    if (payModel.type == 2)
                    {
                        HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,账户充值不允许线下支付!")));
                        return;
                    }
                    order_amount = rechargeModel.amount;     //订单金额
                }
                else if (order_no.ToUpper().StartsWith("B")) //商品订单
                {
                    //检查订单是否存在
                    orderModel = new BLL.orders().GetModel(order_no);
                    if (orderModel == null)
                    {
                        HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!")));
                        return;
                    }
                    //检查是否已支付过
                    if (orderModel.payment_status == 2)
                    {
                        HttpContext.Current.Response.Redirect(linkurl("payment", "?action=succeed&order_no=" + orderModel.order_no));
                        return;
                    }
                    //检查支付方式
                    payModel = new BLL.site_payment().GetPaymentModel(orderModel.payment_id);
                    if (payModel == null)
                    {
                        HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,支付方式不存在或已删除!")));
                        return;
                    }
                    //检查是否线下付款
                    if (orderModel.payment_status == 0)
                    {
                        HttpContext.Current.Response.Redirect(linkurl("payment", "?action=succeed&order_no=" + orderModel.order_no));
                        return;
                    }
                    //检查是否积分换购,直接跳转成功页面
                    if (orderModel.order_amount == 0)
                    {
                        //修改订单状态
                        bool result = new BLL.orders().UpdateField(orderModel.order_no, "status=2,payment_status=2,payment_time='" + DateTime.Now + "'");
                        if (!result)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("payment", "?action=error"));
                            return;
                        }
                        HttpContext.Current.Response.Redirect(linkurl("payment", "?action=succeed&order_no=" + orderModel.order_no));
                        return;
                    }
                    order_amount = orderModel.order_amount;     //订单金额
                }
                else
                {
                    HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,找不到您要提交的订单类型!")));
                    return;
                }
                break;

            case "succeed":
                //检查订单的类型(充值或购物)
                if (order_no.ToUpper().StartsWith("R"))     //充值订单
                {
                    rechargeModel = new BLL.user_recharge().GetModel(order_no);
                    if (rechargeModel == null)
                    {
                        HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!")));
                        return;
                    }
                }
                else if (order_no.ToUpper().StartsWith("B"))     //商品订单
                {
                    orderModel = new BLL.orders().GetModel(order_no);
                    if (orderModel == null)
                    {
                        HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!")));
                        return;
                    }
                }
                else
                {
                    HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,找不到您要提交的订单类型!")));
                    return;
                }
                break;
            }
        }
Exemple #41
0
        private bool DoAdd(int _id)
        {
            Model.wx_userweixin weixin = GetWeiXinCode();

            bool result = false;
            BLL.payment bll = new BLL.payment();
            Model.payment model = new Model.payment();

            model.title = txtTitle.Text.Trim();
            if (cbIsLock.Checked == true)
            {
                model.is_lock = 0;
            }
            else
            {
                model.is_lock = 1;
            }
            model.sort_id = int.Parse(txtSortId.Text.Trim());
            model.poundage_type = int.Parse(rblPoundageType.SelectedValue);
            model.poundage_amount = decimal.Parse(txtPoundageAmount.Text.Trim());
            model.img_url = txtImgUrl.Text.Trim();
            model.remark = txtRemark.Text;
            model.pTypeId = _id;
            model.wid = weixin.id;
            model.api_path = hidApi_path.Value;
            if (_id==2)
            {
                //支付宝
                BLL.wx_payment_alipay aliBll = new BLL.wx_payment_alipay();
                Model.wx_payment_alipay alipay = new Model.wx_payment_alipay();
                alipay.ownerName = txtAlipaySellerEmail.Text.Trim();
                alipay.partner = txtAlipayPartner.Text.Trim();
                alipay.e_key = txtAlipayKey.Text.Trim();
                alipay.private_key = txtprivate_key.Text.Trim();
                alipay.public_key = txtpublic_key.Text.Trim();
                alipay.sign_type = "MD5";
                alipay.wid = weixin.id;
                alipay.createDate = DateTime.Now;
                aliBll.Add(alipay);
            }
            else if (_id==3)
            {
                //微支付
                BLL.wx_payment_wxpay wxpayBll = new BLL.wx_payment_wxpay();
                Model.wx_payment_wxpay wxpay = new Model.wx_payment_wxpay();
                wxpay.wid = weixin.id;

                //财付通--相关信息
                wxpay.partnerId = txtpartnerId.Text.Trim();
                wxpay.partnerKey = txtpartnerKey.Text.Trim();
                wxpay.CertInfoPath = txtCertInfoPath.Text.Trim();
                wxpay.partnerPwd = txtPartnerPwd.Text.Trim();

                //微信--相关配置
                wxpay.paySignKey = txtpaySignKey.Text.Trim();
                wxpay.appId = txtAppId.Text.Trim();
                wxpay.quicklyFH = rblQuicklyFH.SelectedItem.Value == "1" ? true : false;
                wxpay.createDate = DateTime.Now;
                wxpayBll.Add(wxpay);
            }

            if (bll.Add(model)>0)
            {
                AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "添加支付方式:" + model.title); //记录日志
                result = true;
            }

            return result;
        }
Exemple #42
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.payment model)
 {
     return(dal.Update(model));
 }
Exemple #43
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Model.payment model)
 {
     return(dal.Add(model));
 }
Exemple #44
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.payment GetModelBypTypeId(int pTypeId)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 id,title,img_url,remark,type,poundage_type,poundage_amount,sort_id,is_lock,api_path,wid,pTypeId from " + databaseprefix + "payment ");
            strSql.Append(" where pTypeId=@pTypeId");
            SqlParameter[] parameters = {
					new SqlParameter("@pTypeId", SqlDbType.Int,4)};
            parameters[0].Value = pTypeId;

            Model.payment model = new Model.payment();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                model.title = ds.Tables[0].Rows[0]["title"].ToString();
                model.img_url = ds.Tables[0].Rows[0]["img_url"].ToString();
                model.remark = ds.Tables[0].Rows[0]["remark"].ToString();
                if (ds.Tables[0].Rows[0]["type"].ToString() != "")
                {
                    model.type = int.Parse(ds.Tables[0].Rows[0]["type"].ToString());
                }
                if (ds.Tables[0].Rows[0]["poundage_type"].ToString() != "")
                {
                    model.poundage_type = int.Parse(ds.Tables[0].Rows[0]["poundage_type"].ToString());
                }
                if (ds.Tables[0].Rows[0]["poundage_amount"].ToString() != "")
                {
                    model.poundage_amount = decimal.Parse(ds.Tables[0].Rows[0]["poundage_amount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["sort_id"].ToString() != "")
                {
                    model.sort_id = int.Parse(ds.Tables[0].Rows[0]["sort_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["is_lock"].ToString() != "")
                {
                    model.is_lock = int.Parse(ds.Tables[0].Rows[0]["is_lock"].ToString());
                }
                model.api_path = ds.Tables[0].Rows[0]["api_path"].ToString();

                if (ds.Tables[0].Rows[0]["wid"] != null && ds.Tables[0].Rows[0]["wid"].ToString() != "")
                {
                    model.wid = int.Parse(ds.Tables[0].Rows[0]["wid"].ToString());
                }
                if (ds.Tables[0].Rows[0]["pTypeId"] != null && ds.Tables[0].Rows[0]["pTypeId"].ToString() != "")
                {
                    model.pTypeId = int.Parse(ds.Tables[0].Rows[0]["pTypeId"].ToString());
                }

                return model;
            }
            else
            {
                return null;
            }
        }
Exemple #45
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            BLL.wx_shop_cart            cartBll  = new BLL.wx_shop_cart();
            string                      _action  = MyCommFun.QueryString("myact");
            string                      openid   = MyCommFun.RequestOpenid(); //得到微信用户的openid
            Dictionary <string, string> jsonDict = new Dictionary <string, string>();

            if (_action == "addCart")
            {
                #region 添加购物车
                try
                {
                    int     wid        = MyCommFun.RequestInt("wid");
                    int     productId  = MyCommFun.RequestInt("productid");
                    int     skuId      = MyCommFun.RequestInt("mid");
                    string  skuInfo    = MyCommFun.QueryString("attr");
                    int     productNum = MyCommFun.RequestInt("bc");
                    decimal totalPrice = (decimal)MyCommFun.RequestFloat("totprice", 0);

                    Model.wx_shop_cart cart = new Model.wx_shop_cart();

                    IList <Model.wx_shop_cart> cartList = cartBll.GetModelList("productId=" + productId + " and openid='" + openid + "' and skuId=" + skuId);
                    bool isAdd = true;
                    if (cartList != null && cartList.Count > 0)
                    {
                        isAdd = false;
                        cart  = cartList[0];
                    }
                    if (isAdd)
                    {
                        cart.createDate = DateTime.Now;
                        cart.openid     = openid;
                        cart.productId  = productId;
                        cart.productNum = productNum;
                        cart.skuId      = skuId;
                        cart.skuInfo    = skuInfo;
                        cart.totPrice   = totalPrice * productNum;
                        cart.wid        = wid;
                        int ret = cartBll.Add(cart);
                        if (ret > 0)
                        {
                            jsonDict.Add("errCode", "false");
                        }
                        else
                        {
                            jsonDict.Add("errCode", "true");
                        }
                    }
                    else
                    {
                        cart.openid = openid;

                        cart.productNum += productNum;
                        cart.skuId       = skuId;
                        cart.skuInfo     = skuInfo;
                        cart.totPrice   += totalPrice * productNum;
                        cart.wid         = wid;
                        bool ret = cartBll.Update(cart);
                        if (ret)
                        {
                            jsonDict.Add("errCode", "false");
                        }
                        else
                        {
                            jsonDict.Add("errCode", "true");
                        }
                    }
                }
                catch (Exception ex)
                {
                    jsonDict.Add("errCode", "true");
                }
                finally
                {
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
                #endregion
            }
            else if (_action == "pcount")
            {
                #region 购物车商品数量
                jsonDict = new Dictionary <string, string>();
                int wid   = MyCommFun.RequestInt("wid");
                int count = cartBll.GetRecordCount("wid=" + wid + " and openid='" + openid + "'");
                jsonDict.Add("data", count.ToString());
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                #endregion
            }
            else if (_action == "remove")
            {
                #region 移除购物车商品
                jsonDict = new Dictionary <string, string>();
                int cartId = MyCommFun.RequestInt("id");
                cartBll.Delete(cartId);
                jsonDict.Add("errCode", "false");
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                #endregion
            }
            else if (_action == "modifyNum")
            {
                #region 修改购物车商品数量
                jsonDict = new Dictionary <string, string>();
                int cartId = MyCommFun.RequestInt("ic");
                int newNum = MyCommFun.RequestInt("bc");
                cartBll.UpdateNum(cartId, newNum);
                jsonDict.Add("errCode", "false");
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                #endregion
            }
            else if (_action == "getCity")
            {
                #region  择省份,改变城市列表
                int privice = MyCommFun.RequestInt("pvid");
                BLL.pre_common_district           areaBll = new BLL.pre_common_district();
                IList <Model.pre_common_district> disList = areaBll.GetModelList("upid=" + privice + " and level=2");
                Model.pre_common_district         dis;
                StringBuilder jsonStr = new StringBuilder("{\"errCode\":0,\"retCode\":0,\"msgType\":0,\"errMsg\":\"\",\"data\":[");
                for (int i = 0; i < disList.Count; i++)
                {
                    dis = new Model.pre_common_district();
                    if (i != disList.Count - 1)
                    {
                        jsonStr.Append("{\"id\":" + disList[i].id + ",\"name\":\"" + disList[i].name + "\"},");
                    }
                    else
                    {
                        jsonStr.Append("{\"id\":" + disList[i].id + ",\"name\":\"" + disList[i].name + "\"}");
                    }
                }
                jsonStr.Append("]}");
                context.Response.Write(jsonStr);
                #endregion
            }
            else if (_action == "getArea")
            {
                #region  择城市,改变区域列表
                int ctid = MyCommFun.RequestInt("ctid");
                BLL.pre_common_district           areaBll = new BLL.pre_common_district();
                IList <Model.pre_common_district> disList = areaBll.GetModelList("upid=" + ctid + " and level=3");
                Model.pre_common_district         dis;
                StringBuilder jsonStr = new StringBuilder("{\"errCode\":0,\"retCode\":0,\"msgType\":0,\"errMsg\":\"\",\"data\":[");
                for (int i = 0; i < disList.Count; i++)
                {
                    dis = new Model.pre_common_district();
                    if (i != disList.Count - 1)
                    {
                        jsonStr.Append("{\"id\":" + disList[i].id + ",\"name\":\"" + disList[i].name + "\"},");
                    }
                    else
                    {
                        jsonStr.Append("{\"id\":" + disList[i].id + ",\"name\":\"" + disList[i].name + "\"}");
                    }
                }
                jsonStr.Append("]}");
                context.Response.Write(jsonStr);
                #endregion
            }
            else if (_action == "order_save")
            {
                #region 保存订单信息
                //获得传参信息
                int wid = MyCommFun.RequestInt("wid");

                int payment_id = MyCommFun.RequestInt("pc");    //支付方式:1货到付款;3微支付
                int express_id = MyCommFun.RequestInt("mtype"); //物流方式
                // string orderStrList = MyCommFun.QueryString("orderStrList");

                //检查物流方式
                if (express_id == 0)
                {
                    context.Response.Write("{\"errCode\":3, \"msg\":\"对不起,请选择配送方式!\"}");
                    return;
                }
                BLL.wx_shop_user_addr           uAddrBll  = new BLL.wx_shop_user_addr();
                IList <Model.wx_shop_user_addr> uaddrList = uAddrBll.GetOpenidAddrName(openid, wid);
                if (uaddrList == null || uaddrList.Count <= 0 || uaddrList[0].id <= 0)
                {
                    context.Response.Write("{\"errCode\":3, \"msg\":\"收货地址不存在,无法结算!\"}");
                    return;
                }


                //检查购物车商品
                IList <Model.cartProduct> cartList = cartBll.GetCartList(openid, wid);
                if (cartList == null)
                {
                    context.Response.Write("{\"errCode\":3, \"msg\":\"对不起,购物车为空,无法结算!\"}");
                    return;
                }
                //统计购物车
                decimal payable_amount = cartList.Sum(c => c.totPrice);
                //物流费用
                BLL.express   expressBll = new BLL.express();
                Model.express expModel   = expressBll.GetModel(express_id);
                //支付方式
                BLL.payment   pbll     = new BLL.payment();
                Model.payment payModel = pbll.GetModelBypTypeId(payment_id);
                //保存订单=======================================================================
                Model.orders model = new Model.orders();
                model.order_no = "b" + Utils.GetOrderNumber(); //订单号B开头为商品订单

                model.wid             = wid;
                model.openid          = openid;
                model.modelName       = "微商城";
                model.modelCode       = "shop";
                model.modelActionName = "";
                model.modelActionId   = 0;
                model.user_id         = 0;
                model.user_name       = "";
                model.payment_id      = payment_id;
                model.express_id      = express_id;
                model.accept_name     = uaddrList[0].contractPerson;
                model.post_code       = "";
                model.telphone        = uaddrList[0].tel;
                model.mobile          = uaddrList[0].tel;
                model.area            = uaddrList[0].province;
                model.city            = uaddrList[0].city;
                model.district        = uaddrList[0].area;
                model.address         = uaddrList[0].province + " " + uaddrList[0].city + " " + uaddrList[0].area + " " + uaddrList[0].addrDetail;
                model.message         = "";
                model.payable_amount  = payable_amount; //应付商品总金额
                model.real_amount     = payable_amount; //实际商品总金额,
                model.status          = 1;
                model.express_status  = 1;
                model.express_fee     = expModel.express_fee; //物流费用

                if (payment_id == 1)
                {                             //货到付款,需要确认订单
                    model.payment_status = 0; //标记未付款
                }
                else
                {                             //先款后货
                    model.payment_status = 1; //标记未付款
                }
                bool quicklyFH = false;
                //如果是先款后货的话
                if (payment_id == 3)
                {
                    if (payModel.poundage_type == 1) //百分比
                    {
                        model.payment_fee = model.real_amount * payModel.poundage_amount / 100;
                    }
                    else //固定金额
                    {
                        model.payment_fee = payModel.poundage_amount;
                    }
                    BLL.wx_payment_wxpay   wxBll = new BLL.wx_payment_wxpay();
                    Model.wx_payment_wxpay wxpay = wxBll.GetModelByWid(wid);
                    quicklyFH = wxpay.quicklyFH;
                }
                if (quicklyFH)
                {
                    model.express_status = 0;
                }
                //订单总金额=实付商品金额+运费+支付手续费
                model.order_amount = model.real_amount + model.express_fee + model.payment_fee;
                //购物积分,可为负数
                model.point    = 0;
                model.add_time = DateTime.Now;
                //商品详细列表
                List <Model.order_goods> gls = new List <Model.order_goods>();
                foreach (Model.cartProduct item in cartList)
                {
                    gls.Add(new Model.order_goods {
                        goods_id = item.productId, goods_title = item.productName, goods_price = item.avgPrice, real_price = item.avgPrice, quantity = item.productNum, point = 0
                    });
                }
                model.order_goods = gls;
                int result = new BLL.orders().Add(model);
                if (result < 1)
                {
                    context.Response.Write("{\"errCode\":3, \"msg\":\"订单保存过程中发生错误,请重新提交!\"}");
                    return;
                }

                //清空购物车,此步骤移到确认支付页面
                //
                //提交成功,返回URL  order_no
                context.Response.Write("{\"errCode\":true,\"payType\":\"" + payment_id + "\", \"order_no\":\"" + model.order_no + "\",\"orderid\":\"" + result + "\",\"wid\":\"" + wid + "\",\"openid\":\"" + openid + "\",\"payable_amount\":\"" + payable_amount + "\", \"msg\":\"恭喜您,订单已成功提交!\"}");
                return;

                #endregion
            }
            else if (_action == "order_canel")
            {
                #region  //取消订单
                int        orderid = MyCommFun.RequestInt("order_id");
                BLL.orders oBll    = new BLL.orders();
                oBll.UpdateField(orderid, "status=4");
                context.Response.Write("{\"errCode\":true, \"msg\":\"订单已取消!\"}");
                #endregion
            }
            else if (_action == "shouhuo")
            {
                #region  //确认收货
                int          orderid = MyCommFun.RequestInt("order_id");
                BLL.orders   oBll    = new BLL.orders();
                Model.orders order   = oBll.GetModel(orderid);
                if (order.payment_id == 1)
                {
                    //货到付款
                    oBll.UpdateField(orderid, "express_status=2,payment_status=2 , status=3");
                }
                else
                {
                    //在线支付
                    oBll.UpdateField(orderid, "express_status=2,payment_status=2 , status=3");
                }

                context.Response.Write("{\"errCode\":true, \"msg\":\"确认收货!\"}");
                #endregion
            }
            else if (_action == "clearMyOrder")
            {
                #region 清空我的购物车订单,在支付页面,支付成功后执行此功能
                int wid = MyCommFun.RequestInt("wid");
                cartBll.RemoveCartInfo(wid, openid);
                #endregion
            }
        }