Esempio n. 1
0
        /// <summary>
        /// 删除地址
        /// </summary>
        /// <param name="location_id"></param>
        /// <returns></returns>
        public string DeleteLocation(HttpContext context, long location_id)
        {
            var location = new LocationBLL().GetAllQuoteLocation(location_id);

            if (location != null && location.Count > 0)
            {
                return("Occupy");
            }
            else
            {
                var delete_location = new crm_location_dal().GetLocationById(location_id);
                if (new LocationBLL().DeleteLocation(location_id, LoginUserId)) // 删除成功
                {
                    return("Success");
                }
                else
                {
                    return("Fail");
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 更改地址
        /// </summary>
        /// <param name="new_location"></param>
        /// <param name="user_id"></param>
        /// <returns></returns>
        public bool Update(crm_location new_location, long user_id)
        {
            crm_location old_location = new crm_location_dal().GetLocationById(new_location.id);  // 根据客户id去获取到客户的地址,然后判断地址是否修改

            new_location.oid            = old_location.oid;
            new_location.create_user_id = old_location.create_user_id;
            new_location.create_time    = old_location.create_time;
            new_location.update_user_id = old_location.update_user_id;
            new_location.update_time    = old_location.update_time;
            if (!old_location.Equals(new_location))   // 代表用户更改了地址
            {
                var user = UserInfoBLL.GetUserInfo(user_id);
                new_location.update_user_id     = user.id;
                new_location.update_time        = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
                new_location.additional_address = string.IsNullOrEmpty(new_location.additional_address) ? "" : new_location.additional_address;
                // 修改客户显示默认地址,默认地址不能主动移除
                if (new_location.is_default == 1 && old_location.is_default != 1)                      //  默认地址不进行修改的时候,忽略不计
                {
                    new crm_location_dal().UpdateDefaultLocation((long)new_location.account_id, user); // 首先将原来的默认地址取消  操作日志在方法内插入
                }

                new crm_location_dal().Update(new_location);             // 更改地址信息
                new sys_oper_log_dal().Insert(new sys_oper_log()
                {
                    user_cate           = "用户",
                    user_id             = user.id,
                    name                = user.name,
                    phone               = user.mobile == null ? "" : user.mobile,
                    oper_time           = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now),
                    oper_object_cate_id = (int)OPER_LOG_OBJ_CATE.CUSTOMER,
                    oper_object_id      = new_location.id,
                    oper_type_id        = (int)OPER_LOG_TYPE.UPDATE,
                    oper_description    = _dal.CompareValue(old_location, new_location),
                    remark              = "修改客户地址",
                });    // 插入更改日志
            }

            return(true);
        }
Esempio n. 3
0
        /// <summary>
        /// 页面参数处理
        /// </summary>
        protected PreferencesInvoiceDto GetParam()
        {
            var thisParam = AssembleModel <PreferencesInvoiceDto>();
            var thisRef   = AssembleModel <crm_account_reference>();

            thisRef.no_contract_bill_to_parent = (sbyte)(nocontract_bill_to_parent.Checked ? 1 : 0);
            thisParam.is_tax_exempt            = _ctl3_chkTaxExempt_ATCheckBox.Checked ? 1 : 0;
            thisRef.enable_email_invoice       = (sbyte)(enable_email.Checked?1:0);
            // 是否14)	支持发送邮件:界面输入-todo
            var addressType = Request.Form["_ctl3_rdoBillTo"];

            switch (addressType)
            {
            case "_ctl3_rdoAccount":
                thisRef.invoice_address_type_id = (int)DicEnum.INVOICE_ADDRESS_TYPE.USE_ACCOUNT_ADDRESS;

                break;

            case "_ctl3_UseParent":
                thisRef.invoice_address_type_id = (int)DicEnum.INVOICE_ADDRESS_TYPE.USE_PARENT_ACC_ADD;
                break;

            case "_ctl3UseParInv":
                thisRef.invoice_address_type_id = (int)DicEnum.INVOICE_ADDRESS_TYPE.USE_PARENT_INVOIVE_ADD;
                break;

            case "_ctl3_rdoAccountBillTo":
                thisRef.invoice_address_type_id = (int)DicEnum.INVOICE_ADDRESS_TYPE.USE_INSERT;
                var location = AssembleModel <crm_location>();
                location.account_id = account.id;
                location.is_default = 0;
                if (location.province_id != 0 && location.city_id != 0 && location.district_id != null && location.district_id != 0 && (!string.IsNullOrEmpty(location.address)))
                {
                    break;
                }
                if (thisRef.billing_location_id == null)
                {
                    new LocationBLL().Insert(location, GetLoginUserId());
                    thisRef.billing_location_id = location.id;
                }
                else
                {
                    var oldLocation = new crm_location_dal().FindNoDeleteById((long)thisRef.billing_location_id);
                    location.id             = oldLocation.id;
                    location.is_default     = oldLocation.is_default;
                    location.location_label = oldLocation.location_label;
                    new LocationBLL().Update(location, GetLoginUserId());
                }

                break;

            default:
                break;
            }



            if (accRef != null)
            {
                accRef.invoice_tmpl_id            = thisRef.invoice_tmpl_id;
                accRef.attention                  = thisRef.attention;
                accRef.address                    = thisRef.address;
                accRef.additional_address         = thisRef.additional_address;
                accRef.province_id                = thisRef.province_id;
                accRef.city_id                    = thisRef.city_id;
                accRef.district_id                = thisRef.district_id;
                accRef.postal_code                = thisRef.postal_code;
                accRef.no_contract_bill_to_parent = thisRef.no_contract_bill_to_parent;
                accRef.invoice_address_type_id    = thisRef.invoice_address_type_id;
                accRef.email_to_contacts          = thisRef.email_to_contacts;
                accRef.email_to_others            = thisRef.email_to_others;
                accRef.email_bcc_resources        = thisRef.email_bcc_resources;
                accRef.email_bcc_account_manager  = thisRef.email_bcc_account_manager;


                thisParam.accRef = this.accRef;
            }
            else
            {
                thisRef.account_id = account.id;
                thisParam.accRef   = thisRef;
            }
            return(thisParam);
        }