Пример #1
0
        /// <summary>
        /// 插入
        /// </summary>
        /// <param name="data"></param>
        /// <param name="user_id"></param>
        /// <returns></returns>
        public ERROR_CODE Insert(d_account_classification data, long user_id)
        {
            var user = UserInfoBLL.GetUserInfo(user_id);

            if (user == null)
            {   // 查询不到用户,用户丢失
                return(ERROR_CODE.USER_NOT_FIND);
            }
            var cla = _dal.FindSignleBySql <d_account_classification>($"select * from d_account_classification where name='{data.name}' and delete_time=0");

            if (cla != null)
            {
                return(ERROR_CODE.EXIST);
            }
            data.create_time    = data.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
            data.create_user_id = user_id;
            _dal.Insert(data);
            var add_log = new sys_oper_log()
            {
                user_cate           = "用户",
                user_id             = (int)user.id,
                name                = "",
                phone               = user.mobile == null ? "" : user.mobile,
                oper_time           = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now),
                oper_object_cate_id = (int)OPER_LOG_OBJ_CATE.ACCOUNTCLASS, //
                oper_object_id      = data.id,                             // 操作对象id
                oper_type_id        = (int)OPER_LOG_TYPE.ADD,
                oper_description    = _dal.AddValue(data),
                remark              = "新增客户类别信息"
            };                                      // 创建日志

            new sys_oper_log_dal().Insert(add_log); // 插入日志
            return(ERROR_CODE.SUCCESS);
        }
Пример #2
0
 //处理保存数据
 public bool save_deal()
 {
     if (id > 0)
     {
         dac = acbll.GetSingel(id);
     }
     dac.name = this.Name.Text.ToString();
     //激活状态判断
     if (this.Active.Checked)
     {
         dac.status_id = 1;
     }
     else
     {
         dac.status_id = 0;
     }
     if (!string.IsNullOrEmpty(this.Description.Text))
     {
         dac.remark = this.Description.Text.Trim().ToString();
     }
     dac.icon_path = SavePic();
     if (id > 0)//修改
     {
         var result = acbll.Update(dac, GetLoginUserId());
         if (result == DTO.ERROR_CODE.SUCCESS)
         {
             return(true);
         }
         else if (result == DTO.ERROR_CODE.USER_NOT_FIND)               // 用户丢失
         {
             Response.Write("<script>alert('查询不到用户,请重新登陆');</script>");
             Response.Redirect("../Login.aspx");
         }
         else if (result == DTO.ERROR_CODE.EXIST)
         {
             Response.Write("<script>alert('已经存在相同名称,请修改!');</script>");
         }
     }
     else  //新增
     {
         var result = acbll.Insert(dac, GetLoginUserId());
         if (result == DTO.ERROR_CODE.SUCCESS)
         {
             return(true);
         }
         else if (result == DTO.ERROR_CODE.USER_NOT_FIND)               // 用户丢失
         {
             Response.Write("<script>alert('查询不到用户,请重新登陆');</script>");
             Response.Redirect("../Login.aspx");
         }
         else if (result == DTO.ERROR_CODE.EXIST)
         {
             Response.Write("<script>alert('已经存在相同名称,请修改!');</script>");
         }
     }
     return(false);
 }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var accountId = Request.QueryString["accountId"];

            if (!string.IsNullOrEmpty(accountId))
            {
                account = comBll.GetCompany(long.Parse(accountId));
            }
            if (account == null)
            {
                Response.Write("<script>alert('未获取到客户信息');window.close();</script>");
                return;
            }
            accLocation = new DAL.crm_location_dal().GetLocationByAccountId(account.id);
            if (accLocation != null)
            {
                var disDal = new DAL.d_district_dal();
                if (accLocation.country_id != null)
                {
                    var country = new DAL.d_country_dal().FindById((long)accLocation.country_id);
                    countryName = country != null ? country.country_name_display : "";
                }
                var province = disDal.FindById((long)accLocation.province_id);
                provinceName = province != null ? province.name : "";
                var city = disDal.FindById((long)accLocation.city_id);
                cityName = city != null ? city.name : "";
                var district = disDal.FindById((long)accLocation.district_id);
                districtName = district != null ? district.name : "";
            }
            if (account.resource_id != null)
            {
                accMan = new DAL.sys_resource_dal().FindNoDeleteById((long)account.resource_id);
            }
            startDate = DateTime.Parse(DateTime.Now.AddMonths(-1).ToString("yyyy-MM") + "-01");
            endDate   = startDate.AddMonths(1).AddDays(-1);

            contractMoney = new DAL.crm_account_deduction_dal().GetContractSum(account.id, startDate, endDate);
            projectMoney  = new DAL.crm_account_deduction_dal().GetProjectSum(account.id, startDate, endDate);
            if (account.classification_id != null)
            {
                accClass = new DAL.d_account_classification_dal().FindNoDeleteById((long)account.classification_id);
            }
        }
Пример #4
0
 public d_account_classification dac = new d_account_classification(); //客户类型的对象
 protected void Page_Load(object sender, EventArgs e)
 {
     id = Convert.ToInt64(Request.QueryString["id"]);
     //id = 16;测试
     if (id > 0)
     {
         //获取id对象,再进行修改
         dac = acbll.GetSingel(id);
         if (dac == null)
         {
             Response.Write("<script>alert('获取相关信息失败,无法修改!');window.close();self.opener.location.reload();</script>");
         }
         if (dac.icon_path != null && !string.IsNullOrEmpty(dac.icon_path.ToString()))
         {
             avatarPath = dac.icon_path.ToString();
         }
     }
     if (!IsPostBack)
     {
         if (id > 0)
         {
             this.Name.Text = dac.name;
             if (dac.status_id != null && Convert.ToInt32(dac.status_id) > 0)
             {
                 this.Active.Checked = true;
             }
             else
             {
                 this.Active.Checked = true;
             }
             if (dac.remark != null && !string.IsNullOrEmpty(dac.remark.ToString()))
             {
                 this.Description.Text = dac.remark.ToString();
             }
         }
         else
         {
             this.Active.Checked = true;
         }
     }
 }