Example #1
0
        private void EditSupplierStatus(HttpContext context)
        {
            int num  = context.Request["supplierId"].ToInt(0);
            int num2 = context.Request["statusvalue"].ToInt(0);

            num2 = ((num2 == 1) ? num2 : 2);
            string empty = string.Empty;

            if (num <= 0)
            {
                empty = "{\"success\":\"false\",\"msg\":\"参数错误,请勿操作!\"}";
                this.ResponseEnd(empty);
            }
            SupplierInfo supplierById = SupplierHelper.GetSupplierById(num);

            if (supplierById == null || supplierById.SupplierId <= 0)
            {
                empty = "{\"success\":\"false\",\"msg\":\"供应商已不存在,请重新点击列表进行操作!!\"}";
                this.ResponseEnd(empty);
            }
            if (supplierById.Status.Equals(num2))
            {
                empty = "{\"success\":\"false\",\"msg\":\"编辑状态就是当前状态,不需要重新修改!!\"}";
                this.ResponseEnd(empty);
            }
            supplierById.Status = num2;
            if (num2 == 1)
            {
                empty = ((SupplierHelper.UpdateSupplier_Recover(num) <= 0) ? "{\"success\":\"false\",\"msg\":\"供应商状态“恢复”失败!\"}" : "{\"success\":\"true\",\"msg\":\"供应商状态“恢复”成功!\"}");
            }
            else
            {
                int num3 = SupplierHelper.UpdateSupplier_Frozen(num);
                empty = ((num3 <= 0) ? "{\"success\":\"false\",\"msg\":\"供应商状态“冻结”失败!\"}" : "{\"success\":\"true\",\"msg\":\"供应商状态“冻结”成功!\"}");
            }
            this.ResponseEnd(empty);
        }