Ejemplo n.º 1
0
        private object GetProfileOperationsCompany()
        {
            ProfileOperationsCompanyApp cityApp = new ProfileOperationsCompanyApp();
            var data = cityApp.GetList();
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            foreach (ProfileOperationsCompanyEntity item in data)
            {
                var fieldItem = new
                {
                    encode   = item.F_Id,
                    fullname = item.CompanyName
                };
                dictionary.Add(item.F_Id, fieldItem);
            }
            return(dictionary);
        }
Ejemplo n.º 2
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"));
        }