Exemplo n.º 1
0
        /// <summary>
        /// 通过会员名来获取会员的订单
        /// </summary>
        /// <param name="name"></param>
        /// <param name="pay_status"></param>
        /// <returns></returns>
        public ArrayList getOrdersArray(string name, string pay_status)
        {
            ArrayList orders = new ArrayList();

            string sql = "select * from tb_auto_order where is_pay='" + pay_status + "' and name='" + name + "'  order by order_time desc";

            DataTable table = new DBOperateCommon().excuteQuery(sql);

            foreach (DataRow dr in table.Rows)
            {
                AutoOrder order = new AutoOrder();

                order.Auto_no             = dr["auto_no"].ToString();
                order.Name                = dr["name"].ToString();
                order.Order_time          = Convert.ToDateTime(dr["order_time"].ToString()).ToString("yyyyMMdd HHmm");
                order.Order_count         = Convert.ToInt32(dr["order_count"].ToString());
                order.Collection_count    = Convert.ToInt32(dr["collection_count"].ToString());
                order.Take_charge         = Convert.ToInt32(dr["take_charge"].ToString());
                order.Discount_code       = dr["discount_code"].ToString();
                order.Discount            = Convert.ToSingle(dr["discount"].ToString());
                order.Pay_before_discount = Convert.ToSingle(dr["pay_before_discount"].ToString());
                order.Pay_after_discount  = Convert.ToSingle(dr["pay_after_discount"].ToString());
                order.Less_pay            = Convert.ToSingle(dr["less_pay"].ToString());
                order.Is_pay              = dr["is_pay"].ToString();
                order.Pay_way             = dr["pay_way"].ToString();
                order.Pay_time            = dr["pay_time"].ToString();
                order.Excel_path          = dr["excel_path"].ToString();
                orders.Add(order);
            }

            return(orders);
        }
Exemplo n.º 2
0
        public ManageAutoOrderViewModel()
        {
            AutoOrder     = new AutoOrder();
            NewCreditCard = new CreditCard();

            AvailableShipMethods = new List <ShipMethod>();
        }
Exemplo n.º 3
0
        /// <summary>
        /// 通过 auto_no 来获取订单
        /// </summary>
        /// <param name="auto_no"></param>
        /// <returns></returns>
        public AutoOrder getAutoOrder(string auto_no)
        {
            AutoOrder order = new AutoOrder();

            string sql = "select * from tb_auto_order where auto_no='" + auto_no + "'";

            DataTable table = new DBOperateCommon().excuteQuery(sql);

            foreach (DataRow dr in table.Rows)
            {
                order.Auto_no             = dr["auto_no"].ToString();
                order.Name                = dr["name"].ToString();
                order.Order_time          = Convert.ToDateTime(dr["order_time"].ToString()).ToString("yyyy-MM-dd HH:mm");
                order.Order_count         = Convert.ToInt32(dr["order_count"].ToString());
                order.Collection_count    = Convert.ToInt32(dr["collection_count"].ToString());
                order.Take_charge         = Convert.ToSingle(dr["take_charge"].ToString());
                order.Discount_code       = dr["discount_code"].ToString();
                order.Discount            = Convert.ToSingle(dr["discount"].ToString());
                order.Pay_before_discount = Convert.ToSingle(dr["pay_before_discount"].ToString());
                order.Pay_after_discount  = Convert.ToSingle(dr["pay_after_discount"].ToString());
                order.Less_pay            = Convert.ToSingle(dr["less_pay"].ToString());
                order.Is_pay              = dr["is_pay"].ToString();
                order.Pay_way             = dr["pay_way"].ToString();
                order.Pay_time            = dr["pay_time"].ToString();
                order.Excel_path          = dr["excel_path"].ToString();
            }

            return(order);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 通过起始时间、终止时间、会员名获取订单信息
        /// </summary>
        /// <param name="start">起始时间</param>
        /// <param name="end">终止时间</param>
        /// <param name="name">会员名</param>
        /// <returns>返回订单信息,将订单信息存放在ArrayList对象中</returns>
        public ArrayList getOrders(string start, string end, string pay_status, int pageNow, int pageSize)
        {
            ArrayList orders = new ArrayList();

            string sql = "select top " + pageSize + " * from tb_auto_order where is_pay='" + pay_status +
                         "' and pay_time>='" + start + "' and pay_time<='" + end + "' and auto_no not in (select top " + (pageNow - 1) * pageSize + " auto_no from tb_auto_order where is_pay='" + pay_status + "' and pay_time>='" + start + "' and pay_time<='" + end + "' order by pay_time desc) order by pay_time desc";


            DataTable table = new DBOperateCommon().excuteQuery(sql);

            foreach (DataRow dr in table.Rows)
            {
                AutoOrder order = new AutoOrder();

                order.Auto_no             = dr["auto_no"].ToString();
                order.Name                = dr["name"].ToString();
                order.Order_time          = Convert.ToDateTime(dr["order_time"].ToString()).ToString("yyyyMMdd HHmm");
                order.Order_count         = Convert.ToInt32(dr["order_count"].ToString());
                order.Collection_count    = Convert.ToInt32(dr["collection_count"].ToString());
                order.Take_charge         = Convert.ToInt32(dr["take_charge"].ToString());
                order.Discount_code       = dr["discount_code"].ToString();
                order.Discount            = Convert.ToSingle(dr["discount"].ToString());
                order.Pay_before_discount = Convert.ToSingle(dr["pay_before_discount"].ToString());
                order.Pay_after_discount  = Convert.ToSingle(dr["pay_after_discount"].ToString());
                order.Less_pay            = Convert.ToSingle(dr["less_pay"].ToString());
                order.Is_pay              = dr["is_pay"].ToString();
                order.Pay_way             = dr["pay_way"].ToString();
                order.Pay_time            = dr["pay_time"].ToString();

                orders.Add(order);
            }

            return(orders);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 跟新订单信息表
        /// </summary>
        /// <param name="order">订单对象</param>
        /// <returns>添加成功返回 true , 否则返回 false</returns>
        public bool updateAutoOrder(AutoOrder order)
        {
            bool flag = false;

            string sql = "update tb_auto_order set order_time='" + order.Order_time + "', order_count=" + order.Order_count + ",collection_count=" + order.Collection_count + ",take_charge=" + order.Take_charge + ", discount_code='" + order.Discount_code + "' , discount=" + order.Discount + ", pay_before_discount=" + order.Pay_before_discount + ", pay_after_discount=" + order.Pay_after_discount + ", less_pay=" + order.Less_pay + " ,is_pay='" + order.Is_pay + "',pay_way='" + order.Pay_way + "', pay_time='" + order.Pay_time + "' where auto_no='" + order.Auto_no + "'";

            if (new DBOperateCommon().excuteNoQuery(sql))
            {
                flag = true;
            }

            return(flag);
        }
Exemplo n.º 6
0
        //向批量导入的订单表中添加订单
        public bool addAutoOrder(AutoOrder autoOrder)
        {
            bool flag = false;

            string sql = "insert into tb_auto_order values('" + autoOrder.Auto_no + "','" + autoOrder.Name + "','" + autoOrder.Order_time + "'," + autoOrder.Order_count + "," + autoOrder.Collection_count + "," + autoOrder.Take_charge + ",'" + autoOrder.Discount_code + "'," + autoOrder.Discount + "," + autoOrder.Pay_before_discount + "," + autoOrder.Pay_after_discount + "," + autoOrder.Less_pay + ",'" + autoOrder.Is_pay + "','" + autoOrder.Pay_way + "','" + autoOrder.Pay_time + "','" + autoOrder.Excel_path + "')";

            if (new DBOperateCommon().excuteNoQuery(sql))
            {
                flag = true;
            }

            return(flag);
        }
Exemplo n.º 7
0
        //上传Excel文件的实现
        protected void btn_upload_Click(object sender, EventArgs e)
        {
            int    line_count = 0;
            string username   = "";

            string path = upload_ems_excel.FileName;

            if (path == "")
            {
                alert("请选择文件!!");
                return;
            }
            else
            {
                username = Session["name"].ToString();

                string file_path = saveUploadFile();

                if (file_path == "error")
                {
                    return;
                }

                DataSet ds = new DataSet();

                string          strConn = "Provider=ACE.OLEDB.12.0;" + "Data Source=" + file_path + ";" + "Extended Properties='Excel 8.0;HDR=Yes;IMEX=1;'";
                OleDbConnection conn    = new OleDbConnection(strConn);
                conn.Open();
                string              strExcel  = "";
                OleDbDataAdapter    myCommand = null;
                OleDbCommandBuilder cb        = new OleDbCommandBuilder(myCommand);
                strExcel = "select  * from [Sheet1$] ";

                myCommand = new OleDbDataAdapter(strExcel, strConn);
                myCommand.Fill(ds, "table1");

                ArrayList order_array   = new ArrayList();
                ArrayList package_array = new ArrayList();
                DateTime  temp_time     = DateTime.Now;

                AutoOrder order = new AutoOrder();
                DateTime  time  = DateTime.Now;

                Application.Lock();
                string autoOrderNo = Application["orderNo"].ToString();
                Application["orderNo"] = (int)Application["orderNo"] + 1;
                Application.UnLock();

                string auto_no = "AU" + time.ToString("yyMMddHHmm") + autoOrderNo.PadLeft(8, '0');

                order.Auto_no             = auto_no;
                order.Name                = Session["name"].ToString();
                order.Order_time          = time.ToString("yyyy-MM-dd HH:mm");
                order.Is_pay              = "unpay";
                order.Pay_before_discount = 0;
                order.Excel_path          = intablename;

                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    if (ds.Tables[0].Rows[i][4].ToString().Trim() != "" && (!ds.Tables[0].Rows[i][0].ToString().Trim().Contains("取件还是投送") && !ds.Tables[0].Rows[i][1].ToString().Trim().Contains("发件时间")))
                    {
                        //判断Excel是否为空

                        string delivery_way         = ds.Tables[0].Rows[i][0].ToString().Trim();
                        string delivery_time        = ds.Tables[0].Rows[i][1].ToString().Trim();
                        string receive_company      = ds.Tables[0].Rows[i][2].ToString().Trim();
                        string receive_name         = ds.Tables[0].Rows[i][3].ToString().Trim();
                        string receive_phone        = ds.Tables[0].Rows[i][4].ToString().Trim();
                        string receive_address_line = ds.Tables[0].Rows[i][5].ToString().Trim();
                        string receive_city         = ds.Tables[0].Rows[i][6].ToString().Trim();
                        string receive_postcode     = ds.Tables[0].Rows[i][7].ToString().Trim();
                        string receive_country      = ds.Tables[0].Rows[i][8].ToString().Trim();
                        string send_company         = ds.Tables[0].Rows[i][9].ToString().Trim();
                        string send_name            = ds.Tables[0].Rows[i][10].ToString().Trim();
                        string send_phone           = ds.Tables[0].Rows[i][11].ToString().Trim();
                        string send_addressline     = ds.Tables[0].Rows[i][12].ToString().Trim();
                        string send_city            = ds.Tables[0].Rows[i][13].ToString().Trim();
                        string send_postcode        = ds.Tables[0].Rows[i][14].ToString().Trim();
                        string insurance            = ds.Tables[0].Rows[i][15].ToString().Trim();
                        string comment       = ds.Tables[0].Rows[i][16].ToString().Trim();
                        string parcel_number = ds.Tables[0].Rows[i][17].ToString().Trim();
                        string weight        = ds.Tables[0].Rows[i][18].ToString().Trim();
                        string length        = ds.Tables[0].Rows[i][19].ToString().Trim();
                        string width         = ds.Tables[0].Rows[i][20].ToString().Trim();
                        string height        = ds.Tables[0].Rows[i][21].ToString().Trim();
                        string description   = ds.Tables[0].Rows[i][22].ToString().Trim();
                        string package_value = ds.Tables[0].Rows[i][23].ToString().Trim();

                        //判断重量、长、宽、高是否有效


                        {
                            if (delivery_way == "")
                            {
                                alert("您好,包裹的取件方式不能为空,请仔细检查 Excel !!");
                                return;
                            }
                            else if (delivery_time == "")
                            {
                                alert("您好,包裹的取件时间不能为空,请仔细检查 Excel!!");
                                return;
                            }
                            else if (receive_company == "")
                            {
                                alert("您好,收件公司不能为空,如果没有收件公司,请写上收件人名 !!");
                                return;
                            }
                            else if (receive_name == "")
                            {
                                alert("您好,收件人名不能为空,请仔细检查 Excel!!");
                                return;
                            }
                            else if (receive_phone == "")
                            {
                                alert("您好,收件人 号码 不能为空,请仔细检查 Excel!!");
                                return;
                            }
                            else if (receive_address_line == "")
                            {
                                alert("您好,收件 地址 不能为空 ,请仔细检查 Excel!!");
                                return;
                            }
                            else if (receive_city == "")
                            {
                                alert("您好,收件人 城市 不能为空,请仔细检查 Excel!!");
                                return;
                            }
                            else if (receive_postcode == "")
                            {
                                alert("您好,收件人 邮编不能为空,请仔细检查 Excel !!");
                                return;
                            }
                            else if (receive_country == "")
                            {
                                alert("您好,收件人国家不能为空,必须是 China-NL 、 China-IPE 、 China-GPR , 请仔细检查 Excel !!");
                                return;
                            }
                            else if (send_company == "")
                            {
                                alert("您好,发件人公司不能为空,如果无发件人公司 就 填写发件人名 !!");
                                return;
                            }
                            else if (send_name == "")
                            {
                                alert("发件人名不能为空 , 请仔细检查 Excel!!");
                                return;
                            }
                            else if (send_phone == "")
                            {
                                alert("您好,发件人 电话 不能为空,请仔细检查!!");
                                return;
                            }
                            else if (send_addressline == "")
                            {
                                alert("您好,发件人地址不能为空,请仔细检查 !! ");
                                return;
                            }
                            else if (send_city == "")
                            {
                                alert("您好,发件人城市不能为空,请仔细检查 !!");
                                return;
                            }
                            else if (send_postcode == "")
                            {
                                alert("您好,发件人 邮编不能为空, 请仔细检查 !! ");
                                return;
                            }
                            else if (insurance == "")
                            {
                                alert("您好,是否购买保险字段不能为空,请填上 0 ");
                            }
                            else if (comment == "")
                            {
                                alert("您好,发货目的不能为空 , 请仔细检查 Excel!!");
                                return;
                            }
                            else if (weight == "")
                            {
                                alert("您好,包裹的重量不能为空 , 请仔细检查 Excel!!");
                                return;
                            }
                            else if (length == "")
                            {
                                alert("您好,包裹的长度不能为空 , 请仔细检查 Excel!!");
                                return;
                            }
                            else if (width == "")
                            {
                                alert("您好,包裹的宽度不能为空 , 请仔细检查 Excel!!");
                                return;
                            }
                            else if (height == "")
                            {
                                alert("您好,包裹的 高度不能为空,请仔细检查 !!");
                                return;
                            }
                            else if (description == "")
                            {
                                alert("您好,包裹的 描述不能为空,请仔细检查!!");
                                return;
                            }
                            else if (package_value == "")
                            {
                                alert("您好,包裹的价值不能为空,请仔细检查 !!");
                                return;
                            }
                        }


                        //判断中文字符 。


                        {
                            receive_company      = receive_company.Replace('。', '.');
                            receive_name         = receive_name.Replace('。', '.');
                            receive_address_line = receive_address_line.Replace('。', '.');
                            receive_city         = receive_city.Replace('。', '.');
                            receive_postcode     = receive_postcode.Replace('。', '.');
                            receive_country      = receive_country.Replace('。', '.');
                            send_company         = send_company.Replace('。', '.');
                            send_name            = send_name.Replace('。', '.');
                            send_addressline     = send_addressline.Replace('。', '.');
                            send_city            = send_city.Replace('。', '.');
                            send_postcode        = send_postcode.Replace('。', '.');
                            description          = description.Replace('。', '.');
                        }



                        try
                        {
                            Convert.ToSingle(weight);
                            Convert.ToSingle(length);
                            Convert.ToSingle(width);
                            Convert.ToSingle(height);
                            Convert.ToSingle(package_value);
                        }
                        catch (System.Exception ex)
                        {
                            alert("包裹的重量、长、宽、高、价值 信息必须位数字");
                            return;
                        }

                        if (receive_postcode.Length != 6)
                        {
                            alert("收件人邮编必须为 6 位!!");
                            return;
                        }


                        try
                        {
                            if (receive_phone.Contains("e") || send_phone.Contains("e"))
                            {
                                receive_phone = Convert.ToInt64(Convert.ToSingle(receive_phone)).ToString();
                                send_phone    = Convert.ToInt64(Convert.ToSingle(send_phone)).ToString();
                            }
                        }
                        catch (System.Exception ex)
                        {
                            alert("收件人或者发件人电话格式错误");
                            return;
                        }

                        AutoOrderList package = new AutoOrderList();

                        //如果是 PostNL
                        if (receive_country.ToLower().Equals("china-nl"))
                        {
                            line_count++;

                            Application.Lock();
                            string orderNo = Application["packageNo"].ToString();
                            Application["packageNo"] = (int)Application["packageNo"] + 1;
                            Application.UnLock();

                            package.Auto_no  = auto_no;
                            package.Order_no = "WA" + time.ToString("yyMMddHHmm") + orderNo.PadLeft(8, '0');
                            package.Name     = Session["name"].ToString();
                            package.CollectionCompanyName = send_company;
                            package.CollectionContactName = send_name;
                            package.CollectionPhone       = send_phone;
                            package.CollectionAddressLine = send_addressline;
                            package.CollectionTown        = send_city;
                            package.CollectionPostCode    = send_postcode;
                            package.CollectionCountry     = "UK";
                            package.RecipientCompanyName  = receive_company;
                            package.RecipientContactName  = receive_name;
                            package.RecipientPhone        = receive_phone;
                            package.RecipientAddressLine  = receive_address_line;
                            package.RecipientTown         = receive_city;
                            package.RecipeintPostCode     = receive_postcode;
                            package.RecipientCountry      = "China";
                            package.Shippingdate          = delivery_time;
                            package.Shippingtype          = delivery_way;

                            package.Shippingpurpose    = comment;
                            package.PackageDescription = description;
                            package.PackageValue       = Convert.ToSingle(package_value);
                            package.Insurance          = Convert.ToSingle(insurance);
                            package.ServiceCode        = "PostNL";
                            package.Weight             = Convert.ToSingle(weight);
                            package.Length             = Convert.ToSingle(length);
                            package.Width  = Convert.ToSingle(width);
                            package.Height = Convert.ToSingle(height);

                            if (package.PackageDescription.Contains("推车") || package.PackageDescription.Contains("trolly") || package.PackageDescription.Contains("坐椅") || package.PackageDescription.Contains("baby sit") || package.PackageDescription.Contains("babysit") || package.PackageDescription.Contains("sit"))
                            {
                                package.Volumetric = package.Length * package.Width * package.Height / 6000;
                            }
                            else
                            {
                                package.Volumetric = package.Weight;
                            }

                            if (package.Weight >= package.Volumetric)
                            {
                                package.Chargeable = package.Weight;
                            }
                            else
                            {
                                package.Chargeable = package.Volumetric;
                            }
                            package.Pay_status           = "unpay";
                            package.Pay_before_discount  = new BatchQuoteDAO().getQuote(username, package.ServiceCode, package.Weight, package.Chargeable);
                            package.Pay_before_discount += package.Insurance;
                            package.Discount             = 0;

                            package.Pay_after_discount = package.Pay_before_discount;
                            package.Order_time         = order.Order_time;
                            package.Less_pay           = 0;
                            package.Is_delivery        = 0;

                            order.Pay_before_discount += package.Pay_before_discount;
                            package_array.Add(package);
                        }

                        //如果是 PF-IPE 类别
                        else if (receive_country.ToLower().Equals("china-ipe"))
                        {
                            line_count++;


                            if ((Hz2Py.Convert(receive_company)).Length > 24)
                            {
                                alert("第" + line_count + "个包裹的收件公司长度超过了24字节,请更改!!");
                                return;
                            }
                            if ((Hz2Py.Convert(receive_name)).Length > 24)
                            {
                                alert("第" + line_count + "个包裹的收件人英文名长度或者中文名转化为拼音后超过了24字符,请更改!!");
                                return;
                            }
                            if ((Hz2Py.Convert(receive_phone)).Length > 15)
                            {
                                alert("第" + line_count + "个包裹的收件人电话长度超过了15字符,ParcelForce 不能处理,请缩短!!");
                                return;
                            }
                            if ((Hz2Py.Convert(receive_address_line)).Length > 67)
                            {
                                alert("抱歉,您的第 " + line_count + " 个订单由于英文收件地址或者中文收件地址转化为拼音后超过66个字符,ParcelForce 不能处理,请缩短地址,请更改!!");
                                return;
                            }
                            if ((Hz2Py.Convert(receive_city)).Length > 24)
                            {
                                alert("第" + line_count + "个包裹的收件人 City 长度超过了24个字符,ParcelForce 不能处理,请缩短!!");
                                return;
                            }

                            if ((Hz2Py.Convert(send_company)).Length > 24)
                            {
                                alert("第" + line_count + "个包裹的发件人公司英文长度或中文转换为拼音后长度超过了24字节,ParcelForce 不能处理,请缩短!!");
                                return;
                            }
                            if ((Hz2Py.Convert(send_name)).Length > 24)
                            {
                                alert("第" + line_count + "个包裹的发件人名长度超过了24字节,ParcelForce 不能处理,请缩短!!");
                                return;
                            }
                            if ((Hz2Py.Convert(send_phone)).Length > 15)
                            {
                                alert("第" + line_count + "个包裹的发件人手机号码长度超过了15个字符,ParcelForce 不能处理,请缩短!!");
                                return;
                            }
                            if ((Hz2Py.Convert(send_addressline)).Length > 67)
                            {
                                alert("第" + line_count + "个包裹的英文发件地址或者中文收件地址转化为拼音后长度超过了67字节,ParcelForce 不能处理,请缩短!!");
                                return;
                            }
                            if ((Hz2Py.Convert(send_city)).Length > 24)
                            {
                                alert("第" + line_count + "个包裹的发件 City 英文长度或中文转换为拼音后长度超过了24字符,ParcelForce 不能处理,请缩短!!");
                                return;
                            }
                            if ((Hz2Py.Convert(send_postcode)).Length > 16)
                            {
                                alert("第" + line_count + "个包裹的发件邮编长度超过了16字符,ParcelForce 不能处理,请缩短!!");
                                return;
                            }
                            if ((Hz2Py.Convert(description)).Length > 30)
                            {
                                alert("第" + line_count + "个包裹的 Description 字段 英文后中文转换为拼音后 长度超过了30字符,ParcelForce 不能处理,请缩短!!");
                                return;
                            }
                            if (weight.ToString().Length > 8)
                            {
                                alert("第" + line_count + "个包裹的重量 值 超过了 8 位,ParcelForce 不能处理,请缩短!!");
                                return;
                            }
                            if (height.ToString().Length > 8)
                            {
                                alert("第" + line_count + "个包裹的高度值超过了 8 位,ParcelForce 不能处理,请缩短!!");
                                return;
                            }
                            if (length.ToString().Length > 8)
                            {
                                alert("第" + line_count + "个包裹的长度值超过了 8 位,ParcelForce 不能处理,请缩短!!");
                                return;
                            }
                            if (package_value.ToString().Length > 8)
                            {
                                alert("第" + line_count + "个包裹的 包裹价值 长度超过了8位,ParcelForce 不能处理,请缩短!!");
                                return;
                            }
                            if (width.ToString().Length > 8)
                            {
                                alert("第" + line_count + "个包裹的 宽度 长度超过了 8 位,ParcelForce 不能处理,请缩短!!");
                                return;
                            }
                            if ((Hz2Py.Convert(comment)).Length > 16)
                            {
                                alert("第" + line_count + "个包裹的 Purpose Of Shipment 字段的英文长度或中文转换为英文后的长度超过了24字符,ParcelForce 不能处理,请缩短!!");
                                return;
                            }



                            string nowtime = DateTime.Now.ToString("yyyy-MM-dd");

                            Regex reg = new Regex(@"[0-9]{4}-[0-9]{2}-[0-9]{2}");

                            if (!reg.Match(delivery_time).Success)
                            {
                                alert("China-IPE 的发件时间格式必须为 YYYY-MM-DD,并且发件时间必须是明天以后");
                                return;
                            }

                            int k = (int)DateTime.Parse(delivery_time).DayOfWeek;

                            if (delivery_time.CompareTo(nowtime) == -1)
                            {
                                alert("China-IPE 的发件时间格式必须为 YYYY-MM-DD,并且发件时间必须是第二天及以后");
                                return;
                            }
                            else if ((delivery_time.CompareTo(nowtime) == 0) && k != 6 && k != 0)
                            {
                                string nowminute = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
                                string temp      = nowtime + " 11:30";

                                if (nowminute.CompareTo(temp) == 1)
                                {
                                    if (k == 5)
                                    {
                                        delivery_time = Convert.ToDateTime(delivery_time).AddDays(3).ToString("yyyy-MM-dd");
                                    }
                                    else
                                    {
                                        delivery_time = Convert.ToDateTime(delivery_time).AddDays(1).ToString("yyyy-MM-dd");
                                    }
                                }
                            }

                            if (delivery_time.CompareTo(DateTime.Now.AddDays(21).ToString("yyyy-MM-dd")) >= 0)
                            {
                                alert("取件时间不能离现在太远,最好不要超过 两个星期!!");
                                return;
                            }

                            if (k == 6)
                            {
                                delivery_time = Convert.ToDateTime(delivery_time).AddDays(2).ToString("yyyy-MM-dd");
                            }
                            else if (k == 0)
                            {
                                delivery_time = Convert.ToDateTime(delivery_time).AddDays(1).ToString("yyyy-MM-dd");
                            }



                            Application.Lock();
                            string orderNo = Application["packageNo"].ToString();
                            Application["packageNo"] = (int)Application["packageNo"] + 1;
                            Application.UnLock();

                            package.Auto_no  = auto_no;
                            package.Order_no = "WA" + time.ToString("yyMMddHHmm") + orderNo.PadLeft(8, '0');
                            package.Name     = Session["name"].ToString();
                            package.CollectionCompanyName = send_company;
                            package.CollectionContactName = send_name;
                            package.CollectionPhone       = send_phone;
                            package.CollectionAddressLine = send_addressline;
                            package.CollectionTown        = send_city;
                            package.CollectionPostCode    = send_postcode;
                            package.CollectionCountry     = "UK";
                            package.RecipientCompanyName  = receive_company;
                            package.RecipientContactName  = receive_name;
                            package.RecipientPhone        = receive_phone;
                            package.RecipientAddressLine  = receive_address_line;
                            package.RecipientTown         = receive_city;
                            package.RecipeintPostCode     = receive_postcode;
                            package.RecipientCountry      = "China";
                            package.Shippingdate          = delivery_time;
                            package.Shippingtype          = delivery_way;

                            package.Shippingpurpose    = comment;
                            package.PackageDescription = description;
                            package.PackageValue       = Convert.ToSingle(package_value);
                            package.Insurance          = Convert.ToSingle(insurance);
                            if (package.Shippingtype.ToLower().Contains("ollec"))
                            {
                                package.ServiceCode = "PF-IPE-Collection";
                            }
                            else if (package.Shippingtype.ToLower().Contains("epot"))
                            {
                                package.ServiceCode = "PF-IPE-Depot";
                            }
                            else if (package.Shippingtype.ToLower().Contains("railer"))
                            {
                                package.ServiceCode = "PF-IPE-Trailer";
                            }
                            else if (package.Shippingtype.ToLower().Contains("pol"))
                            {
                                package.ServiceCode = "PF-IPE-Pol";
                            }

                            package.Weight = Convert.ToSingle(weight);
                            package.Length = Convert.ToSingle(length);
                            package.Width  = Convert.ToSingle(width);
                            package.Height = Convert.ToSingle(height);


                            package.Volumetric = (float)((package.Length * package.Width * package.Height) / 5000.0);

                            if (package.Weight >= package.Volumetric)
                            {
                                package.Chargeable = package.Weight;
                            }
                            else
                            {
                                package.Chargeable = package.Volumetric;
                            }

                            package.Pay_status = "unpay";

                            //此处Pay_before_discount设置为100,以后要计算价格

                            package.Pay_before_discount  = new BatchQuoteDAO().getQuote(username, package.ServiceCode, package.Weight, package.Chargeable);// new Quote().getQuote("UK", "China", package.Weight, package.Chargeable, "PostNL", Session["name"].ToString());
                            package.Pay_before_discount += package.Insurance;
                            package.Discount             = 0;

                            package.Pay_after_discount = package.Pay_before_discount;
                            package.Order_time         = order.Order_time;
                            package.Less_pay           = 0;
                            package.Is_delivery        = 0;

                            order.Pay_before_discount += package.Pay_before_discount;


                            package_array.Add(package);
                        }

                        // 如果是 PF-GPR类型
                        else if (receive_country.ToLower().Equals("china-gpr"))
                        {
                            line_count++;


                            if ((Hz2Py.Convert(receive_company)).Length > 24)
                            {
                                alert("第" + line_count + "个包裹的收件公司长度超过了24字节,请更改!!");
                                return;
                            }
                            if ((Hz2Py.Convert(receive_name)).Length > 24)
                            {
                                alert("第" + line_count + "个包裹的收件人名长度超过了24字节,请更改!!");
                                return;
                            }
                            if ((Hz2Py.Convert(receive_phone)).Length > 15)
                            {
                                alert("第" + line_count + "个包裹的收件人电话长度超过了15字节,请更改!!");
                                return;
                            }
                            if ((Hz2Py.Convert(receive_address_line)).Length > 67)
                            {
                                alert("第" + line_count + "个包裹的收件人地址长度超过了67字节,请更改!!");
                                return;
                            }
                            if ((Hz2Py.Convert(receive_city)).Length > 24)
                            {
                                alert("第" + line_count + "个包裹的收件人 City 长度超过了24字节,请更改!!");
                                return;
                            }

                            if ((Hz2Py.Convert(send_company)).Length > 24)
                            {
                                alert("第" + line_count + "个包裹的发件人公司长度超过了24字节,请更改!!");
                                return;
                            }
                            if ((Hz2Py.Convert(send_name)).Length > 24)
                            {
                                alert("第" + line_count + "个包裹的发件人名长度超过了24字节,请更改!!");
                                return;
                            }
                            if ((Hz2Py.Convert(send_phone)).Length > 15)
                            {
                                alert("第" + line_count + "个包裹的发件人手机号码长度超过了15字节,请更改!!");
                                return;
                            }
                            if ((Hz2Py.Convert(send_addressline)).Length > 67)
                            {
                                alert("第" + line_count + "个包裹的收件公司长度超过了67字节,请更改!!");
                                return;
                            }
                            if ((Hz2Py.Convert(send_city)).Length > 24)
                            {
                                alert("第" + line_count + "个包裹的收件公司长度超过了24字节,请更改!!");
                                return;
                            }
                            if ((Hz2Py.Convert(send_postcode)).Length > 16)
                            {
                                alert("第" + line_count + "个包裹的收件公司长度超过了16字节,请更改!!");
                                return;
                            }
                            if ((Hz2Py.Convert(description)).Length > 30)
                            {
                                alert("第" + line_count + "个包裹的 Description字段 长度超过了30字节,请更改!!");
                                return;
                            }
                            if (weight.ToString().Length > 8)
                            {
                                alert("第" + line_count + "个包裹的重量 值 超过了 8 位,请更改!!");
                                return;
                            }
                            if (height.ToString().Length > 8)
                            {
                                alert("第" + line_count + "个包裹的高度值超过了 8 位,请更改!!");
                                return;
                            }
                            if (length.ToString().Length > 8)
                            {
                                alert("第" + line_count + "个包裹的长度值超过了 8 位,请更改!!");
                                return;
                            }
                            if (package_value.ToString().Length > 8)
                            {
                                alert("第" + line_count + "个包裹的 包裹价值 长度超过了8位,请更改!!");
                                return;
                            }
                            if (width.ToString().Length > 8)
                            {
                                alert("第" + line_count + "个包裹的 宽度 长度超过了 8 位,请更改!!");
                                return;
                            }
                            if ((Hz2Py.Convert(comment)).Length > 16)
                            {
                                alert("第" + line_count + "个包裹的Purpose Of Shipment长度超过了24字节,请更改!!");
                                return;
                            }


                            string nowtime = DateTime.Now.ToString("yyyy-MM-dd");

                            Regex reg = new Regex(@"[0-9]{4}-[0-9]{2}-[0-9]{2}");

                            if (!reg.Match(delivery_time).Success)
                            {
                                alert("China-IPE,China-GPR 的发件时间格式必须为 YYYY-MM-DD,并且发件时间必须是明天以后,请从 PostNL首页下载模板!!");
                                return;
                            }

                            int k = (int)DateTime.Parse(delivery_time).DayOfWeek;

                            if (delivery_time.CompareTo(nowtime) == -1)
                            {
                                alert("China-IPE,China-GPR 的发件时间格式必须为 YYYY-MM-DD,并且发件时间必须是明天以后");
                                return;
                            }
                            else if (delivery_time.CompareTo(nowtime) == 0)
                            {
                                string nowminute = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
                                string temp      = nowtime + " 11:30";

                                if (nowminute.CompareTo(temp) == 1)
                                {
                                    if (k == 5)
                                    {
                                        delivery_time = Convert.ToDateTime(delivery_time).AddDays(3).ToString("yyyy-MM-dd");
                                    }
                                }

                                delivery_time = Convert.ToDateTime(delivery_time).AddDays(1).ToString("yyyy-MM-dd");
                            }


                            if (delivery_time.CompareTo(DateTime.Now.AddDays(21).ToString("yyyy-MM-dd")) >= 0)
                            {
                                alert("取件时间不能离现在太远,最好不要超过 两个星期!!");
                                return;
                            }

                            if (k == 6)
                            {
                                delivery_time = Convert.ToDateTime(delivery_time).AddDays(2).ToString("yyyy-MM-dd");
                            }
                            else if (k == 0)
                            {
                                delivery_time = Convert.ToDateTime(delivery_time).AddDays(1).ToString("yyyy-MM-dd");
                            }



                            Application.Lock();
                            string orderNo = Application["packageNo"].ToString();
                            Application["packageNo"] = (int)Application["packageNo"] + 1;
                            Application.UnLock();

                            package.Auto_no  = auto_no;
                            package.Order_no = "WA" + time.ToString("yyyyMMddHHmm") + orderNo.PadLeft(8, '0');
                            package.Name     = Session["name"].ToString();
                            package.CollectionCompanyName = send_company;
                            package.CollectionContactName = send_name;
                            package.CollectionPhone       = send_phone;
                            package.CollectionAddressLine = send_addressline;
                            package.CollectionTown        = send_city;
                            package.CollectionPostCode    = send_postcode;
                            package.CollectionCountry     = "UK";
                            package.RecipientCompanyName  = receive_company;
                            package.RecipientContactName  = receive_name;
                            package.RecipientPhone        = receive_phone;
                            package.RecipientAddressLine  = receive_address_line;
                            package.RecipientTown         = receive_city;
                            package.RecipeintPostCode     = receive_postcode;
                            package.RecipientCountry      = "China";
                            package.Shippingdate          = delivery_time;
                            package.Shippingtype          = delivery_way;

                            package.Shippingpurpose    = comment;
                            package.PackageDescription = description;
                            package.PackageValue       = Convert.ToSingle(package_value);
                            package.Insurance          = Convert.ToSingle(insurance);
                            if (package.Shippingtype.ToLower().Contains("ollec"))
                            {
                                package.ServiceCode = "PF-GPR-Collection";
                            }
                            else
                            {
                                package.ServiceCode = "PF-GPR-Delivery";
                            }
                            package.Weight = Convert.ToSingle(weight);
                            package.Length = Convert.ToSingle(length);
                            package.Width  = Convert.ToSingle(width);
                            package.Height = Convert.ToSingle(height);

                            package.Volumetric = (float)((package.Length * package.Width * package.Height) / 5000.0);

                            if (package.Weight >= package.Volumetric)
                            {
                                package.Chargeable = package.Weight;
                            }
                            else
                            {
                                package.Chargeable = package.Volumetric;
                            }

                            package.Pay_status = "unpay";

                            //此处Pay_before_discount设置为100,以后要计算价格


                            package.Pay_before_discount  = new BatchQuoteDAO().getQuote(username, package.ServiceCode, package.Weight, package.Chargeable);// new Quote().getQuote("UK", "China", package.Weight, package.Chargeable, "PostNL", Session["name"].ToString());
                            package.Pay_before_discount += package.Insurance;
                            package.Discount             = 0;

                            package.Pay_after_discount = package.Pay_before_discount;
                            package.Order_time         = order.Order_time;
                            package.Less_pay           = 0;
                            package.Is_delivery        = 0;

                            order.Pay_before_discount += package.Pay_before_discount;


                            package_array.Add(package);
                        }


                        // 如果是 EMS
                        else if (receive_country.ToLower().Equals("china-ems"))
                        {
                            line_count++;

                            Application.Lock();
                            string orderNo = Application["packageNo"].ToString();
                            Application["packageNo"] = (int)Application["packageNo"] + 1;
                            Application.UnLock();

                            package.Auto_no  = auto_no;
                            package.Order_no = "WA" + time.ToString("yyyyMMddHHmm") + orderNo.PadLeft(8, '0');
                            package.Name     = Session["name"].ToString();
                            package.CollectionCompanyName = send_company;
                            package.CollectionContactName = send_name;
                            package.CollectionPhone       = send_phone;
                            package.CollectionAddressLine = send_addressline;
                            package.CollectionTown        = send_city;
                            package.CollectionPostCode    = send_postcode;
                            package.CollectionCountry     = "UK";
                            package.RecipientCompanyName  = receive_company;
                            package.RecipientContactName  = receive_name;
                            package.RecipientPhone        = receive_phone;
                            package.RecipientAddressLine  = receive_address_line;
                            package.RecipientTown         = receive_city;
                            package.RecipeintPostCode     = receive_postcode;
                            package.RecipientCountry      = "China";
                            package.Shippingdate          = delivery_time;
                            package.Shippingtype          = delivery_way;

                            package.Shippingpurpose    = comment;
                            package.PackageDescription = description;
                            package.PackageValue       = Convert.ToSingle(package_value);
                            package.Insurance          = Convert.ToSingle(insurance);
                            package.ServiceCode        = "EMS";
                            package.Weight             = Convert.ToSingle(weight);
                            package.Length             = Convert.ToSingle(length);
                            package.Width  = Convert.ToSingle(width);
                            package.Height = Convert.ToSingle(height);

                            package.Volumetric = (float)((package.Length * package.Width * package.Height) / 5000.0);

                            if (package.Weight >= package.Volumetric)
                            {
                                package.Chargeable = package.Weight;
                            }
                            else
                            {
                                package.Chargeable = package.Volumetric;
                            }

                            package.Pay_status = "unpay";

                            //此处Pay_before_discount设置为100,以后要计算价格

                            package.Pay_before_discount  = new BatchQuoteDAO().getQuote(username, package.ServiceCode, package.Weight, package.Chargeable);// new Quote().getQuote("UK", "China", package.Weight, package.Chargeable, "PostNL", Session["name"].ToString());
                            package.Pay_before_discount += package.Insurance;
                            package.Discount             = 0;

                            package.Pay_after_discount = package.Pay_before_discount;
                            package.Order_time         = order.Order_time;
                            package.Less_pay           = 0;
                            package.Is_delivery        = 0;

                            order.Pay_before_discount += package.Pay_before_discount;


                            package_array.Add(package);
                        }
                        else
                        {
                            alert("收件国家必须是 China-NL、China-IPE、China-GPR 到 港澳台 也一样也是 China-NL、China-IPE、China-GPR ");
                            return;
                        }
                    }
                }

                order.Discount           = 0;
                order.Pay_after_discount = order.Pay_before_discount;
                order.Order_count        = line_count;

                //确实有包裹
                if (line_count != 0)
                {
                    //添加订单的详细信息
                    for (int i = 0; i < package_array.Count; i++)
                    {
                        AutoOrderList temp_package = (AutoOrderList)package_array[i];
                        new AutoOrderListDAO().addAutoOrderList(temp_package);
                    }

                    //添加订单
                    new AutoOrderDAO().addAutoOrder(order);
                }
            }

            if (line_count == 0)
            {
                alert("Excel不能为空!!!");
            }
            else
            {
                Response.Redirect("../my-shopping-cart.aspx?flag=excel");
            }
        }
Exemplo n.º 8
0
 public static AutoOrder CreateAutoOrder(
             int autoOrderID, 
             int customerID, 
             int autoOrderStatusID, 
             int frequencyTypeID, 
             global::System.DateTime startDate, 
             int warehouseID, 
             int shipMethodID, 
             int autoOrderPaymentTypeID, 
             int autoOrderProcessTypeID, 
             decimal total, 
             decimal subTotal, 
             decimal taxTotal, 
             decimal shippingTotal, 
             decimal discountTotal, 
             decimal businessVolumeTotal, 
             decimal commissionableVolumeTotal, 
             global::System.DateTime createdDate)
 {
     AutoOrder autoOrder = new AutoOrder();
     autoOrder.AutoOrderID = autoOrderID;
     autoOrder.CustomerID = customerID;
     autoOrder.AutoOrderStatusID = autoOrderStatusID;
     autoOrder.FrequencyTypeID = frequencyTypeID;
     autoOrder.StartDate = startDate;
     autoOrder.WarehouseID = warehouseID;
     autoOrder.ShipMethodID = shipMethodID;
     autoOrder.AutoOrderPaymentTypeID = autoOrderPaymentTypeID;
     autoOrder.AutoOrderProcessTypeID = autoOrderProcessTypeID;
     autoOrder.Total = total;
     autoOrder.SubTotal = subTotal;
     autoOrder.TaxTotal = taxTotal;
     autoOrder.ShippingTotal = shippingTotal;
     autoOrder.DiscountTotal = discountTotal;
     autoOrder.BusinessVolumeTotal = businessVolumeTotal;
     autoOrder.CommissionableVolumeTotal = commissionableVolumeTotal;
     autoOrder.CreatedDate = createdDate;
     return autoOrder;
 }
Exemplo n.º 9
0
 public void AddToAutoOrders(AutoOrder autoOrder)
 {
     base.AddObject("AutoOrders", autoOrder);
 }
Exemplo n.º 10
0
        public CreateAutoOrderRequest(AutoOrder autoOrder)
        {
            if (autoOrder == null)
            {
                return;
            }

            CustomerID = autoOrder.CustomerID;

            if (autoOrder.AutoOrderID != 0)
            {
                ExistingAutoOrderID        = autoOrder.AutoOrderID;
                OverwriteExistingAutoOrder = true;
            }

            Description  = autoOrder.Description;
            StartDate    = autoOrder.StartDate;
            StopDate     = autoOrder.StopDate;
            CurrencyCode = autoOrder.CurrencyCode;
            WarehouseID  = autoOrder.WarehouseID;
            ShipMethodID = autoOrder.ShipMethodID;
            PriceType    = PriceTypes.Wholesale;
            Frequency    = ExigoDAL.GetFrequencyType(autoOrder.FrequencyTypeID);
            PaymentType  = ExigoDAL.GetAutoOrderPaymentType(autoOrder.AutoOrderPaymentTypeID);
            ProcessType  = ExigoDAL.GetAutoOrderProcessType(autoOrder.AutoOrderProcessTypeID);
            Details      = autoOrder.Details.Select(c => new OrderDetailRequest()
            {
                ItemCode                         = c.ItemCode,
                Quantity                         = c.Quantity,
                ParentItemCode                   = c.ParentItemCode,
                BusinessVolumeEachOverride       = c.BVEachOverride,
                CommissionableVolumeEachOverride = c.CVEachOverride,
                DescriptionOverride              = c.ItemDescription,
                PriceEachOverride                = c.PriceEachOverride,
                ShippingPriceEachOverride        = c.ShippingPriceEachOverride,
                TaxableEachOverride              = c.TaxableEachOverride
            }).ToArray();

            if (autoOrder.ShippingAddress != null)
            {
                FirstName  = autoOrder.ShippingAddress.FirstName;
                MiddleName = autoOrder.ShippingAddress.MiddleName;
                LastName   = autoOrder.ShippingAddress.LastName;
                Company    = autoOrder.ShippingAddress.Company;
                Email      = autoOrder.ShippingAddress.Email;
                Phone      = autoOrder.ShippingAddress.Phone;
                Address1   = autoOrder.ShippingAddress.Address1;
                Address2   = autoOrder.ShippingAddress.Address2;
                City       = autoOrder.ShippingAddress.City;
                State      = autoOrder.ShippingAddress.State;
                Zip        = autoOrder.ShippingAddress.Zip;
                Country    = autoOrder.ShippingAddress.Country;
            }

            Notes   = autoOrder.Notes;
            Other11 = autoOrder.Other11;
            Other12 = autoOrder.Other12;
            Other13 = autoOrder.Other13;
            Other14 = autoOrder.Other14;
            Other15 = autoOrder.Other15;
            Other16 = autoOrder.Other16;
            Other17 = autoOrder.Other17;
            Other18 = autoOrder.Other18;
            Other19 = autoOrder.Other19;
            Other20 = autoOrder.Other20;
        }