Example #1
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, ZZT_400LogEntity entity)
 {
     try
     {
         service.SaveForm(keyValue, entity);
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #2
0
        /// <summary>
        /// 批量(新增)
        /// </summary>
        /// <param name="dtSource">实体对象</param>
        /// <returns></returns>
        public string BatchAdd400(DataTable dtSource)
        {
            IRepository db = new RepositoryFactory().BaseRepository().BeginTrans();

            try
            {
                for (int i = 0; i < dtSource.Rows.Count; i++)
                {
                    string mobile = dtSource.Rows[i][0].ToString();
                    if (!string.IsNullOrWhiteSpace(mobile))
                    {
                        string   CustNo        = "";
                        DateTime?NullTime      = null;
                        string   callInTimeStr = dtSource.Rows[i][5].ToString();
                        DateTime?callInTime    = string.IsNullOrEmpty(callInTimeStr) ? NullTime : DateTime.ParseExact(callInTimeStr, "yyyy/M/d H:m:s", System.Globalization.CultureInfo.CurrentCulture);


                        string callStateStr = dtSource.Rows[i][4].ToString();
                        int    callState    = 0;
                        if (callStateStr == "已接来电")
                        {
                            callState = 1;
                        }

                        var old_Data = db.FindEntity <ZZT_400CustomerEntity>(t => t.Mobile == mobile);
                        //是否此前拨打过
                        if (old_Data != null)
                        {
                            CustNo = old_Data.CustNo;
                            //修改当前数据的列来电时间,来电状态
                            old_Data.CallInTime = callInTime;
                            old_Data.CallState  = callState;
                            old_Data.Modify(old_Data.Id);
                            db.Update(old_Data);
                        }
                        else
                        {
                            //新建400客户表
                            CustNo = coderuleService.SetBillCode(OperatorProvider.Provider.Current().UserId, SystemInfo.CurrentModuleId, "", db);//获得指定模块或者编号的单据号
                            ZZT_400CustomerEntity entity = new ZZT_400CustomerEntity()
                            {
                                CustNo       = CustNo,
                                Mobile       = mobile,
                                Province     = dtSource.Rows[i][1].ToString(),
                                City         = dtSource.Rows[i][2].ToString(),
                                CallInNumber = dtSource.Rows[i][3].ToString(),
                                CallState    = callState,
                                CallInTime   = callInTime,
                            };
                            entity.Create();

                            db.Insert(entity);
                        }

                        //插入400日志
                        ZZT_400LogEntity logEntity = new ZZT_400LogEntity
                        {
                            CustNo       = CustNo,
                            Mobile       = mobile,
                            Province     = dtSource.Rows[i][1].ToString(),
                            City         = dtSource.Rows[i][2].ToString(),
                            CallInNumber = dtSource.Rows[i][3].ToString(),
                            CallState    = dtSource.Rows[i][4].ToString(),
                            CallInTime   = callInTime,
                        };
                        logEntity.Create();
                        db.Insert(logEntity);
                    }
                }
                db.Commit();
                return("导入成功");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
Example #3
0
 public ActionResult SaveForm(string keyValue, ZZT_400LogEntity entity)
 {
     zzt_400logbll.SaveForm(keyValue, entity);
     return(Success("操作成功。"));
 }