Exemple #1
0
        public ActionResult SummitCarWorkItemImport(string CityId, string CountyId, string projectId, int isRename = 1)
        {
            projectId = "dd1bbf6b-bcea-4cad-851b-1be4adf71860";

            string path     = @"C:\Users\zps\Desktop\聚力环境测评系统样版\聚力环境测评系统样版\";
            string fileName = "1班次作业明细.xls";



            #region 导出

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



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

                    for (int i = 0; i < datatable.Rows.Count; i++)
                    {
                        try
                        {
                            var workShift   = datatable.Rows[i]["作业班次"].ToString();
                            var xh          = datatable.Rows[i]["序号"].ToString();
                            var workTime    = datatable.Rows[i]["作业时间"].ToString();
                            var workName    = datatable.Rows[i]["作业点名称"].ToString();
                            var workAddress = datatable.Rows[i]["作业点地址"].ToString();
                            var workNode    = datatable.Rows[i]["备注"].ToString();



                            model = new ProfileSanitationCarWorkItemEntity()
                            {
                                Note        = workNode,
                                WorkName    = workName,
                                WorkAddress = workAddress,
                                WorkTime    = workTime,
                                WorkShift   = workShift,
                                Subscript   = int.Parse(xh)
                            };


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


            return(Success("ss"));
        }
        public ActionResult SummitImport(string CityId, string CountyId, string projectId, int isRename = 1)
        {
            projectId = "dd1bbf6b-bcea-4cad-851b-1be4adf71860";

            string path     = @"C:\Users\zps\Desktop\聚力环境测评系统样版\聚力环境测评系统样版\附件6、虹口市容点位\";
            string fileName = "Book1.xlsx";

            #region 导出

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


                    //ProfileAmenitiesConstructionSiteEntiy

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

                    for (int i = 0; i < datatable.Rows.Count; i++)
                    {
                        try
                        {
                            var jdName  = datatable.Rows[i]["街道"].ToString();
                            var fCode   = datatable.Rows[i]["序号"].ToString();
                            var address = datatable.Rows[i]["地址"].ToString();
                            var name    = datatable.Rows[i]["工地名称"].ToString();



                            var StreetNamekey = StreetApp.GetDictionary(d => d.StreetName == jdName)[0].Key;

                            var streetModel = StreetApp.GetForm(StreetNamekey);

                            model = new ProfileAmenitiesConstructionSiteEntity()
                            {
                                CityId    = streetModel.CityId,
                                CountyId  = streetModel.CountyId,
                                StreetId  = streetModel.F_Id,
                                Address   = address,
                                F_EnCode  = fCode,
                                SiteName  = name,
                                ProjectId = projectId
                            };

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


            return(Success("ss"));
        }
Exemple #3
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"));
        }