Exemple #1
0
        private void onload()
        {
            string sql   = string.Empty;
            string error = string.Empty;

            if (ToolManager.CheckQueryString("Id"))
            {
                sql = string.Format(@" select * from Customer where CustomerId='{0}' ", ToolManager.GetQueryString("Id"));
                Customer customer = CustomerInfoManager.ConvertDataTableToModel(sql);
                this.lbCustomerId.InnerText        = customer.CustomerId;
                this.lbCustomerName.InnerText      = customer.CustomerName;
                this.lbRegisteredAddress.InnerText = customer.RegisteredAddress;
                this.lbLegalPerson.InnerText       = customer.LegalPerson;
                this.lbContacts.InnerText          = customer.Contacts;
                this.lbRegisteredPhone.InnerText   = customer.RegisteredPhone;
                this.lbContactTelephone.InnerText  = customer.ContactTelephone;
                this.lbFax.InnerText             = customer.Fax;
                this.lbMobilePhone.InnerText     = customer.MobilePhone;
                this.lbEmail.InnerText           = customer.Email;
                this.lbQQ.InnerText              = customer.QQ;
                this.lbZipCode.InnerText         = customer.ZipCode;
                this.lbSparePhone.InnerText      = customer.SparePhone;
                this.lbAccountBank.InnerText     = customer.AccountBank;
                this.lbSortCode.InnerText        = customer.SortCode;
                this.lbBankAccount.InnerText     = customer.BankAccount;
                this.lbTaxNo.InnerText           = customer.TaxNo;
                this.lbDeliveryAddress.InnerText = customer.DeliveryAddress;
                this.lbWebsiteAddress.InnerText  = customer.WebsiteAddress;
                this.lbRemark.InnerText          = customer.Remark;
            }
        }
Exemple #2
0
        public async Task <ActionResult> Edit(string id)
        {
            var manager = new UserManager();
            var user    = await manager.FindByIdAsync(id);

            var customerUserEditViewModel = new CustomerUserEditViewModel(user);
            var discountRateManager       = new DiscountRateManager();
            var discountRate = await discountRateManager.GetCustomerDiscountRateAsync(user.Id);

            if (discountRate != null)
            {
                customerUserEditViewModel.PriceOfWorkDiscountRate = discountRate.PriceOfWork;
                customerUserEditViewModel.SideStoneDiscountRate   = discountRate.SideStone;
                customerUserEditViewModel.StoneSetterDiscountRate = discountRate.StoneSetter;
                customerUserEditViewModel.Loss18KRate             = discountRate.Loss18K;
                customerUserEditViewModel.LossPtRate = discountRate.LossPt;
            }

            var customerInfoManager = new CustomerInfoManager(User);
            var customerInfo        = await customerInfoManager.GetCustomerInfoAsync(user.Id);

            if (customerInfo != null)
            {
                customerUserEditViewModel.Address = customerInfo.Address;
            }

            return(View(customerUserEditViewModel));
        }
Exemple #3
0
        private async Task SaveCustomerInfo(CustomerUserEditViewModel model)
        {
            var manager      = new CustomerInfoManager(User);
            var customerInfo = await manager.GetCustomerInfoAsync(model.Id);

            if (customerInfo == null)
            {
                customerInfo = new CustomerInfo();
            }

            customerInfo.UserId  = model.Id;
            customerInfo.Address = model.Address;

            await manager.SaveCustomerInfoAsync(customerInfo);
        }
Exemple #4
0
 public FileInfoController(FileInfoManager fileInfoManager,
                           CustomerInfoManager customerInfoManager,
                           FileScopeManager fileScopeManager,
                           CustomerDealManager customerDealManager,
                           RestClient restClient,
                           IMapper mapper,
                           PermissionExpansionManager permissionExpansionManager)
 {
     _permissionExpansionManager = permissionExpansionManager ?? throw new ArgumentNullException(nameof(permissionExpansionManager));
     _fileInfoManager            = fileInfoManager;
     _icustomerInfoManager       = customerInfoManager;
     _fileScopeManager           = fileScopeManager;
     _customerDealManager        = customerDealManager;
     _restClient = restClient;
     _mapper     = mapper;
 }
Exemple #5
0
        public async Task <ActionResult> List(CustomerQueryRequest request)
        {
            if (!Request.IsAjaxRequest())
            {
                return(View());
            }

            var manager = new UserManager();
            var paging  = await manager.GetCustomersAsync(request.Start, request.Take, request.GetCustomerListQueryFilter(User));

            var customerIds = paging.List.Select(c => c.Id);

            var dicountRateManager = new DiscountRateManager();
            var dicountRates       = await dicountRateManager.GetCustomerDiscountRatesAsync(customerIds);

            var customerInfoManager = new CustomerInfoManager(User);
            var customerInfos       = await customerInfoManager.GetCustomerInfosRatesAsync(customerIds);

            var customers = paging.List.Select(u =>
            {
                var customerViewModel = new CustomerViewModel(u);
                var dicountRate       = dicountRates.FirstOrDefault(r => r.CustomerId == u.Id);
                if (dicountRate != null)
                {
                    customerViewModel.PriceOfWorkDiscountRate = dicountRate.PriceOfWork;
                    customerViewModel.SideStoneDiscountRate   = dicountRate.SideStone;
                    customerViewModel.StoneSetterDiscountRate = dicountRate.StoneSetter;
                    customerViewModel.Loss18KRate             = dicountRate.Loss18K;
                    customerViewModel.LossPtRate = dicountRate.LossPt;
                }

                var customerInfo = customerInfos.FirstOrDefault(r => r.UserId == u.Id);
                if (customerInfo != null)
                {
                    customerViewModel.Address = customerInfo.Address;
                }

                return(customerViewModel);
            });

            return(Json(true, string.Empty, new
            {
                paging.Total,
                List = customers,
            }));
        }
        private void LoadPage()
        {
            string sql   = string.Empty;
            string error = string.Empty;

            ControlBindManager.BindDrp(" select id,MakeCollectionsMode from MakeCollectionsMode ", this.drpMakeCollectionsModeId, "id", "MakeCollectionsMode");
            if (ToolManager.CheckQueryString("Id"))
            {
                sql = string.Format(@" select * from Customer where CustomerId='{0}' ", ToolManager.GetQueryString("Id"));
                //sql = string.Format(@" select * from Customer where CustomerId='{0}' ", "5");
                this.trCustomerNuber.Visible = false;
                Customer customer = CustomerInfoManager.ConvertDataTableToModel(sql);
                this.txtCustomerNumber.Text    = customer.CustomerId;
                this.txtCustomerName.Text      = customer.CustomerName;
                this.txtRegisteredAddress.Text = customer.RegisteredAddress;
                this.txtLegalPerson.Text       = customer.LegalPerson;
                this.txtContacts.Text          = customer.Contacts;
                this.txtRegisteredPhone.Text   = customer.RegisteredPhone;
                this.txtContactTelephone.Text  = customer.ContactTelephone;
                this.txtFax.Text             = customer.Fax;
                this.txtMobilePhone.Text     = customer.MobilePhone;
                this.txtZipCode.Text         = customer.ZipCode;
                this.txtSparePhone.Text      = customer.SparePhone;
                this.txtEmail.Text           = customer.Email;
                this.txtQQ.Text              = customer.QQ;
                this.txtAccountBank.Text     = customer.AccountBank;
                this.txtSortCode.Text        = customer.SortCode;
                this.txtBankAccount.Text     = customer.BankAccount;
                this.txtTaxNo.Text           = customer.TaxNo;
                this.txtWebsiteAddress.Text  = customer.WebsiteAddress;
                this.txtDeliveryAddress.Text = customer.DeliveryAddress;
                //this.txtPaymentdays.Text = customer.Paymentdays.ToString();
                //this.drpPercentageInAdvance.SelectedValue = customer.PercentageInAdvance.ToString();
                this.txtRemark.Text = customer.Remark;
                this.drpMakeCollectionsModeId.SelectedValue = customer.MakeCollectionsModeId;
                this.txtFactoryAddress.Text       = customer.FactoryAddress;
                this.drpReceiveType.SelectedValue = customer.ReceiveType;
                btnSubmit.Text = "修改";
            }
            else
            {
                btnSubmit.Text = "添加";
            }
        }
        public OrderConfirmOutput ConfirmOrder(OrderConfirmInput input)
        {
            ProductBoughtContext boughtContext = input.MapTo <ProductBoughtContext>();

            foreach (BoughtItem boughtItem in boughtContext.BoughtItems)
            {
                boughtItem.UserId        = InfrastructureSession.UserId.Value;
                boughtItem.Specification = SpecificationRepository.Get(boughtItem.SpecificationId);
            }
            ProductSalePriceService.Calculate(boughtContext);

            OrderConfirmOutput orderConfirmOutput = boughtContext.MapTo <OrderConfirmOutput>();

            if (input.CustomerInfoId.HasValue)
            {
                orderConfirmOutput.CustomerInfo = CustomerInfoRepository.Get(input.CustomerInfoId.Value).MapTo <CustomerInfoDto>();
            }
            else
            {
                orderConfirmOutput.CustomerInfo = CustomerInfoManager.GetDefaultCustomerInfo(InfrastructureSession.UserId.Value).MapTo <CustomerInfoDto>();
            }
            return(orderConfirmOutput);
        }
Exemple #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //删除
                if (ToolManager.CheckQueryString("ids"))
                {
                    string temp   = CustomerInfoManager.DeleteCustomer(ToolManager.GetQueryString("ids"));
                    string ids    = ToolManager.GetQueryString("ids");
                    bool   result = temp == "1" ? true : false;
                    if (result)
                    {
                        Tool.WriteLog(Tool.LogType.Operating, "删除客户信息" + ToolManager.ReplaceSingleQuotesToBlank(ids), "删除成功");
                        Response.Write(temp);
                        Response.End();
                        return;
                    }
                    else
                    {
                        Tool.WriteLog(Tool.LogType.Operating, "删除客户信息" + ToolManager.ReplaceSingleQuotesToBlank(ids), "删除失败!原因" + temp);
                        Response.Write(temp);
                        Response.End();
                        return;
                    }
                }
                //查询
                if (ToolManager.CheckQueryString("pageIndex"))
                {
                    GetPageOperation("btnSearch", "AddOrEditCustomer.aspx", "CustomerDetailedList.aspx");
                }

                divAdd.Visible    = ToolCode.Tool.GetUserMenuFunc("L0102", "Add");
                divDelete.Visible = ToolCode.Tool.GetUserMenuFunc("L0102", "Delete");
                divImp.Visible    = ToolCode.Tool.GetUserMenuFunc("L0102", "Imp");
                divExp.Visible    = ToolCode.Tool.GetUserMenuFunc("L0102", "Exp");
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string error = string.Empty;

            Model.Customer customer = new Model.Customer();
            customer.CustomerId        = this.txtCustomerNumber.Text.Trim();
            customer.CustomerName      = this.txtCustomerName.Text.Trim();
            customer.RegisteredAddress = this.txtRegisteredAddress.Text.Trim();
            customer.LegalPerson       = this.txtLegalPerson.Text.Trim();
            customer.Contacts          = this.txtContacts.Text.Trim();
            customer.RegisteredPhone   = this.txtRegisteredPhone.Text.Trim();
            customer.ContactTelephone  = this.txtContactTelephone.Text.Trim();
            customer.Fax                   = this.txtFax.Text.Trim();
            customer.MobilePhone           = this.txtMobilePhone.Text.Trim();
            customer.ZipCode               = this.txtZipCode.Text.Trim();
            customer.SparePhone            = this.txtSparePhone.Text.Trim();
            customer.Email                 = this.txtEmail.Text.Trim();
            customer.QQ                    = this.txtQQ.Text.Trim();
            customer.AccountBank           = this.txtAccountBank.Text.Trim();
            customer.SortCode              = this.txtSortCode.Text.Trim();
            customer.BankAccount           = this.txtBankAccount.Text.Trim();
            customer.TaxNo                 = this.txtTaxNo.Text.Trim();
            customer.WebsiteAddress        = this.txtWebsiteAddress.Text.Trim();
            customer.DeliveryAddress       = this.txtDeliveryAddress.Text.Trim();
            customer.Paymentdays           = 0;
            customer.PercentageInAdvance   = 0;
            customer.Remark                = this.txtRemark.Text.Trim();
            customer.FactoryAddress        = this.txtFactoryAddress.Text.Trim();
            customer.MakeCollectionsModeId = this.drpMakeCollectionsModeId.SelectedValue;
            customer.ReceiveType           = this.drpReceiveType.SelectedValue;
            if (string.IsNullOrEmpty(customer.CustomerId) || string.IsNullOrEmpty(customer.CustomerName))
            {
                lbSubmit.Text = "请将带*号的内容填写完整!";
                return;
            }
            bool result = false;

            if (btnSubmit.Text.Equals("添加"))
            {
                result        = CustomerInfoManager.AddCustomer(customer, ref error);
                lbSubmit.Text = result == true ? "添加成功" : "添加失败!原因" + error;
                if (result)
                {
                    Tool.WriteLog(Tool.LogType.Operating, "增加客户信息" + customer.CustomerId, "增加成功");
                    ToolCode.Tool.ResetControl(this.Controls);
                    return;
                }
                else
                {
                    Tool.WriteLog(Tool.LogType.Operating, "增加客户信息" + customer.CustomerId, "增加失败!原因" + error);
                    return;
                }
            }
            else
            {
                result        = CustomerInfoManager.EditCustomer(customer, ref error);
                lbSubmit.Text = result == true ? "修改成功" : "修改失败!原因" + error;
                if (result)
                {
                    Tool.WriteLog(Tool.LogType.Operating, "修改客户信息" + customer.CustomerId, "修改成功");
                    return;
                }
                else
                {
                    Tool.WriteLog(Tool.LogType.Operating, "修改客户信息" + customer.CustomerId, "修改失败!原因" + error);
                    return;
                }
            }
        }
Exemple #10
0
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            string  error = string.Empty;
            DataSet ds    = ToolManager.ImpExcel(this.FU_Excel, Server);

            if (ds == null)
            {
                lbMsg.Text = "选择的文件为空或不是标准的Excel文件!";
                return;
            }
            List <Customer> customerss = new List <Customer>();

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                Customer customer = new Customer();
                customer.CustomerId        = dr["客户编号"] == null ? "" : dr["客户编号"].ToString();
                customer.CustomerName      = dr["客户名称"] == null ? "" : dr["客户名称"].ToString();
                customer.RegisteredAddress = dr["注册地址"] == null ? "" : dr["注册地址"].ToString();
                customer.LegalPerson       = dr["法人代表"] == null ? "" : dr["法人代表"].ToString();
                customer.Contacts          = dr["联系人"] == null ? "" : dr["联系人"].ToString();
                customer.RegisteredPhone   = dr["注册电话"] == null ? "" : dr["注册电话"].ToString();
                customer.ContactTelephone  = dr["联系电话"] == null ? "" : dr["联系电话"].ToString();
                customer.Fax             = dr["传真"] == null ? "" : dr["传真"].ToString();
                customer.MobilePhone     = dr["手机"] == null ? "" : dr["手机"].ToString();
                customer.ZipCode         = dr["邮编"] == null ? "" : dr["邮编"].ToString();
                customer.SparePhone      = dr["备用电话"] == null ? "" : dr["备用电话"].ToString();
                customer.Email           = dr["Email"] == null ? "" : dr["Email"].ToString();
                customer.QQ              = dr["QQ"] == null ? "" : dr["QQ"].ToString();
                customer.AccountBank     = dr["开户银行"] == null ? "" : dr["开户银行"].ToString();
                customer.SortCode        = dr["银行行号"] == null ? "" : dr["银行行号"].ToString();
                customer.BankAccount     = dr["银行账号"] == null ? "" : dr["银行账号"].ToString();
                customer.TaxNo           = dr["纳税号"] == null ? "" : dr["纳税号"].ToString();
                customer.WebsiteAddress  = dr["网址"] == null ? "" : dr["网址"].ToString();
                customer.DeliveryAddress = dr["送货地点"] == null ? "" : dr["送货地点"].ToString();
                customer.FactoryAddress  = dr["工厂地址"] == null ? "" : dr["工厂地址"].ToString();

                string sql = string.Format(@" select id from MakeCollectionsMode where MakeCollectionsMode='{0}'",
                                           dr["收款方式"] == null ? "" : dr["收款方式"].ToString());
                customer.MakeCollectionsModeId = SqlHelper.GetScalar(sql);

                customer.Remark              = dr["备注"] == null ? "" : dr["备注"].ToString();
                customer.Paymentdays         = 0;
                customer.PercentageInAdvance = 0;
                //if (dr["账期"] == null || dr["账期"].ToString() == "")
                //{
                //    customer.Paymentdays = 0;

                //}
                //else
                //{
                //    customer.Paymentdays = Convert.ToInt32(dr["账期"].ToString());
                //}
                //if (dr["预付百分比"] == null || dr["预付百分比"].ToString() == "")
                //{

                //    customer.PercentageInAdvance = 1.00;
                //}
                //else
                //{
                //    customer.PercentageInAdvance = Convert.ToDouble(dr["预付百分比"]);
                //}
                customerss.Add(customer);
            }
            bool restult = CustomerInfoManager.BatchAddData(customerss, ref error);

            lbMsg.Text = restult == true ? "导入成功!" : error;
            if (restult)
            {
                Tool.WriteLog(Tool.LogType.Operating, "导入客户信息", "导入成功!");
                return;
            }
            else
            {
                Tool.WriteLog(Tool.LogType.Operating, "导入客户信息", "导入失败!原因" + error);
                return;
            }
        }