예제 #1
0
        public void DeleteSupplierInfo(HttpContext context)
        {
            string result = string.Empty;

            try
            {
                var SId = DNTRequest.GetString("SId");
                if (string.IsNullOrEmpty(SId))
                {
                    result = DNTRequest.GetResultJson(false, "请先选择一条数据", null);
                    return;
                }
                else
                {
                    UsersBLL oUsersBLL  = new UsersBLL();
                    Users    modelUsers = new Users();
                    modelUsers = oUsersBLL.GetModelBySId(Convert.ToInt32(SId));
                    if (modelUsers != null)
                    {
                        result = DNTRequest.GetResultJson(false, "商户已绑定用户,不允许删除", null);
                    }
                    else
                    {
                        SupplierInfoBLL bll = new SupplierInfoBLL();
                        bool            res = bll.Delete(Convert.ToInt32(SId));
                        if (res)
                        {
                            result = DNTRequest.GetResultJson(true, "删除商户成功", null);
                        }
                        else
                        {
                            result = DNTRequest.GetResultJson(false, "删除商户失败,请稍后再试", null);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, "删除用户异常,请稍后再试", null);
                ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString());
            }
            context.Response.Write(result);
        }