Esempio n. 1
0
            /// <summary>
            /// 得到一个对象实体 by SQLpara
            /// </summary>
            public Lebi_Supplier_Delivery GetModel(SQLPara para)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("select top 1 * from [Lebi_Supplier_Delivery] ");
                if (para.Where != "")
                {
                    strSql.Append(" where " + para.Where + "");
                }
                Lebi_Supplier_Delivery model = new Lebi_Supplier_Delivery();
                DataSet ds = SqlUtils.SqlUtilsInstance.TextExecuteDataset(strSql.ToString(), para.Para);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                    {
                        model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                    }
                    model.Name   = ds.Tables[0].Rows[0]["Name"].ToString();
                    model.Remark = ds.Tables[0].Rows[0]["Remark"].ToString();
                    if (ds.Tables[0].Rows[0]["Sort"].ToString() != "")
                    {
                        model.Sort = int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["Supplier_id"].ToString() != "")
                    {
                        model.Supplier_id = int.Parse(ds.Tables[0].Rows[0]["Supplier_id"].ToString());
                    }
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
Esempio n. 2
0
        /// <summary>
        /// 编辑配送点
        /// </summary>
        public void Delivery_Edit()
        {
            if (!Power("supplier_delivery_list", "配送点管理"))
            {
                AjaxNoPower();
                return;
            }
            int  id      = RequestTool.RequestInt("id", 0);
            bool addflag = false;
            Lebi_Supplier_Delivery model = B_Lebi_Supplier_Delivery.GetModel("id = " + id + " and Supplier_id = " + CurrentSupplier.id + "");

            if (model == null)
            {
                addflag = true;
                model   = new Lebi_Supplier_Delivery();
            }
            model = B_Lebi_Supplier_Delivery.SafeBindForm(model);
            if (addflag)
            {
                model.Supplier_id = CurrentSupplier.id;
                B_Lebi_Supplier_Delivery.Add(model);
                id = B_Lebi_Supplier_Delivery.GetMaxId();
                Log.Add("添加配送点", "Delivery", id.ToString(), CurrentSupplier, model.Name);
            }
            else
            {
                B_Lebi_Supplier_Delivery.Update(model);
                Log.Add("编辑配送点", "Delivery", id.ToString(), CurrentSupplier, model.Name);
            }
            string result = "{\"msg\":\"OK\", \"id\":\"" + id + "\"}";

            Response.Write(result);
        }
Esempio n. 3
0
            /// <summary>
            /// 更新一条数据
            /// </summary>
            public void Update(Lebi_Supplier_Delivery model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("update [Lebi_Supplier_Delivery] set ");
                strSql.Append("Name= @Name,");
                strSql.Append("Remark= @Remark,");
                strSql.Append("Sort= @Sort,");
                strSql.Append("Supplier_id= @Supplier_id");
                strSql.Append(" where id=@id");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@id",          SqlDbType.Int,        4),
                    new SqlParameter("@Name",        SqlDbType.NVarChar,  50),
                    new SqlParameter("@Remark",      SqlDbType.NVarChar, 200),
                    new SqlParameter("@Sort",        SqlDbType.Int,        4),
                    new SqlParameter("@Supplier_id", SqlDbType.Int, 4)
                };
                parameters[0].Value = model.id;
                parameters[1].Value = model.Name;
                parameters[2].Value = model.Remark;
                parameters[3].Value = model.Sort;
                parameters[4].Value = model.Supplier_id;

                SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters);
            }
Esempio n. 4
0
            /// <summary>
            /// 增加一条数据
            /// </summary>
            public int Add(Lebi_Supplier_Delivery model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("insert into [Lebi_Supplier_Delivery](");
                strSql.Append("Name,Remark,Sort,Supplier_id)");
                strSql.Append(" values (");
                strSql.Append("@Name,@Remark,@Sort,@Supplier_id)");
                strSql.Append(";select @@IDENTITY");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@Name",        model.Name),
                    new SqlParameter("@Remark",      model.Remark),
                    new SqlParameter("@Sort",        model.Sort),
                    new SqlParameter("@Supplier_id", model.Supplier_id)
                };

                object obj = SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters);

                if (obj == null)
                {
                    return(1);
                }
                else
                {
                    return(Convert.ToInt32(obj));
                }
            }
Esempio n. 5
0
        public Lebi_Supplier_Delivery GetDelivery(int id)
        {
            Lebi_Supplier_Delivery model = B_Lebi_Supplier_Delivery.GetModel(id);

            if (model == null)
            {
                model = new Lebi_Supplier_Delivery();
            }
            return(model);
        }
Esempio n. 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Power("supplier_delivery_list", "配送点管理"))
            {
                WindowNoPower();
            }
            int id = RequestTool.RequestInt("id", 0);

            model = B_Lebi_Supplier_Delivery.GetModel("id = " + id + " and Supplier_id = " + CurrentSupplier.id + "");
            if (model == null)
            {
                model = new Lebi_Supplier_Delivery();
            }
        }
Esempio n. 7
0
            /// <summary>
            /// 增加一条数据
            /// </summary>
            public int Add(Lebi_Supplier_Delivery model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("insert into [Lebi_Supplier_Delivery](");
                strSql.Append("[Name],[Remark],[Sort],[Supplier_id])");
                strSql.Append(" values (");
                strSql.Append("@Name,@Remark,@Sort,@Supplier_id)");
                OleDbParameter[] parameters =
                {
                    new OleDbParameter("@Name",        model.Name),
                    new OleDbParameter("@Remark",      model.Remark),
                    new OleDbParameter("@Sort",        model.Sort),
                    new OleDbParameter("@Supplier_id", model.Supplier_id)
                };

                AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters);
                return(1);
            }
Esempio n. 8
0
            /// <summary>
            /// 更新一条数据
            /// </summary>
            public void Update(Lebi_Supplier_Delivery model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("update [Lebi_Supplier_Delivery] set ");
                strSql.Append("[Name]=@Name,");
                strSql.Append("[Remark]=@Remark,");
                strSql.Append("[Sort]=@Sort,");
                strSql.Append("[Supplier_id]=@Supplier_id");
                strSql.Append(" where id=" + model.id);
                OleDbParameter[] parameters =
                {
                    new OleDbParameter("@Name",        model.Name),
                    new OleDbParameter("@Remark",      model.Remark),
                    new OleDbParameter("@Sort",        model.Sort),
                    new OleDbParameter("@Supplier_id", model.Supplier_id)
                };

                AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters);
            }
Esempio n. 9
0
 /// <summary>
 /// 安全方式绑定对象表单
 /// </summary>
 public Lebi_Supplier_Delivery SafeBindForm(Lebi_Supplier_Delivery model)
 {
     if (HttpContext.Current.Request["Name"] != null)
     {
         model.Name = Shop.Tools.RequestTool.RequestSafeString("Name");
     }
     if (HttpContext.Current.Request["Remark"] != null)
     {
         model.Remark = Shop.Tools.RequestTool.RequestSafeString("Remark");
     }
     if (HttpContext.Current.Request["Sort"] != null)
     {
         model.Sort = Shop.Tools.RequestTool.RequestInt("Sort", 0);
     }
     if (HttpContext.Current.Request["Supplier_id"] != null)
     {
         model.Supplier_id = Shop.Tools.RequestTool.RequestInt("Supplier_id", 0);
     }
     return(model);
 }
Esempio n. 10
0
            /// <summary>
            /// 得到一个对象实体 by id
            /// </summary>
            public Lebi_Supplier_Delivery GetModel(int id)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("select  top 1  * from [Lebi_Supplier_Delivery] ");
                strSql.Append(" where id=@id");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@id", SqlDbType.Int, 4)
                };
                parameters[0].Value = id;

                Lebi_Supplier_Delivery model = new Lebi_Supplier_Delivery();
                DataSet ds = SqlUtils.SqlUtilsInstance.TextExecuteDataset(strSql.ToString(), parameters);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                    {
                        model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                    }
                    model.Name   = ds.Tables[0].Rows[0]["Name"].ToString();
                    model.Remark = ds.Tables[0].Rows[0]["Remark"].ToString();
                    if (ds.Tables[0].Rows[0]["Sort"].ToString() != "")
                    {
                        model.Sort = int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["Supplier_id"].ToString() != "")
                    {
                        model.Supplier_id = int.Parse(ds.Tables[0].Rows[0]["Supplier_id"].ToString());
                    }
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
Esempio n. 11
0
            /// <summary>
            /// 对象实体绑定数据
            /// </summary>
            public Lebi_Supplier_Delivery ReaderBind(IDataReader dataReader)
            {
                Lebi_Supplier_Delivery model = new Lebi_Supplier_Delivery();
                object ojb;

                ojb = dataReader["id"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.id = (int)ojb;
                }
                model.Name   = dataReader["Name"].ToString();
                model.Remark = dataReader["Remark"].ToString();
                ojb          = dataReader["Sort"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.Sort = (int)ojb;
                }
                ojb = dataReader["Supplier_id"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.Supplier_id = (int)ojb;
                }
                return(model);
            }
Esempio n. 12
0
        /// <summary>
        /// 导出供应商订单数据(商品)
        /// </summary>
        public void SupplierOrder_product_Export()
        {
            if (!EX_Admin.Power("statis_orderproduct", "订单报表"))
            {
                PageNoPower();
            }
            string where = RequestTool.RequestString("where");
            where        = Server.UrlDecode(where).Replace("&#180;", "'");
            //SystemLog.Add(where);
            string titles = "" + Tag("序号") + "," + Tag("供应商") + "," + Tag("配送点") + "," + Tag("单号") + "," + Tag("订购日期") + "," + Tag("发货时间") + "," + Tag("支付状态") + "," + Tag("支付方式") + "," + Tag("配送方式") + "," + Tag("商品名称") + "," + Tag("条形码") + "," + Tag("商品条码") + "," + Tag("单位") + "," + Tag("数量") + "," + Tag("金额") + "";

            string[]  arr = titles.Split(',');
            DataTable dt  = new DataTable();

            foreach (string col in arr)
            {
                dt.Columns.Add(col);
            }
            DataRow r = dt.NewRow();

            dt.Rows.Add(r);
            //List<Lebi_Order_Product> models = B_Lebi_Order_Product.GetList("Order_id in (select id from Lebi_Order where " + where + ")", "id desc");
            List <Lebi_Order_Product> models = B_Lebi_Order_Product.GetList(where, "id desc");
            //Response.Write(models.Count);
            //Response.End();
            StringBuilder sb = new StringBuilder();

            if (!Shop.LebiAPI.Service.Instanse.Check("managelicenese"))
            {
                sb.Append("LebiShop V" + SYS.Version + "." + SYS.Version_Son + " (http://www.lebi.cn),\r\n");
            }
            sb.Append(titles + "\r\n");
            //sb.Append("标签,");
            //sb.Append(tag + "\r\n");
            int                    i = 0;
            Lebi_Supplier          supplier;
            Lebi_Supplier_Delivery delivery;
            Lebi_Order             order;

            foreach (Lebi_Order_Product model in models)
            {
                order = Shop.Bussiness.Order.GetOrder(model.Order_id);
                i++;
                supplier = B_Lebi_Supplier.GetModel(order.Supplier_id);
                if (supplier == null)
                {
                    supplier = new Lebi_Supplier();
                }
                delivery = B_Lebi_Supplier_Delivery.GetModel(order.Supplier_Delivery_id);
                if (delivery == null)
                {
                    delivery = new Lebi_Supplier_Delivery();
                }
                sb.Append(i + ",");
                sb.Append(out_txt(supplier.SubName) + ",");
                sb.Append(out_txt(delivery.Name) + ",");
                sb.Append(order.Code + ",");
                sb.Append(order.Time_Add.ToString("yyyy-MM-dd HH:mm:ss") + ",");
                if (order.IsShipped == 1)
                {
                    sb.Append(order.Time_Shipped.ToString("yyyy-MM-dd HH:mm:ss") + ",");
                }
                else
                {
                    sb.Append("-,");
                }

                sb.Append((order.IsPaid == 1 ? Tag("已支付") : Tag("未支付")) + ",");
                sb.Append(out_txt(Lang(order.Pay) + Lang(order.OnlinePay)) + ",");
                sb.Append(out_txt(order.Transport_Name) + ",");
                sb.Append(out_txt(Lang(model.Product_Name)) + ",");
                sb.Append(model.Product_Number + ",");
                sb.Append(Shop.Bussiness.EX_Product.GetProduct(model.Product_id).Code + ",");
                sb.Append(Lang(Shop.Bussiness.EX_Product.ProductUnit(Shop.Bussiness.EX_Product.GetProduct(model.Product_id).Units_id)) + ",");
                sb.Append(model.Count + ",");
                sb.Append(model.Price * model.Count);
                sb.Append("\r\n");
            }
            FileTool.StringTofile(sb.ToString(), "order", ".csv");
        }
Esempio n. 13
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static void Update(Lebi_Supplier_Delivery model)
 {
     D_Lebi_Supplier_Delivery.Instance.Update(model);
 }
Esempio n. 14
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static int Add(Lebi_Supplier_Delivery model)
 {
     return(D_Lebi_Supplier_Delivery.Instance.Add(model));
 }
Esempio n. 15
0
 /// <summary>
 /// 安全方式绑定表单数据
 /// </summary>
 public static Lebi_Supplier_Delivery SafeBindForm(Lebi_Supplier_Delivery model)
 {
     return(D_Lebi_Supplier_Delivery.Instance.SafeBindForm(model));
 }