コード例 #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public string Add(Model.Customer model, Model.Contacts contact, Model.manager manager, out int cid)
        {
            cid = 0;
            if (string.IsNullOrEmpty(model.c_name))
            {
                return("请填写客户名称");
            }
            if (model.c_type == 0)
            {
                return("请选择客户类别");
            }
            if (new BLL.Customer().Exists(model.c_name))
            {
                return("该客户名称已存在");
            }
            if (string.IsNullOrEmpty(model.c_business))
            {
                return("请填写业务范围");
            }
            if (string.IsNullOrEmpty(contact.co_name))
            {
                return("主要联系人不能为空");
            }
            if (string.IsNullOrEmpty(contact.co_number))
            {
                return("主要联系号码不能为空");
            }
            if ((model.c_type == 2 || model.c_type == 3) && !new BLL.permission().checkHasPermission(manager, "0301"))
            {
                return("没有客户管理权限0301");
            }
            string result = string.Empty;

            result = dal.Add(model, contact, out cid);
            if (string.IsNullOrEmpty(result))
            {
                Model.business_log log = new Model.business_log();
                log.ol_title        = "添加客户";
                log.ol_cid          = cid;
                log.ol_content      = "客户名称:" + model.c_name + "<br/>客户类别:" + Common.BusinessDict.customerType()[model.c_type] + "<br/>信用代码(税号):" + model.c_num + "<br/>业务范围:" + model.c_business + "<br/>备注:" + model.c_remarks + "<br/>主要联系人:" + contact.co_name + "<br/>主要联系人号码:" + contact.co_number + "";
                log.ol_operateDate  = DateTime.Now;
                log.ol_operaterNum  = manager.user_name;
                log.ol_operaterName = manager.real_name;
                new business_log().Add(DTEnums.ActionEnum.Add.ToString(), log, manager.user_name, manager.real_name);
                return("");
            }
            return(result);
        }