Ejemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string brandName = context.Request.Form["brandName"];
            string brandFullName = context.Request.Form["brandFullName"];
            string brandInfo = context.Request.Form["brandInfo"];
            string producerName = context.Request.Form["producerName"];
            string resultStr = "添加失败";

            if (string.IsNullOrEmpty(brandName))
            {
                resultStr = "品牌名称不可为空";
                context.Response.Write(resultStr);
                context.Response.End();
            }

            if (string.IsNullOrEmpty(brandFullName))
            {
                resultStr = "品牌全称不可为空";
                context.Response.Write(resultStr);
                context.Response.End();
            }
            if (string.IsNullOrEmpty(brandInfo))
            {
                resultStr = "品牌备注不可为空";
                context.Response.Write(resultStr);
                context.Response.End();
            }
            if (string.IsNullOrEmpty(producerName))
            {
                resultStr = "生产商名称";
                context.Response.Write(resultStr);
                context.Response.End();
            }
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            NFMT.Data.BLL.BrandBLL bdBLL = new NFMT.Data.BLL.BrandBLL();
            NFMT.Data.Model.Brand bd = new NFMT.Data.Model.Brand();
            bd.BrandName = brandName;
            bd.BrandFullName = brandFullName;
            bd.BrandInfo = brandInfo;
            bd.ProducerId = Convert.ToInt32(producerName);
            bd.BrandStatus = NFMT.Common.StatusEnum.已录入;

            NFMT.Common.ResultModel result = bdBLL.Insert(user, bd);
            context.Response.Write(result.Message);
        }
Ejemplo n.º 2
0
        public void ProcessRequest(HttpContext context)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            context.Response.ContentType = "text/plain";
            int id = 0;
            int operateId = 0;

            if (!int.TryParse(context.Request.Form["id"], out id) || id <= 0)
            {
                context.Response.Write("序号错误");
                context.Response.End();
            }

            if (!int.TryParse(context.Request.Form["oi"], out operateId) || operateId <= 0)
            {
                context.Response.Write("操作错误");
                context.Response.End();
            }

            NFMT.Data.BLL.BrandBLL bBll = new NFMT.Data.BLL.BrandBLL();
            NFMT.Data.Model.Brand brand = new NFMT.Data.Model.Brand()
            {
                BrandId = id,
                LastModifyId = user.EmpId
            };

            NFMT.Common.OperateEnum operateEnum = (NFMT.Common.OperateEnum)operateId;
            NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

            switch (operateEnum)
            {
                case NFMT.Common.OperateEnum.冻结:
                    result = bBll.Freeze(user, brand);
                    break;
                case NFMT.Common.OperateEnum.解除冻结:
                    result = bBll.UnFreeze(user, brand);
                    break;
            }

            context.Response.Write(result.Message);
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 32, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.冻结, NFMT.Common.OperateEnum.解除冻结 });

                this.navigation1.Routes.Add("品牌管理", string.Format("{0}BasicData/BrandList.aspx", NFMT.Common.DefaultValue.NftmSiteName));
                this.navigation1.Routes.Add("品牌明细", string.Empty);

                int id = 0;
                if (!string.IsNullOrEmpty(Request.QueryString["id"]))
                {
                    if (int.TryParse(Request.QueryString["id"], out id))
                    {
                        if (id == 0)
                            Response.Redirect("BrandList.aspx");
                        NFMT.Data.BLL.BrandBLL brandBLL = new NFMT.Data.BLL.BrandBLL();
                        var result = brandBLL.Get(user, id);
                        if (result.ResultStatus != 0)
                            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "error", string.Format("<script> alert({0})</script>", result.Message));

                        NFMT.Data.Model.Brand b = result.ReturnValue as NFMT.Data.Model.Brand;
                        if (b != null)
                        {
                            this.producerName.InnerText = b.ProducerName;
                            this.txbBrandName.InnerText = b.BrandName;
                            this.txbBrandInfo.InnerText = b.BrandInfo;
                            this.txbBrandFullName.InnerText = b.BrandFullName;
                            this.BrandStatusName.InnerText = b.BrandStatusName;

                            this.hidId.Value = b.BrandId.ToString();

                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 32, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.修改 });

                this.navigation1.Routes.Add("品牌管理", string.Format("{0}BasicData/BrandList.aspx", NFMT.Common.DefaultValue.NftmSiteName));
                this.navigation1.Routes.Add("品牌修改", string.Empty);

                int id = 0;
                if (!string.IsNullOrEmpty(Request.QueryString["id"]))
                {
                    if (int.TryParse(Request.QueryString["id"], out id))
                    {
                        if (id == 0)
                            Response.Redirect("BrandList.aspx");

                        NFMT.Data.BLL.BrandBLL bBLL = new NFMT.Data.BLL.BrandBLL();
                        var result = bBLL.Get(user, id);
                        if (result.ResultStatus != 0)
                            Response.Redirect("BrandList.aspx");

                        NFMT.Data.Model.Brand brand = result.ReturnValue as NFMT.Data.Model.Brand;
                        if (brand != null)
                        {
                            this.txbBrandName.Value = brand.BrandName;
                            this.txbBrandFullName.Value = brand.BrandFullName;
                            this.txbBrandInfo.Value = brand.BrandInfo;

                            this.hidproducerName.Value = brand.ProducerId.ToString();
                            this.hidBrandStatusName.Value = ((int)brand.BrandStatus).ToString();
                        }
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public void ProcessRequest(HttpContext context)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            context.Response.ContentType = "text/plain";

            string brandName = context.Request.Form["brandName"];
            string brandFullName = context.Request.Form["brandFullName"];
            string brandInfo = context.Request.Form["brandInfo"];
            int producerName = 0;
            int id = 0;
            int brandStatusName = 0;

            string resultStr = "修改失败";

            if (string.IsNullOrEmpty(context.Request.Form["id"]))
            {
                resultStr = "id未知";
                context.Response.Write(resultStr);
                context.Response.End();
            }

            if (!int.TryParse(context.Request.Form["id"], out id))
            {
                resultStr = "id未知";
                context.Response.Write(resultStr);
                context.Response.End();
            }
            if (!int.TryParse(context.Request.Form["producerName"], out producerName))
            {
                resultStr = "生产商名称序号不能为空";
                context.Response.Write(resultStr);
                context.Response.End();
            }
            if (!int.TryParse(context.Request.Form["brandStatusName"], out brandStatusName))
            {
                resultStr = "品牌状态序号不能为空";
                context.Response.Write(resultStr);
                context.Response.End();
            }

            if (string.IsNullOrEmpty(brandName))
            {
                resultStr = "品牌名称不能为空";
                context.Response.Write(resultStr);
                context.Response.End();
            }
            if (string.IsNullOrEmpty(brandFullName))
            {
                resultStr = "品牌全称不能为空";
                context.Response.Write(resultStr);
                context.Response.End();
            }
            if (string.IsNullOrEmpty(brandInfo))
            {
                resultStr = "品牌备注不能为空";
                context.Response.Write(resultStr);
                context.Response.End();
            }

            NFMT.Data.BLL.BrandBLL brandBLL = new NFMT.Data.BLL.BrandBLL();
            NFMT.Data.Model.Brand brand = new NFMT.Data.Model.Brand()
            {
                BrandName = brandName,
                BrandFullName = brandFullName,
                BrandInfo = brandInfo,
                BrandId = id,
                ProducerId = producerName,
                BrandStatus = (NFMT.Common.StatusEnum)brandStatusName
            };

            NFMT.Common.ResultModel result = brandBLL.Update(user, brand);
            if (result.ResultStatus == 0)
                context.Response.Write("修改成功");
            else
                context.Response.Write(resultStr);
        }
Ejemplo n.º 6
0
        public void ProcessRequest(HttpContext context)
        {
            int brandStatus = -1;
            int pageIndex = 1, pageSize = 10;
            string orderStr = string.Empty, whereStr = string.Empty;
            int producerName = 0;

            string key = context.Request["brandName"];//品牌名称模糊搜索

            if (!string.IsNullOrEmpty(context.Request["brandStatus"]))
                int.TryParse(context.Request["brandStatus"], out brandStatus);//状态查询条件

            if (!string.IsNullOrEmpty(context.Request["producerName"]))
                int.TryParse(context.Request["producerName"], out producerName);//生产商查询条件

            if (!string.IsNullOrEmpty(context.Request.QueryString["page"]))
                int.TryParse(context.Request.QueryString["page"].Trim(), out pageIndex);

            if (!string.IsNullOrEmpty(context.Request.QueryString["rows"]))
                int.TryParse(context.Request.QueryString["rows"].Trim(), out pageSize);

            //jqwidgets jqxGrid
            if (!string.IsNullOrEmpty(context.Request.QueryString["pagenum"]))
                int.TryParse(context.Request.QueryString["pagenum"], out pageIndex);
            pageIndex++;
            if (!string.IsNullOrEmpty(context.Request.QueryString["pagesize"]))
                int.TryParse(context.Request.QueryString["pagesize"], out pageSize);
            if (!string.IsNullOrEmpty(context.Request.QueryString["sortdatafield"]) && !string.IsNullOrEmpty(context.Request.QueryString["sortorder"]))
            {
                string sortDataField = context.Request.QueryString["sortdatafield"].Trim();
                string sortOrder = context.Request.QueryString["sortorder"].Trim();

                switch (sortDataField)
                {
                    case "BrandStatusName":
                        sortDataField = "bd.StatusName";
                        break;
                }
                orderStr = string.Format("{0} {1}", sortDataField, sortOrder);
            }

            NFMT.Data.BLL.BrandBLL brandBLL = new NFMT.Data.BLL.BrandBLL();
            NFMT.Common.SelectModel select = brandBLL.GetSelectModel(pageIndex, pageSize, orderStr, brandStatus, key, producerName);
            NFMT.Common.ResultModel result = brandBLL.Load(new NFMT.Common.UserModel(), select);

            context.Response.ContentType = "text/plain";
            if (result.ResultStatus != 0)
            {
                context.Response.Write(result.Message);
                context.Response.End();
            }

            int totalRows = result.AffectCount;
            System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;
            Dictionary<string, object> dic = new Dictionary<string, object>();

            //jqwidgets
            dic.Add("count", result.AffectCount);
            dic.Add("data", dt);

            string postData = Newtonsoft.Json.JsonConvert.SerializeObject(dic, new Newtonsoft.Json.Converters.DataTableConverter());

            context.Response.Write(postData);
        }