예제 #1
0
        protected void Submit_B_Click(object sender, EventArgs e)
        {
            M_UserInfo mu = buser.SelReturnModel(DataConvert.CLng(UserID_Hid.Value));

            if (mu.IsNull)
            {
                function.WriteErrMsg("订单所绑定的用户[" + UserID_T.Text + "]不存在");
            }
            if (string.IsNullOrEmpty(ProID_Hid.Value) || string.IsNullOrEmpty(ProTime_Hid.Value))
            {
                function.WriteErrMsg("请先选择需要绑定的商品");
            }
            M_Product proMod = proBll.GetproductByid(Convert.ToInt32(ProID_Hid.Value));

            if (proMod == null)
            {
                function.WriteErrMsg("商品不存在");
            }
            DataRow timeMod = idcBll.GetSelTime(proMod, ProTime_Hid.Value);

            M_OrderList Odata = orderBll.NewOrder(mu, M_OrderList.OrderEnum.IDC);

            Odata.Ordermessage = Ordermessage_T.Text;//订货留言
            Odata.Ordersamount = DataConvert.CFloat(Price_T.Text);
            if (Odata.Ordersamount <= 0)
            {
                Odata.Ordersamount = Convert.ToDouble(timeMod["price"]);
            }
            Odata.Balance_price  = Odata.Ordersamount;
            Odata.Specifiedprice = Odata.Ordersamount;
            if (Odata.Ordersamount <= 0)
            {
                function.WriteErrMsg("未为商品指定价格");
            }
            Odata.id = orderBll.Adds(Odata);
            //-----------------------------
            M_Order_IDC idcMod = new M_Order_IDC();

            idcMod.ProID     = proMod.ID;
            idcMod.OrderNo   = Odata.OrderNo;
            idcMod.ProInfo   = idcBll.ToProInfoStr(timeMod);
            idcMod.Domain    = Domain_T.Text;
            idcMod.AdminName = "webmater@" + idcMod.Domain;
            idcMod.STime     = Convert.ToDateTime(STime_T.Text);
            idcMod.ETime     = idcMod.STime;
            idcMod.ID        = idcBll.Insert(idcMod);
            //-----------------------------
            DataTable prodt = new DataTable();

            prodt.Columns.Add(new DataColumn("proid", typeof(int)));
            prodt.Columns.Add(new DataColumn("pronum", typeof(int)));
            DataRow dr = prodt.NewRow();

            dr["proid"]  = proMod.ID;
            dr["pronum"] = 1;
            prodt.Rows.Add(dr);
            cartProBll.CopyToCartPro(mu, prodt, Odata.id);
            function.WriteSuccessMsg("订单添加成功!", "IDCOrder.aspx?OrderType=" + OrderType);
        }
예제 #2
0
        protected void Submit_B_Click(object sender, EventArgs e)
        {
            M_OrderList Odata = new M_OrderList();

            //int uid = DataConvert.CLng(UserID_Hid.Value);
            M_UserInfo mu = buser.SelReturnModel(DataConvert.CLng(UserID_Hid.Value));

            if (mu.IsNull)
            {
                function.WriteErrMsg("订单所绑定的用户[" + UserID_T.Text + "]不存在");
            }
            Odata.Ordertype         = DataConvert.CLng(OrderType_DP.SelectedValue);
            Odata.OrderNo           = B_OrderList.CreateOrderNo((M_OrderList.OrderEnum)Odata.Ordertype);
            Odata.StoreID           = DataConvert.CLng(StoreID_T.Text);
            Odata.Receiver          = ReceUser_T.Text;
            Odata.Reuser            = ReceUser_T.Text;
            Odata.Phone             = Mobile_T.Text;
            Odata.MobileNum         = Mobile_T.Text;
            Odata.Shengfen          = Request.Form["province_dp"];
            Odata.Chengshi          = Request.Form["city_dp"];
            Odata.Diqu              = Request.Form["county_dp"];
            Odata.Jiedao            = Address_T.Text;
            Odata.ZipCode           = ZipCode_T.Text;
            Odata.Invoiceneeds      = Invoiceneeds.Checked ? 1 : 0;
            Odata.Rename            = mu.UserName;
            Odata.Outstock          = 0;                   //缺货处理
            Odata.Ordermessage      = Ordermessage_T.Text; //订货留言
            Odata.Balance_price     = DataConvert.CFloat(Price_T.Text);
            Odata.Freight           = DataConvert.CFloat(Freight_T.Text);
            Odata.Ordersamount      = Odata.Balance_price + Odata.Freight; //订单金额
            Odata.Specifiedprice    = Odata.Ordersamount;
            Odata.Receivablesamount = 0;                                   //收款金额
            Odata.Developedvotes    = 0;
            Odata.OrderStatus       = DataConvert.CLng(OrderStatus_DP.SelectedValue);
            Odata.PayType           = DataConvert.CLng(PayType_Rad.SelectedValue);
            Odata.Paymentstatus     = DataConvert.CLng(Pay_Rad.SelectedValue);
            Odata.StateLogistics    = DataConvert.CLng(Exp_Rad.SelectedValue);
            Odata.AddTime           = DateTime.Now;
            Odata.AddUser           = mu.UserName;;
            Odata.Userid            = mu.UserID;
            Odata.Merchandiser      = "";                //跟单员
            Odata.Internalrecords   = "";                //内部记录
            Odata.id             = orderBll.Adds(Odata); //添加到订单表
            Odata.IsCount        = false;
            Odata.Freight_remark = " ";
            Odata.Balance_remark = "";
            Odata.Promoter       = 0;
            //将数据添加至zl_cartpro永久保存
            CopyToCartPro(Odata);
            string rurl = "";

            if (OrderType == (int)M_OrderList.OrderEnum.IDC || OrderType == (int)M_OrderList.OrderEnum.IDCRen)
            {
                rurl = "OtherOrder/IDCOrder.aspx?OrderType=" + OrderType;
            }
            else
            {
                rurl = "OrderList.aspx?OrderType=" + OrderType;
            }
            function.WriteSuccessMsg("订单添加成功!", rurl);
        }