Beispiel #1
0
        public ActionResult SubmitForm(ProfileSanitationCarEntity entity, int carType, string keyValue, string workItem)
        {
            entity.CarType = carType;

            ProfileCarWorkItemContracts[] works = workItem.ToObject <ProfileCarWorkItemContracts[]>();

            App.SubmitForm(entity, keyValue, works);
            return(Success("操作成功!"));
        }
        public void SubmitForm(ProfileSanitationCarEntity entity, string keyValue)
        {
            if (!string.IsNullOrEmpty(keyValue))
            {
                entity.Modify(keyValue);

                service.Update(entity);
            }
            else
            {
                entity.Create();

                service.Insert(entity);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 提交,修改
        /// </summary>
        /// <param name="tandasEntity"></param>
        /// <param name="keyValue"></param>
        public void SubmitForm(ProfileSanitationCarEntity entity, string keyValue, ProfileCarWorkItemContracts[] works)
        {
            if (!string.IsNullOrEmpty(keyValue))
            {
                entity.Modify(keyValue);
            }
            else
            {
                entity.Create();
            }

            service.SubmitForm(entity, keyValue, works);

            try
            {
                LogMess.addLog(DbLogType.Update.ToString(), "修改成功", "新建环卫车辆信息【" + entity.CarId + "】成功!");
            }
            catch
            {
            }
        }
        /// <summary>
        /// 单条
        /// 批量导入车辆信息
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="skipWhere"></param>
        /// <param name="coverWhere"></param>
        public void BatchCarSubmitFrom(ProfileSanitationCarEntity entity, Func <ProfileSanitationCarEntity, ProfileSanitationCarEntity, bool> skipWhere, Func <ProfileSanitationCarEntity, ProfileSanitationCarEntity, bool> coverWhere)
        {
            if (skipWhere != null)
            {
                Func <ProfileSanitationCarEntity, bool> dbSkipWhere = db => skipWhere(db, entity);

                var dbSkipQuery = this.service.dbcontext.Set <ProfileSanitationCarEntity>().Where(dbSkipWhere);

                if (dbSkipQuery.Count() > 0)
                {
                    return;
                }
            }

            if (coverWhere != null)
            {
                Func <ProfileSanitationCarEntity, bool> dbCoverWhere = db => coverWhere(db, entity);

                var dbCoverQuery = this.service.dbcontext.Set <ProfileSanitationCarEntity>().Where(dbCoverWhere);

                if (dbCoverQuery.Count() > 0)
                {
                    var dbEntity = dbCoverQuery.FirstOrDefault();

                    dbEntity.CarId     = entity.CarId;
                    dbEntity.CarType   = entity.CarType;
                    dbEntity.CompanyId = entity.CompanyId;
                    dbEntity.F_EnCode  = entity.F_EnCode;
                    dbEntity.WorkShift = entity.WorkShift;

                    dbEntity.Modify(dbEntity.F_Id);
                    this.service.Update(dbEntity);

                    return;
                }
            }

            entity.Create();
            this.service.Insert(entity);
        }
Beispiel #5
0
        public ActionResult SummitCarImport(string CityId, string CountyId, string projectId, int isRename = 1)
        {
            projectId = "dd1bbf6b-bcea-4cad-851b-1be4adf71860";

            string path     = @"C:\Users\zps\Desktop\聚力环境测评系统样版\聚力环境测评系统样版\";
            string fileName = "1车辆信息(1).xlsx";


            ProfileOperationsCompanyApp companyApp = new ProfileOperationsCompanyApp();

            #region 导出

            if (FileHelper.IsExistFile(Path.Combine(path, fileName)))
            {
                using (ExcelHelper exHelp = new ExcelHelper(Path.Combine(path, fileName)))
                {
                    var datatable = exHelp.ExcelToDataTable(fileName, true);



                    ProfileSanitationCarEntity[] models = new ProfileSanitationCarEntity[datatable.Rows.Count];
                    ProfileSanitationCarEntity   model;

                    for (int i = 0; i < datatable.Rows.Count; i++)
                    {
                        try
                        {
                            var carTypeStr  = datatable.Rows[i]["车辆类型"].ToString();
                            var carId       = datatable.Rows[i]["车牌号"].ToString();
                            var f_EnCode    = datatable.Rows[i]["自编号"].ToString();
                            var companyName = datatable.Rows[i]["作业公司"].ToString();
                            var workShift   = datatable.Rows[i]["作业班次"].ToString();

                            int    carTypeInt = 0;
                            string companyId  = "";


                            if (carTypeStr == "机扫车")
                            {
                                carTypeInt = ProfileCarTypeEnum.MachineCleanCar.GetIntValue();
                            }
                            else if (carTypeStr == "冲洗车")
                            {
                                carTypeInt = ProfileCarTypeEnum.WashTheCar.GetIntValue();
                            }

                            companyId = companyApp.GetDictionary(d => d.CompanyName == companyName).FirstOrDefault().Key;

                            model = new ProfileSanitationCarEntity()
                            {
                                CarId     = carId,
                                CarType   = carTypeInt,
                                WorkShift = workShift,
                                CompanyId = companyId,
                                F_EnCode  = f_EnCode
                            };


                            models[i] = model;
                        }
                        catch
                        {
                        }
                    }
                    var thapp = new ProfileAmenitiesConstructionSiteApp();
                    foreach (var item in models)
                    {
                        try
                        {
                            if (item == null)
                            {
                                continue;
                            }
                            App.SubmitForm(item, string.Empty);
                        }
                        catch
                        {
                        }
                    }
                }
            }
            #endregion


            return(Success("ss"));
        }