Пример #1
0
        public int Insert(EqifaLogInfo oParam)
        {
            string sql = @"INSERT INTO Eqifa_Log
                            (
                            SOSysNo, ProductSysNo, Quantity, Price,
                            EqifaLog
                            )
                            VALUES (
                            @SOSysNo, @ProductSysNo, @Quantity, @Price,
                            @EqifaLog
                            );set @SysNo = SCOPE_IDENTITY();";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramSOSysNo = new SqlParameter("@SOSysNo", SqlDbType.Int, 4);
            SqlParameter paramProductSysNo = new SqlParameter("@ProductSysNo", SqlDbType.Int, 4);
            SqlParameter paramQuantity = new SqlParameter("@Quantity", SqlDbType.Int, 4);
            SqlParameter paramPrice = new SqlParameter("@Price", SqlDbType.Decimal, 9);
            SqlParameter paramEqifaLog = new SqlParameter("@EqifaLog", SqlDbType.NVarChar, 2000);
            paramSysNo.Direction = ParameterDirection.Output;
            if (oParam.SOSysNo != AppConst.IntNull)
                paramSOSysNo.Value = oParam.SOSysNo;
            else
                paramSOSysNo.Value = System.DBNull.Value;
            if (oParam.ProductSysNo != AppConst.IntNull)
                paramProductSysNo.Value = oParam.ProductSysNo;
            else
                paramProductSysNo.Value = System.DBNull.Value;
            if (oParam.Quantity != AppConst.IntNull)
                paramQuantity.Value = oParam.Quantity;
            else
                paramQuantity.Value = System.DBNull.Value;
            if (oParam.Price != AppConst.DecimalNull)
                paramPrice.Value = oParam.Price;
            else
                paramPrice.Value = System.DBNull.Value;
            if (oParam.EqifaLog != AppConst.StringNull)
                paramEqifaLog.Value = oParam.EqifaLog;
            else
                paramEqifaLog.Value = System.DBNull.Value;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramSOSysNo);
            cmd.Parameters.Add(paramProductSysNo);
            cmd.Parameters.Add(paramQuantity);
            cmd.Parameters.Add(paramPrice);
            cmd.Parameters.Add(paramEqifaLog);

            return SqlHelper.ExecuteNonQuery(cmd, out oParam.SysNo);
        }
Пример #2
0
        public int Update(EqifaLogInfo oParam)
        {
            string sql = @"UPDATE Eqifa_Log SET
                            SOSysNo=@SOSysNo, ProductSysNo=@ProductSysNo,
                            Quantity=@Quantity, Price=@Price,
                            EqifaLog=@EqifaLog
                            WHERE SysNo=@SysNo";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramSOSysNo = new SqlParameter("@SOSysNo", SqlDbType.Int, 4);
            SqlParameter paramProductSysNo = new SqlParameter("@ProductSysNo", SqlDbType.Int, 4);
            SqlParameter paramQuantity = new SqlParameter("@Quantity", SqlDbType.Int, 4);
            SqlParameter paramPrice = new SqlParameter("@Price", SqlDbType.Decimal, 9);
            SqlParameter paramEqifaLog = new SqlParameter("@EqifaLog", SqlDbType.NVarChar, 2000);

            if (oParam.SysNo != AppConst.IntNull)
                paramSysNo.Value = oParam.SysNo;
            else
                paramSysNo.Value = System.DBNull.Value;
            if (oParam.SOSysNo != AppConst.IntNull)
                paramSOSysNo.Value = oParam.SOSysNo;
            else
                paramSOSysNo.Value = System.DBNull.Value;
            if (oParam.ProductSysNo != AppConst.IntNull)
                paramProductSysNo.Value = oParam.ProductSysNo;
            else
                paramProductSysNo.Value = System.DBNull.Value;
            if (oParam.Quantity != AppConst.IntNull)
                paramQuantity.Value = oParam.Quantity;
            else
                paramQuantity.Value = System.DBNull.Value;
            if (oParam.Price != AppConst.DecimalNull)
                paramPrice.Value = oParam.Price;
            else
                paramPrice.Value = System.DBNull.Value;
            if (oParam.EqifaLog != AppConst.StringNull)
                paramEqifaLog.Value = oParam.EqifaLog;
            else
                paramEqifaLog.Value = System.DBNull.Value;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramSOSysNo);
            cmd.Parameters.Add(paramProductSysNo);
            cmd.Parameters.Add(paramQuantity);
            cmd.Parameters.Add(paramPrice);
            cmd.Parameters.Add(paramEqifaLog);

            return SqlHelper.ExecuteNonQuery(cmd);
        }
Пример #3
0
        /// <summary>
        /// 确认无误提交订单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                if (!CheckLimitedQtyProduct())
                    return;
                bool saveSOInfo = this.SaveSO();
                if (saveSOInfo == false)
                    return;
                soInfo.SalesManSysNo = AppConst.IcsonSalesMan;
                ////记录浩方订单
                //if (Session["LinkSource"] != null && Session["LinkSource"] as string == AppConfig.PartnerLinkSource)
                //{
                //    soInfo.SalesManSysNo = int.Parse(AppConfig.PartnerSysNo);
                //}
                //检验客户一分钟内是否有订单生成,防止重复下订单
                if (!SaleManager.GetInstance().SOCreatePreCheck(soInfo.CustomerSysNo))
                {
                    this.ShowMsg("请不要在1分钟之内重复下单。请到帐户中心查看您的订单");
                    return;
                }

                if (chkInvoice.Checked == true)
                {
                    if (chkInvoice.Checked == true)
                        vatInfo.Style.Add("display", "block");
                    else
                        vatInfo.Style.Add("display", "none");
                    if (txtCompanyName.Text.Trim() == AppConst.StringNull)
                    {
                        this.ShowMsg("开票公司名称不能为空!");
                        return;
                    }
                    if (txtCompanyAddr.Text.Trim() == AppConst.StringNull)
                    {
                        this.ShowMsg("开票公司地址不能为空!");
                        return;
                    }
                    if (txtCompanyPhone.Text.Trim() == AppConst.StringNull)
                    {
                        this.ShowMsg("开票公司电话不能为空!");
                        return;
                    }
                    if (txtBankAndAccount.Text.Trim() == AppConst.StringNull)
                    {
                        this.ShowMsg("开票开户银行及帐号不能为空!");
                        return;
                    }
                    if (txtTaxNum.Text.Trim() == AppConst.StringNull)
                    {
                        this.ShowMsg("开票公司税务登记号不能为空!");
                        return;
                    }

                    soInfo.IsVAT = (int)AppEnum.YNStatus.Yes;
                    soInfo.RequestInvoiceTime = DateTime.Now;
                    soInfo.RequestInvoiceType = (int)AppEnum.InvoiceType.SpecialVATInvoice;
                    soInfo.InvoiceStatus = (int)AppEnum.SOInvoiceStatus.InvoiceAbsent;
                }

                #region
                bool payTapyCheck = false;
                bool shipTypeCheck = false;

                foreach (DataGridItem dgItem in this.dgShipType.Items)
                {
                    RadioButton rdo = dgItem.FindControl("rdoSelectShipType") as RadioButton;
                    if (rdo.Checked)
                    {
                        soInfo.ShipTypeSysNo = Int32.Parse(dgShipType.DataKeys[dgItem.ItemIndex].ToString());
                        shipTypeCheck = true;
                        break;
                    }
                }
                if (chkIsPremium.Checked)
                {
                    soInfo.IsPremium = (int)AppEnum.YNStatus.Yes;
                }
                else
                    soInfo.IsPremium = (int)AppEnum.YNStatus.No;

                if (!shipTypeCheck)
                {
                    ShowMsg("您还没有选择配送方式");
                    return;
                }

                foreach (DataGridItem dgItem in this.dgPayType.Items)
                {
                    RadioButton rdo = dgItem.FindControl("rdoSelectPayType") as RadioButton;
                    if (rdo.Checked)
                    {
                        soInfo.PayTypeSysNo = Int32.Parse(dgPayType.DataKeys[dgItem.ItemIndex].ToString());
                        payTapyCheck = true;
                        break;
                    }
                }
                if (!payTapyCheck)
                {
                    this.ShowMsg("您还没有选择支付方式");
                    return;
                }

                soInfo.IsPremium = (int)AppEnum.YNStatus.No;
                soInfo.IsVAT = (int)AppEnum.YNStatus.No;
                soInfo.IsWholeSale = (int)AppEnum.YNStatus.No;
                soInfo.VATEMSFee = 0;
                soInfo.VatInfo.VATEMSFee = 0;
                soInfo.FreeShipFeePay = 0;

                #endregion

                soInfo.DeliveryDate = DateTime.Today;
                oSession.sSO = soInfo;
                SaleManager.GetInstance().CreateSO(soInfo);

                //if (soInfo.CouponCode.Length > 0 && soInfo.CouponAmt > 0 && soInfo.CouponType == 1) //宽带山
                //{
                //    try
                //    {
                //        string url = "http://club.pchome.net/union/icson/checkHashCode.php?action=1&code=" + soInfo.CouponCode;
                //        System.Net.WebClient wc = new System.Net.WebClient();
                //        System.IO.Stream stream = wc.OpenRead(url);
                //        wc.Dispose();
                //        stream.Close();
                //    }
                //    catch { }
                //}

                oSession.sCustomer = CustomerManager.GetInstance().Load(oSession.sCustomer.SysNo);
                try
                {
                    LogInfo log = new LogInfo();
                    log.OptIP = Request.UserHostAddress;
                    log.OptTime = DateTime.Now;
                    log.TicketSysNo = soInfo.SysNo;
                    log.TicketType = (int)AppEnum.LogType.Sale_SO_Create;
                    log.OptUserSysNo = soInfo.SalesManSysNo;
                    LogManager.GetInstance().Write(log);
                    SaleManager.GetInstance().SendEmail(soInfo, (int)AppEnum.SOEmailType.CreateSO);
                }
                catch (Exception ex)
                {
                    ErrorLog.GetInstance().Write(ex.Message);
                }
                //更新增票信息
                if (chkInvoice.Checked == true)
                {
                    try
                    {
                        SOVATInfo vat = new SOVATInfo();
                        vat.SOSysNo = soInfo.SysNo;
                        vat.BankAccount = txtBankAndAccount.Text.Trim();
                        vat.TaxNum = txtTaxNum.Text.Trim();
                        vat.CompanyAddress = txtCompanyAddr.Text.Trim();
                        vat.CompanyName = txtCompanyName.Text.Trim();
                        vat.CompanyPhone = txtCompanyPhone.Text.Trim();
                        vat.CustomerSysNo = oSession.sCustomer.SysNo;
                        vat.CreateTime = DateTime.Now;
                        vat.Memo = txtOthers.Text.Trim();
                        SaleManager.GetInstance().InsertSOVAT(vat);
                    }
                    catch
                    {
                        this.ShowMsg("增票信息更新失败,请联系MMMbuy.cn ");
                    }
                }

                //订单生成成功,清除购物车以及赠品信息
                CartManager.GetInstance().ClearCart();
                oSession.GiftHash.Clear();
                //转到支付页面
                PayTypeInfo ptInfo = ASPManager.GetInstance().LoadPayType(soInfo.PayTypeSysNo);
                if (ptInfo.PaymentPage != string.Empty)
                {
                    //Response.Redirect(ptInfo.PaymentPage + "?id=" + soInfo.SysNo.ToString() + "&sono=" + soInfo.SOID + "&soamt=" + SaleManager.GetInstance().GetEndMoney(soInfo).ToString(AppConst.DecimalFormat) + "&sodate=" + soInfo.OrderDate.ToString("yyyy-MM-dd HH:mm:ss"));
                    try
                    {
                        //if (Request.Cookies["EqifaInfo"] != null && Request.Cookies["EqifaInfo"].Value != null && Request.Cookies["EqifaInfo"].Value.Length > 0)
                        //{
                        //    string merchant_id = "icson"; //广告主在EQIFA的帐号名
                        //    string eqifa_user_id = oSession.sCustomer.CustomerID; //会员帐号名称
                        //    string eqifa_user_name = oSession.sCustomer.CustomerName; //会员真实姓名
                        //    string eqifa_o_cd = soInfo.SysNo.ToString(); //用户订单号

                        //    string eqifa_p_cd = "";                        //一种商品编号
                        //    string eqifa_p_cnt = "1";			           //一种商品数量
                        //    string eqifa_p_price = soInfo.SOAmt.ToString();//一种商品价格
                        //    string eqifa_p_ccd = "";	                   //一种商品分类编号

                        //    string eqifa_info = Request.Cookies["EqifaInfo"].Value;
                        //    eqifa_info = Server.UrlDecode(eqifa_info);

                        //    if (eqifa_info.Replace("'", "''").Length != 0)
                        //    {
                        //        string eqifa_log = "http://service.eqifa.com/purchase_cps.aspx?a_id=" + eqifa_info;
                        //        eqifa_log += "&m_id=" + merchant_id + "&mbr_id=" + eqifa_user_id + "(" + eqifa_user_name + ")";
                        //        eqifa_log += "&o_cd=" + eqifa_o_cd + "&p_cd=" + eqifa_p_cd;
                        //        eqifa_log += "&p_cnt=" + eqifa_p_cnt + "&p_price=" + eqifa_p_price + "&p_ccd=" + eqifa_p_ccd;
                        //        eqifa_log = "<script src='" + eqifa_log + "'></script>";

                        //        //Response.Write(eqifa_log);
                        //        //Response.Write("<script src='http://icson-mis.3322.org/Temp.aspx?id=" + soInfo.SOID + "'></script>");

                        //        EqifaLogInfo eInfo = new EqifaLogInfo();
                        //        eInfo.SOSysNo = soInfo.SysNo;
                        //        eInfo.ProductSysNo = 1;
                        //        eInfo.Quantity = 1;
                        //        eInfo.Price = soInfo.SOAmt;
                        //        eInfo.EqifaLog = eqifa_log;

                        //        EqifaLogManager.GetInstance().Insert(eInfo);
                        //    }
                        //}
                        if (Request.Cookies["LSInfo"] != null && Request.Cookies["LSInfo"].Value != null && Request.Cookies["LSInfo"].Value.Length > 0)
                        {
                            EqifaLogInfo eInfo = new EqifaLogInfo();
                            eInfo.SOSysNo = soInfo.SysNo;
                            eInfo.ProductSysNo = 1;
                            eInfo.Quantity = 1;
                            eInfo.Price = soInfo.SOAmt;
                            eInfo.EqifaLog = Request.Cookies["LSInfo"].Value;

                            EqifaLogManager.GetInstance().Insert(eInfo);
                        }
                        else if (Session["LinkSource"] != null && Session["LinkSource"].ToString().Length > 0 && Session["LinkSource"].ToString().Trim().IndexOf("www.ICSON.com") == -1)
                        {
                            EqifaLogInfo eInfo = new EqifaLogInfo();
                            eInfo.SOSysNo = soInfo.SysNo;
                            eInfo.ProductSysNo = 1;
                            eInfo.Quantity = 1;
                            eInfo.Price = soInfo.SOAmt;
                            eInfo.EqifaLog = Session["LinkSource"].ToString().Trim();

                            EqifaLogManager.GetInstance().Insert(eInfo);
                        }
                    }
                    finally
                    {
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", "<script>location.href='" + ptInfo.PaymentPage + "?id=" + soInfo.SysNo.ToString() + "&sono=" + soInfo.SOID + "&soamt=" + SaleManager.GetInstance().GetEndMoney(soInfo).ToString(AppConst.DecimalFormat) + "&sodate=" + soInfo.OrderDate.ToString("yyyy-MM-dd HH:mm:ss") + "'</script>");
                    }
                }
                else
                {
                    Response.Redirect("../CustomError.aspx?msg=页面转向时发生错误!但是订单已经成功生成,订单号是:" + soInfo.SOID + "!");
                }
            }
            catch (BizException be)
            {
                if (be.Message.IndexOf("inventory: qty is not enough") != -1)
                {
                    this.ShowMsg("库存不足,请返回购物车重试");
                }
                else if (be.Message.IndexOf("inventory_stock: qty is not enough") != -1)
                {
                    this.ShowMsg("库存不足,请返回购物车重试");
                }
                else if (be.Message.IndexOf("客户积分更新失败") != -1)
                {
                    this.ShowMsg("您的积分不足,不能支付");
                }
                else
                {
                    this.ShowMsg(be.Message);
                }
            }
            catch (Exception ex)
            {
                ErrorLog.GetInstance().Write("订单生成失败:" + ex.Message);
                this.ShowMsg("订单生成失败,请重试或者电话联系MMMbuy.cn ");
            }
        }