Exemple #1
0
    public OrderFinalModel GetDataModelFx1(int mType, string storeid, out IList <MemberDetailsModel> choseProList, int flag)
    {
        OrderFinalModel ofm = new OrderFinalModel();

        LetUsOrder luo = new LetUsOrder();

        luo.SetVlaue();
        //OrderFinalModel ofm2 = ((OrderFinalModel)HttpContext.Current.Session["fxMemberModel"]);

        RegistermemberBLL registermemberBLL = new RegistermemberBLL();

        MemberInfoModel mim = new MemberInfoModel();

        mim.Number  = luo.MemBh;
        mim.StoreID = storeid;
        int OType = luo.OrderType;

        ofm.Number    = luo.MemBh;
        ofm.Placement = "";
        ofm.Direct    = "";
        ofm.ExpectNum = CommonDataBLL.getMaxqishu();
        ofm.OrderID   = ofm.OrderID = new RegistermemberBLL().GetOrderInfo("add", null);
        ofm.StoreID   = storeid;
        ofm.Name      = "";
        ofm.PetName   = "";
        ofm.LoginPass = "";
        ofm.AdvPass   = "";
        ofm.LevelInt  = 1;

        ofm.RegisterDate            = DateTime.Now;
        ofm.Birthday                = DateTime.Now;
        ofm.Sex                     = 0;
        ofm.HomeQuhao               = "";
        ofm.HomeTele                = "";
        ofm.OfficeQuhao             = "";
        ofm.OfficeTele              = "";
        ofm.OfficeFjh               = "";
        ofm.MobileTele              = "";
        ofm.FaxQuhao                = "";
        ofm.FaxTele                 = "";
        ofm.FaxFjh                  = "";
        ofm.CPCCode                 = "";
        ofm.Address                 = "";
        ofm.PostalCode              = "";
        ofm.PaperType.PaperTypeCode = "";
        ofm.PaperNumber             = "";
        ofm.BankCode                = "";
        ofm.BankAddress             = "";
        ofm.BankCard                = "";
        ofm.BCPCCode                = "";
        ofm.BankBook                = "";
        ofm.Remark                  = "";
        ofm.ChangeInfo              = "";
        ofm.Healthy                 = 1;
        ofm.PhotoPath               = "";
        ofm.PhotoW                  = 0;
        ofm.PhotoH                  = 0;
        ofm.Email                   = "";
        ofm.IsBatch                 = 0;
        ofm.Language                = 1;
        ofm.OperateIp               = "";
        ofm.OperaterNum             = "";
        ofm.District                = 1;
        ofm.Answer                  = "";
        ofm.Question                = "";
        ofm.Error                   = "";
        ofm.Bankbranchname          = "";
        ofm.Flag                    = flag;

        //memberorder开始
        DataTable dt11 = GetMoneyAndProMess(mim.Number, mType, OType);

        if (dt11.Rows.Count > 0)
        {
            ofm.TotalMoney = Convert.ToDecimal(MemberOrderAgainBLL.GetBzMoney(mim.StoreID, Convert.ToDouble(dt11.Rows[0]["TotalPriceAll"])));
            ofm.TotalPv    = Convert.ToDecimal(dt11.Rows[0]["TotalPvAll"]);
        }
        else
        {
            ofm.TotalMoney = 0;
            ofm.TotalPv    = 0;
        }

        ofm.PayExpect   = ofm.ExpectNum;
        ofm.OrderExpect = ofm.ExpectNum;
        //ofm.IsAgain = ofm2.IsAgain;
        ofm.OrderDate   = DateTime.Now.ToUniversalTime();
        ofm.DefrayState = 0; //ofm2.DefrayState;

        ofm.OrderType = OType;

        //   ofm.Type
        //ofm.OrderType  ofm.CCPCCode  ofm.ConAddress ofm.ConTelPhone ofm.ConMobilPhone  ofm.ConPost
        //ofm.Consignee ofm.ConZipCode ofm.SendWay 不在此处理
        ofm.RemittancesId         = "";
        ofm.ElectronicaccountId   = "";
        ofm.DefrayType            = -1;//ofm2.DefrayType;
        ofm.PayCurrency           = -1;
        ofm.PayMoney              = 0;
        ofm.StandardCurrency      = MemberOrderAgainBLL.GetBzTypeId(mim.StoreID);
        ofm.StandardcurrencyMoney = Convert.ToDecimal(dt11.Rows[0]["TotalPriceAll"]);
        ofm.CarryMoney            = 0;
        ofm.IsreceiVables         = 0;
        ofm.IsRetail              = 0;
        ofm.DeclareMoney          = 0;
        ofm.PaymentMoney          = 0;

        DataTable dt22 = GetProMess(mim.Number, mType, OType);

        choseProList = AddMemberDetails(dt22);
        if (ofm.SendWay == 0)
        {
            ofm.EnoughProductMoney = Convert.ToDecimal(registermemberBLL.getEnoughProductMoney(choseProList, mim.StoreID));
            double notEnoughmoney = registermemberBLL.CheckMoneyIsEnough(choseProList, mim.StoreID);
            ofm.LackProductMoney = Convert.ToDecimal(registermemberBLL.ChangeNotEnoughMoney(mim.StoreID, notEnoughmoney));
        }
        else
        {
            ofm.EnoughProductMoney = 0;
            ofm.LackProductMoney   = ofm.TotalMoney;
        }
        if (dt22.Rows.Count > 0)
        {
            string proNum     = "";
            string proId      = "";
            string notProList = "";
            for (int i = 0; i < dt22.Rows.Count; i++)
            {
                proNum     += dt22.Rows[i]["proNum"].ToString() + ",";
                proId      += dt22.Rows[i]["proId"].ToString() + ",";
                notProList += choseProList[i].NotEnoughProduct.ToString() + ",";
            }

            ofm.ProductIDList        = proId;
            ofm.QuantityList         = proNum;
            ofm.NotEnoughProductList = notProList;
        }
        else
        {
            ofm.ProductIDList        = ",";
            ofm.QuantityList         = ",";
            ofm.NotEnoughProductList = ",";
        }

        return(ofm);
    }
Exemple #2
0
    protected void btnEditProduct_Click(object sender, EventArgs e)
    {
        if (CountryCity2.CheckFill() == false)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('请选择地址!')</script>");
            return;
        }
        if (Txtdz.Text.Trim() == "")
        {
            ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('请填写地址!')</script>");
            return;
        }

        string OrderId = Request.QueryString["OrderID"].ToString();
        string bianhao = Request.QueryString["Number"].ToString();

        SqlDataReader hydr       = DAL.DBHelper.ExecuteReader("select PayCurrency,DefrayType from MemberOrder where orderid='" + OrderId + "'");
        string        fukuanMode = "";
        int           bizhong    = 0;

        if (hydr.Read())
        {
            fukuanMode = hydr["DefrayType"].ToString();
            bizhong    = Convert.ToInt32(hydr["PayCurrency"]);

            hydr.Close();
        }
        else
        {
            ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('订单不存在')</script>");
            return;
        }

        string error = "";
        //获取用户选择商品的集合

        IList <MemberDetailsModel> choseProList = AddMemberDetails();

        if (choseProList == null)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + this.GetTran("000294", "抱歉!购货数量必须输入数字!") + "');</script>", false);
            return;
        }
        if (choseProList.Count == 0 && Request.QueryString["tp"] == "-1")
        {
            ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + this.GetTran("000296", "抱歉!您还没有选择商品!") + "');</script>", false);
            return;
        }
        if (Convert.ToBoolean(ViewState["StateCount"]))
        {
            ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("007039", "对不起,您选择了停售产品,并且超出了店铺库存数量!") + "');</script>", false);
            return;
        }


        //获得总的购货金额和pv
        double TotalMoney = registermemberBLL.getZongJing(choseProList);
        double SumPv      = registermemberBLL.getZongPv(choseProList);

        double bottonLine = new BLL.Registration_declarations.AddOrderBLL().GetBottomLine();
        double ce         = TotalMoney - bottonLine;

        if (ce < 0)
        {
            ScriptHelper.SetAlert(Page, "报单金额必须大于" + bottonLine.ToString());
            return;
        }

        //无货总金额
        double notEnoughmoney = registermemberBLL.CheckMoneyIsEnough(choseProList, GetStoreID(), OrderId);

        //if (Ddzf.SelectedValue != "2")
        //{
        //    if (notEnoughmoney > Convert.ToDouble(ViewState["dpm"]))
        //    {
        //        ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('店铺报单额不够!')</script>");
        //        return;
        //    }
        //}
        if (this.Ddzf.SelectedValue.ToString() == "2")
        {
            string elcNumber      = this.txtdzbh.Text.Trim().ToLower();
            string elcPassword    = Encryption.Encryption.GetEncryptionPwd(this.txtdzmima.Text, elcNumber);
            string CheckEctResult = registermemberBLL.CheckEctPassWord(this.Ddzf.SelectedValue, elcNumber, elcPassword);
            if (CheckEctResult != null)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + CheckEctResult + "');</script>", false);
                return;
            }

            //需要修改
            double elcMoney = Convert.ToDouble(CommonDataBLL.EctBalance(txtdzbh.Text.Trim()));
            //如果电子金额少于用户订单总额
            if (elcMoney < Convert.ToDouble(TotalMoney))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("001528", "用户") + this.txtdzbh.Text.Trim() + GetTran("001529", "的电子钱包不够本次报单!") + "');</script>", false);
                return;
            }
        }
        //有货总金额
        double EnoughProductMoney = 0.00;//Convert.ToDouble(registermemberBLL.getEnoughProductMoney(choseProList, GetStoreID()));

        int qs = BLL.CommonClass.CommonDataBLL.getMaxqishu();

        List <MemberDetailsModel> lmdm = new List <MemberDetailsModel>();

        lmdm = (List <MemberDetailsModel>)choseProList;

        if (Session["mim"] != null)
        {
            MemberInfoModel mim = (MemberInfoModel)Session["mim"];

            MemberOrderModel mom = new MemberOrderModel();
            mom.Number     = bianhao;
            mom.OrderId    = OrderId;
            mom.StoreId    = GetStoreID();
            mom.TotalMoney = Convert.ToDecimal(MemberOrderAgainBLL.GetBzMoney(GetStoreID(), Convert.ToDouble(TotalMoney)));// Convert.ToDecimal(TotalMoney);
            mom.TotalPv    = Convert.ToDecimal(SumPv);

            DataTable dtoinfo = RegistermemberBLL.Getmominfoofmember(OrderId);

            if (dtoinfo != null && dtoinfo.Rows.Count > 0)
            {
                mom.CarryMoney          = Convert.ToDecimal(dtoinfo.Rows[0]["CarryMoney"]);
                mom.OrderExpect         = Convert.ToInt32(dtoinfo.Rows[0]["OrderExpectNum"]);
                mom.PayExpect           = Convert.ToInt32(dtoinfo.Rows[0]["PayExpectNum"]);
                mom.Err                 = "";
                mom.IsAgain             = Convert.ToInt32(dtoinfo.Rows[0]["IsAgain"]);
                mom.OrderDate           = Convert.ToDateTime(dtoinfo.Rows[0]["OrderDate"]); //DateTime.Now;
                mom.Remark              = "";
                mom.DefrayState         = Convert.ToInt32(dtoinfo.Rows[0]["DefrayState"]);
                mom.Consignee           = dtoinfo.Rows[0]["Consignee"].ToString();
                mom.RemittancesId       = dtoinfo.Rows[0]["RemittancesId"].ToString();
                mom.ElectronicaccountId = dtoinfo.Rows[0]["ElectronicaccountId"].ToString();
                mom.OrderType           = Convert.ToInt32(dtoinfo.Rows[0]["OrderType"]);
                mom.IsreceiVables       = Convert.ToInt32(dtoinfo.Rows[0]["DefrayState"]);
            }

            CityModel cm = new CityModel();
            cm.Country  = CountryCity2.Country;
            cm.Province = CountryCity2.Province;
            cm.City     = CountryCity2.City;
            cm.Xian     = CountryCity2.Xian;

            mom.ConCity               = cm;
            mom.CCPCCode              = mim.CPCCode;
            mom.ConAddress            = Encryption.Encryption.GetEncryptionAddress(Txtdz.Text.Trim());
            mom.ConZipCode            = mim.PostalCode;
            mom.ConTelPhone           = mim.HomeTele;
            mom.ConMobilPhone         = mim.MobileTele;
            mom.ConPost               = mim.Email;
            mom.DefrayType            = Convert.ToInt32(Ddzf.SelectedValue);
            mom.DefrayType            = Convert.ToInt32(ViewState["DefrayType"]);
            mom.PayMoney              = Convert.ToDecimal(MemberOrderAgainBLL.GetBzMoney(GetStoreID(), Convert.ToDouble(TotalMoney)) / MemberOrderAgainBLL.GetBzHl(Convert.ToInt32(DropCurrency.SelectedValue)));//Convert.ToDecimal(TotalMoney);
            mom.PayCurrency           = Convert.ToInt32(DropCurrency.SelectedValue);
            mom.StandardCurrency      = MemberOrderAgainBLL.GetBzTypeId(GetStoreID());
            mom.StandardcurrencyMoney = Convert.ToDecimal(TotalMoney);
            mom.OperateIp             = Request.UserHostAddress;
            mom.OperateNumber         = GetStoreID();
            mom.SendType              = Convert.ToInt32(ddth.SelectedValue);

            if (mom.DefrayState == 0)
            {
                mom.PaymentMoney = 0;
            }
            else
            {
                mom.PaymentMoney = Convert.ToDecimal(MemberOrderAgainBLL.GetBzMoney(GetStoreID(), Convert.ToDouble(TotalMoney)) / MemberOrderAgainBLL.GetBzHl(Convert.ToInt32(DropCurrency.SelectedValue)));
            }
            mom.ReceivablesDate    = Convert.ToDateTime(DBHelper.ExecuteScalar("select ReceivablesDate from MemberOrder where OrderID='" + OrderId + "'")); //DateTime.Now;
            mom.EnoughProductMoney = Convert.ToDecimal(EnoughProductMoney);
            mom.LackProductMoney   = Convert.ToDecimal(MemberOrderAgainBLL.GetBzMoney(GetStoreID(), Convert.ToDouble(notEnoughmoney)));                     //获得标准币种Convert.ToDecimal(notEnoughmoney);
            mom.SendWay            = Convert.ToInt32(DDLSendType.SelectedValue);
            if (Ddzf.SelectedValue == "2")
            {
                mom.ElectronicaccountId = this.txtdzbh.Text.Trim();
            }
            if (mom.OperateNumber.Trim().Length == 0)
            {
                if (Session["Company"] != null)
                {
                    mom.OperateNumber = "管理员:" + Session["Company"].ToString();
                }
            }

            string aa = MemberOrderBLL.UpdateMemberOrder(OrderId, lmdm, mom, GetStoreID());

            if (aa == "1")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('修改成功');window.location.href=window.location.href+'&date='+new Date().getTime()</script>");
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('修改失败')</script>");
            }
        }
        else
        {
            ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('登录超时,请重新登录');window.location.href='index.aspx'</script>");
        }
    }