Example #1
0
 protected void tbxFCustomer_OnTextChanged(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(tbxFCustomer.Text.Trim()))
     {
         LHCustomer custmoer = CustomerService.Where(p => p.FName == tbxFCustomer.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault();
         if (custmoer != null)
         {
             txtFCode.Text = custmoer.FCode;
         }
     }
 }
Example #2
0
        /// <summary>
        ///     提交添加
        /// </summary>
        private bool SubmintAdd()
        {
            try
            {
                var member = new LHCustomer();
                {
                };

                return(CustomerService.Add(member));
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Example #3
0
        /// <summary>
        ///     提交
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            //  提配错误行数
            var errorRow = -1;

            try
            {
                using (var ts = new TransactionScope())
                {
                    var data = ViewState["dtData"] as DataTable;
                    if (data == null)
                    {
                        return;
                    }

                    //var stringBuilder = new StringBuilder();

                    for (int i = 0; i < data.Rows.Count; i++)
                    {
                        errorRow = i + 1;

                        var item = new LHCustomer
                        {
                            FCode  = data.Rows[i]["客户代码"].ToString(),
                            FName  = data.Rows[i]["客户名称"].ToString(),
                            FSpell = ChineseSpell.MakeSpellCode(data.Rows[i]["客户名称"].ToString(), "",
                                                                SpellOptions.FirstLetterOnly).ToUpper(),
                            FPaymentMethod = data.Rows[i]["付款方式"].ToString(),
                            FLinkman       = data.Rows[i]["联系人"].ToString(),
                            FPhome         = data.Rows[i]["电话"].ToString(),
                            FMoile         = data.Rows[i]["手机"].ToString(),
                            FAddress       = data.Rows[i]["地址"].ToString(),
                            FDistric       = data.Rows[i]["区域"].ToString(),

                            FIsPrint     = Convert.ToInt32(data.Rows[i]["是否打印单价"]),
                            FTipsDay     = Convert.ToInt32(data.Rows[i]["提醒天数"]),
                            FFreight     = Convert.ToDecimal(data.Rows[i]["运输服务费"]),
                            FCredit      = Convert.ToDecimal(data.Rows[i]["信用额度"]),
                            FSalesman    = data.Rows[i]["业务员"].ToString(),
                            FMemo        = data.Rows[i]["摘要"].ToString(),
                            FGroupNo     = data.Rows[i]["客户代码"].ToString(),
                            FGroupNoFlag = "1",
                            FLevel       = 0,

                            //客户分类
                            FCateId    = "2077",
                            FSubCateId = "2077",

                            FDate      = DateTime.Now,
                            FIsAllot   = 0,
                            FIsInvoice = 0,
                            FCompanyId = CurrentUser.AccountComId,
                            FFlag      = 1
                        };

                        CustomerService.AddEntity(item);
                    }

                    //写入数据库
                    CustomerService.SaveChanges();

                    ts.Complete();

                    Alert.Show("引入完成。", MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                Alert.Show(string.Format(@"引入失败,请排查模版内容是否完善,出错定位行:{0} ", errorRow), MessageBoxIcon.Information);
            }
        }