Example #1
0
        /// <summary>
        /// Set Grid Data source
        /// </summary>
        /// <param name="addRow"></param>
        /// <param name="deleteRow"></param>e
        private void BindGrid()
        {
            DistrictBLL DistrictBLLobj = new DistrictBLL();

            grdDistrict.DataSource = DistrictBLLobj.GetAllDistricts();
            grdDistrict.DataBind();
        }
        public ActionResult GetDistricts(string countryId, string regionId, string provinceId)
        {
            DistrictBLL districtBLL             = new DistrictBLL(WebApp.Connector);
            IEnumerable <DistrictDTO> districts = districtBLL.ReadByCountryAndRegionAndProvince(countryId, regionId, provinceId);

            return(Json(districts));
        }
        private void AddEditProperty_BasePost(Connector connector, PropertyDTO property)
        {
            RegionBLL   regionBLL   = new RegionBLL(connector);
            ProvinceBLL provinceBLL = new ProvinceBLL(connector);
            DistrictBLL districtBLL = new DistrictBLL(connector);
            CountryDTO  country     = property.Country;
            RegionDTO   region      = property.Region;
            ProvinceDTO province    = property.Province;
            DistrictDTO district    = property.District;

            if (country != null)
            {
                country.Regions = regionBLL.ReadByCountry(country.Id);
                if (region != null)
                {
                    region.Country = country;
                }
                if (province != null)
                {
                    province.Country = country;
                }
                if (district != null)
                {
                    district.Country = country;
                }
            }
            if (region != null)
            {
                region.Provinces = provinceBLL.ReadByCountryAndRegion(country.Id, region.Code);
            }
            if (province != null)
            {
                province.Districts = districtBLL.ReadByCountryAndRegionAndProvince(country.Id, region.Code, province.Code);
            }
        }
Example #4
0
    public bool BLLIsExistDistrictName(DistrictBLL bt)
    {
        bool flag = false;

        flag = districtBLLObj.DALIsExistDistrictName(bt);
        return(flag);
    }
Example #5
0
        /// <summary>
        /// Update Database Make data as Obsoluted
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void IsObsolete_CheckedChanged(Object sender, EventArgs e)
        {
            string message = string.Empty;

            try
            {
                CheckBox    chk = (CheckBox)sender;
                GridViewRow gr  = (GridViewRow)chk.Parent.Parent;

                string DISTRICTID = ((Literal)gr.FindControl("litDISTRICTID")).Text;

                DistrictBLL DistrictBLLobj = new DistrictBLL();
                message = DistrictBLLobj.ObsoleteDistrict(Convert.ToInt32(DISTRICTID), Convert.ToString(chk.Checked), Convert.ToInt32(Session["USER_ID"]));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                }
                ClearData();
                BindGrid();
                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Obsoleted", "alert('" + message + "');", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// 作业实时分布统计表
        /// </summary>
        /// <returns></returns>
        public ActionResult GetWorkRealTimeTableJson()
        {
            DistrictBLL                  districtbll = new DistrictBLL();
            List <DistrictEntity>        AreaList    = districtbll.GetListByOrgIdAndParentId("", "0");
            List <SafeworkcontrolEntity> WorkList    = safeworkcontrolbll.GetNowWork();
            List <KbssEntity>            klist       = new List <KbssEntity>();
            int Znum = 0;

            foreach (var item in AreaList)
            {
                KbssEntity kbs = new KbssEntity();
                kbs.Name         = item.DistrictName;
                kbs.Num          = WorkList.Where(a => a.Taskregioncode.Contains(item.DistrictCode)).Count();
                kbs.DistrictCode = item.DistrictCode;
                Znum            += kbs.Num;
                kbs.OnNum        = WorkList.Where(a => a.Taskregioncode.Contains(item.DistrictCode)).Count();
                klist.Add(kbs);
            }
            for (int j = 0; j < klist.Count; j++)
            {
                double Proportion = 0;
                if (Znum != 0)
                {
                    Proportion = (double)klist[j].Num / Znum;
                    Proportion = Proportion * 100;
                }
                klist[j].OnNum        = Znum;
                klist[j].OnProportion = Proportion.ToString("0") + "%";
            }
            return(Content(klist.ToJson()));
        }
Example #7
0
        /// <summary>
        /// Set edit mode for edit comand
        /// Delete data from the database for delete comand
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grdDistrict_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string message = string.Empty;

            if (e.CommandName == "EditRow")
            {
                ShowHideSections(true, false);
                ViewState["District_ID"] = e.CommandArgument;
                DistrictBLL objDistrictBLL = new DistrictBLL();
                DistrictBO  objDistrict    = objDistrictBLL.GetDistrictById(Convert.ToInt32(ViewState["District_ID"]));

                txtDistrict.Text = objDistrict.DistrictName;
                btnSave.Text     = "Update";
                btnClear.Text    = "Cancel";
            }
            else if (e.CommandName == "DeleteRow")
            {
                // ViewState["CDAPBUDGETID"] = e.CommandArgument;
                DistrictBLL DistrictBLLobj = new DistrictBLL();
                message = DistrictBLLobj.DeleteDistrict(Convert.ToInt32(e.CommandArgument));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data deleted successfully";
                }
                SetUpdateMode(false);
                BindGrid();
                ClearData();
            }
            if (message != "")
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
            }
        }
Example #8
0
        public ActionResult GetLableStatistics()
        {
            var                   data        = basebll.GetPageList("");
            DistrictBLL           districtbll = new DistrictBLL();
            List <DistrictEntity> AreaList    = districtbll.GetListByOrgIdAndParentId("", "0");
            List <KbsEntity>      klist       = new List <KbsEntity>();
            int                   Znum        = 0;

            foreach (var item in AreaList)
            {
                KbsEntity kbs = new KbsEntity();
                kbs.Name = item.DistrictName;
                kbs.Num  = data.Where(a => a.AreaCode.Contains(item.DistrictCode)).Count();
                Znum    += kbs.Num;
                kbs.Num2 = kbs.Num;
                klist.Add(kbs);
            }
            for (int j = 0; j < klist.Count; j++)
            {
                double Proportion = 0;
                if (Znum != 0)
                {
                    Proportion = (double)klist[j].Num / Znum;
                    Proportion = Proportion * 100;
                }
                klist[j].Proportion = Proportion.ToString("0") + "%";
            }

            return(Content(klist.ToJson()));
        }
Example #9
0
        /// <summary>
        /// Set Grid Data source
        /// </summary>
        /// <param name="addRow"></param>
        /// <param name="deleteRow"></param>e
        private void SearchBind()
        {
            string      districtName   = txtSearchDistrictName.Text.Trim();
            DistrictBLL objDistrictBLL = new DistrictBLL();

            grdDistrict.DataSource = objDistrictBLL.SearchDistrict(districtName);
            grdDistrict.DataBind();
        }
Example #10
0
        /// <summary>
        /// To display details on click of button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            string      districtName   = txtSearchDistrictName.Text.Trim();
            DistrictBLL objDistrictBLL = new DistrictBLL();

            grdDistrict.DataSource = objDistrictBLL.SearchDistrict(districtName);
            grdDistrict.DataBind();
        }
Example #11
0
        private void GetProviceList(HttpContext context)
        {
            var list   = new DistrictBLL().GetProvinceList();
            var result = new ApiResultDto {
                code = 0, data = list
            };

            context.Response.Write(new Tools.Serialize().SerializeJson(result));
            return;
        }
Example #12
0
        public string ImportEquipment()
        {
            int    error        = 0;
            int    sussceed     = 0;
            string message      = "请选择格式正确的文件再导入!";
            string falseMessage = "";
            int    count        = HttpContext.Request.Files.Count;

            if (count > 0)
            {
                HttpPostedFileBase file = HttpContext.Request.Files[0];
                if (string.IsNullOrEmpty(file.FileName))
                {
                    return(message);
                }
                if (!(file.FileName.Substring(file.FileName.IndexOf('.')).Contains("xls") || file.FileName.Substring(file.FileName.IndexOf('.')).Contains("xlsx")))
                {
                    return(message);
                }
                string fileName = DateTime.Now.ToString("yyyyMMddHHmmss") + System.IO.Path.GetExtension(file.FileName);
                string filePath = Server.MapPath("~/Resource/temp/" + fileName);
                file.SaveAs(filePath);
                DataTable dt           = ExcelHelper.ExcelImport(filePath);
                var       districtList = new DistrictBLL().GetList().Where(x => x.OrganizeId == ERCHTMS.Code.OperatorProvider.Provider.Current().OrganizeId).ToList();
                var       deptList     = new DepartmentBLL().GetList().Where(x => x.OrganizeId == ERCHTMS.Code.OperatorProvider.Provider.Current().OrganizeId).ToList();
                var       eno          = int.Parse(equipmentbll.GetEquipmentNo("P1-", ERCHTMS.Code.OperatorProvider.Provider.Current().OrganizeCode)) + 1;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    object[] vals = dt.Rows[i].ItemArray;
                    if (IsEndRow(vals) == true)
                    {
                        break;
                    }
                    var msg = "";
                    if (Validate(i, vals, deptList, districtList, out msg) == true)
                    {
                        var entity = GenEntity(vals, deptList, districtList, "P1-" + eno.ToString().PadLeft(4, '0'));
                        equipmentbll.SaveForm("", entity);
                        eno++;
                        sussceed++;
                    }
                    else
                    {
                        falseMessage += "第" + (i + 1) + "行" + msg + "</br>";
                        error++;
                    }
                }
                count    = dt.Rows.Count;
                message  = "共有" + count + "条记录,成功导入" + sussceed + "条,失败" + error + "条";
                message += "</br>" + falseMessage;
                //删除临时文件
                System.IO.File.Delete(filePath);
            }
            return(message);
        }
Example #13
0
        private void GetDistrictList(HttpContext context)
        {
            int parentId = EMT.Tools.Common.StrToInt(HttpContext.Current.Request["pid"], 1);
            var list     = new DistrictBLL().GetDistrictList(parentId);
            var result   = new ApiResultDto {
                code = 0, data = list
            };

            context.Response.Write(new Tools.Serialize().SerializeJson(result));
            return;
        }
Example #14
0
        public string GetAreas(string OrgId = "")
        {
            DistrictBLL   districtBLL = new DistrictBLL();
            var           data        = districtBLL.GetList(OrgId);
            StringBuilder sb          = new StringBuilder();

            foreach (DistrictEntity dist in data)
            {
                sb.AppendFormat("<option value='{0}'>{1}</option>", dist.DistrictID, dist.DistrictName);
            }
            return(sb.ToString());
        }
        public ActionResult SaveForm(string ID, string DistrictId, string PostList, string ModelIds)
        {
            DistrictBLL        disbll = new DistrictBLL();
            var                dis    = disbll.GetEntity(DistrictId);
            ArealocationEntity Area   = new ArealocationEntity();

            Area.AreaCode     = dis.DistrictCode;
            Area.AreaId       = DistrictId;
            Area.AreaName     = dis.DistrictName;
            Area.AreaParentId = dis.ParentID;
            if (ID == "")
            {
                Area.Create();
            }
            else
            {
                Area.Modify(ID);
            }
            Area.AreaParentId = dis.ParentID;
            Area.PointList    = PostList;
            Area.ModelIds     = ModelIds;
            arealocationbll.SaveForm(ID, Area);

            KbsAreaLocation ka = new KbsAreaLocation();

            ka.DistrictCode = Area.AreaCode;
            ka.DistrictID   = Area.AreaId;
            ka.DistrictName = Area.AreaName;
            ka.ID           = Area.ID;
            ka.ModelIds     = Area.ModelIds;
            ka.OrganizeId   = dis.OrganizeId;
            ka.ParentID     = Area.AreaParentId;
            ka.PointList    = Area.PointList;
            ka.SortCode     = dis.SortCode;
            SendData sd = new SendData();

            if (ID == "")
            {
                sd.DataName = "AddArea";
            }
            else
            {
                sd.DataName = "UpdateArea";
            }
            sd.EntityString = JsonConvert.SerializeObject(ka);

            //将新绑定的标签信息同步到后台计算服务中
            RabbitMQHelper rh = RabbitMQHelper.CreateInstance();

            rh.SendMessage(JsonConvert.SerializeObject(sd));
            return(Success("操作成功。"));
        }
Example #16
0
        /// <summary>
        /// to get district names
        /// </summary>
        /// <returns></returns>
        private void GetDistrictName()
        {
            DistrictBLL BLLobj = new DistrictBLL();

            ddlDistrictName.DataSource     = BLLobj.GetDistrict();
            ddlDistrictName.DataTextField  = "DISTRICTNAME";
            ddlDistrictName.DataValueField = "DISTRICTID";
            ddlDistrictName.DataBind();

            //DDLSearchDistrictName.DataSource = BLLobj.GetDistrict();
            //DDLSearchDistrictName.DataTextField = "DISTRICTNAME";
            //DDLSearchDistrictName.DataValueField = "DISTRICTID";
            //DDLSearchDistrictName.DataBind();
        }
Example #17
0
        //protected void ChangePage(object sender, GridViewPageEventArgs e)
        //{
        //    grdDistrict.PageIndex = e.NewPageIndex;
        //    BindGrid();
        //}
        /// <summary>
        /// to get details to textbox
        /// </summary>
        /// <returns></returns>
        private void GetDistrictById()
        {
            DistrictBLL DistrictBLLobj = new DistrictBLL();

            DistrictBO DistrictBOobj = DistrictBLLobj.GetDistrictById(Convert.ToInt32(ViewState["DISTRICTID"]));

            if (DistrictBOobj != null)
            {
                txtDistrict.Text = DistrictBOobj.DistrictName;
            }

            DistrictBOobj  = null;
            DistrictBLLobj = null;
        }
Example #18
0
        public ActionResult SignupStep3(PartnerCompanyInfoDTO companyInfo)
        {
            Connector   connector   = WebApp.Connector;
            RegionBLL   regionBLL   = new RegionBLL(connector);
            ProvinceBLL provinceBLL = new ProvinceBLL(connector);
            DistrictBLL districtBLL = new DistrictBLL(connector);
            CountryDTO  country     = companyInfo.Country;
            RegionDTO   region      = companyInfo.Region;
            ProvinceDTO province    = companyInfo.Province;
            DistrictDTO district    = companyInfo.District;

            if (country != null)
            {
                country.Regions = regionBLL.ReadByCountry(country.Id);
                if (region != null)
                {
                    region.Country = country;
                }
                if (province != null)
                {
                    province.Country = country;
                }
                if (district != null)
                {
                    district.Country = country;
                }
            }
            if (region != null)
            {
                region.Provinces = provinceBLL.ReadByCountryAndRegion(country.Id, region.Code);
            }
            if (province != null)
            {
                province.Districts = districtBLL.ReadByCountryAndRegionAndProvince(country.Id, region.Code, province.Code);
            }
            if (ModelState.IsValid)
            {
                Session["Signup$CompanyInfo"] = companyInfo;
                return(RedirectToAction("SignupStep4"));
            }
            else
            {
                CountryBLL countryBLL = new CountryBLL(WebApp.Connector);
                ViewBag.Countries = countryBLL.ReadAll();
                return(BadRequestWithErrors(companyInfo));
            }
        }
Example #19
0
    public bool BLLIsExistDistrict(DistrictBLL dt)
    {
        bool flag = false;
        int  i;

        flag = districtBLLObj.DALIsExistDistrict(dt);

        if (flag == false)
        {
            i = districtBLLObj.DALDistrictUpdate(dt);
            if (i == 0)
            {
                flag = true;
            }
        }
        return(flag);
    }
Example #20
0
 public string GetAreasOptionsStringByAreaId(string areaId)
 {
     if (string.IsNullOrEmpty(areaId))
     {
         return(GetAreasOptionsString());
     }
     else
     {
         DistrictBLL   districtBLL = new DistrictBLL();
         var           data        = districtBLL.GetNameAndID(areaId);
         StringBuilder sb          = new StringBuilder();
         foreach (DataRow dr in data.Rows)
         {
             sb.AppendFormat("<option value='{0}'>{1}</option>", dr["DistrictID"].ToString(), dr["DistrictName"].ToString());
         }
         return(sb.ToString());
     }
 }
Example #21
0
        /// <summary>
        /// To update details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UpdateBudgetItem()
        {
            DistrictBLL DistrictBLLobj = new DistrictBLL();
            DistrictBO  DistrictBOobj  = new DistrictBO();
            string      message        = "";

            try
            {
                if (ViewState["District_ID"] != null)
                {
                    DistrictBOobj.DistrictID = Convert.ToInt32(ViewState["District_ID"].ToString());
                }

                string uID = string.Empty;
                uID = Session["USER_ID"].ToString();

                DistrictBOobj.DistrictName = txtDistrict.Text.Trim();
                DistrictBOobj.UpdatedBy    = Convert.ToInt32(uID);

                message = DistrictBLLobj.UpdateDistrict(DistrictBOobj);

                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                }

                ClearData();
                SetUpdateMode(false);
                BindGrid();

                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Updated", "alert('" + message + "');", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                DistrictBLLobj = null;
            }
        }
Example #22
0
        public string GetLableChart()
        {
            List <object[]>       list        = new List <object[]>();
            var                   data        = basebll.GetPageList("");
            DistrictBLL           districtbll = new DistrictBLL();
            List <DistrictEntity> AreaList    = districtbll.GetListByOrgIdAndParentId("", "0");
            List <KbsEntity>      klist       = new List <KbsEntity>();

            foreach (var item in AreaList)
            {
                int num = 0;
                num = data.Where(it => it.AreaCode.Contains(item.DistrictCode)).Count();
                object[] arr = { item.DistrictName, num };
                if (num > 0)
                {
                    list.Add(arr);
                }
            }
            return(Newtonsoft.Json.JsonConvert.SerializeObject(list));
        }
Example #23
0
        /// <summary>
        /// To save details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SaveBudgetItem()
        {
            DistrictBLL DistrictBLLobj = new DistrictBLL();
            DistrictBO  DistrictBOobj  = new DistrictBO();

            string message = "";


            string uID = string.Empty;

            uID = Session["USER_ID"].ToString();

            DistrictBOobj.DistrictName = txtDistrict.Text.Trim();
            DistrictBOobj.CreatedBy    = Convert.ToInt32(uID);

            try
            {
                message = DistrictBLLobj.AddDistrict(DistrictBOobj);

                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data saved successfully";
                }

                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }

                ClearData();
                BindGrid();
            }
            catch (Exception ee)
            {
                throw ee;
            }
            finally
            {
                DistrictBLLobj = null;
            }
        }
Example #24
0
        public ActionResult GetCameraStatistics()
        {
            var                   data        = kbscameramanagebll.GetPageList("").Where(a => a.CameraTypeId == 0);
            DistrictBLL           districtbll = new DistrictBLL();
            List <DistrictEntity> AreaList    = districtbll.GetListByOrgIdAndParentId("", "0");
            List <KbssEntity>     klist       = new List <KbssEntity>();
            int                   Znum        = 0;

            foreach (var item in AreaList)
            {
                KbssEntity kbs = new KbssEntity();
                kbs.Name         = item.DistrictName;
                kbs.Num          = data.Where(a => a.AreaCode.Contains(item.DistrictCode)).Count();
                kbs.DistrictCode = item.DistrictCode;
                Znum            += kbs.Num;
                kbs.OnNum        = data.Where(a => a.AreaCode.Contains(item.DistrictCode) && a.State == "在线").Count();
                kbs.OffNum       = data.Where(a => a.AreaCode.Contains(item.DistrictCode) && a.State == "离线").Count();
                klist.Add(kbs);
            }

            for (int j = 0; j < klist.Count; j++)
            {
                double Proportion    = 0;
                double offProportion = 0;
                double OnProportion  = 0;
                if (Znum != 0)
                {
                    Proportion    = (double)klist[j].Num / Znum;
                    offProportion = (double)klist[j].OffNum / Znum;
                    OnProportion  = (double)klist[j].OnNum / Znum;
                    Proportion    = Proportion * 100;
                    offProportion = offProportion * 100;
                    OnProportion  = OnProportion * 100;
                }
                klist[j].Count             = Znum;
                klist[j].OnProportion      = OnProportion.ToString("0") + "%";
                klist[j].OfflineProportion = offProportion.ToString("0") + "%";
                klist[j].Proportion        = Proportion.ToString("0") + "%";
            }
            return(Content(klist.ToJson()));
        }
        public string ImportObj(string objname, string objid, string objtype, string qyid, string qyname)
        {
            int    error        = 0;
            string message      = "请选择格式正确的文件再导入!";
            string falseMessage = "";
            int    count        = HttpContext.Request.Files.Count;

            if (count > 0)
            {
                HttpPostedFileBase file = HttpContext.Request.Files[0];
                if (string.IsNullOrEmpty(file.FileName))
                {
                    return(message);
                }
                if (!(file.FileName.Substring(file.FileName.IndexOf('.')).Contains("xls") || file.FileName.Substring(file.FileName.IndexOf('.')).Contains("xlsx")))
                {
                    return(message);
                }
                objtype = string.IsNullOrEmpty(objtype) ? "3" : objtype;
                string fileName = DateTime.Now.ToString("yyyyMMddHHmmss") + System.IO.Path.GetExtension(file.FileName);
                file.SaveAs(Server.MapPath("~/Resource/temp/" + fileName));
                DataTable   dt          = ExcelHelper.ExcelImport(Server.MapPath("~/Resource/temp/" + fileName));
                int         success     = 0;
                DistrictBLL districtbll = new DistrictBLL();
                //先获取区域
                IEnumerable <DistrictEntity> AreaList = districtbll.GetOrgList(OperatorProvider.Provider.Current().OrganizeId);
                List <SaftyCheckModel>       sclist   = new List <SaftyCheckModel>();
                for (int i = 1; i < dt.Rows.Count; i++)
                {
                    string checkObj = dt.Rows[i][0].ToString(); //检查对象
                    string content  = dt.Rows[i][1].ToString(); //检查内容
                    // string desc = dt.Rows[i][2].ToString();//隐患描述
                    if (!string.IsNullOrEmpty(objname))         //选择了检查对象的情况下区域用对象中的数据
                    {
                        if (!string.IsNullOrEmpty(content))
                        {
                            string[] arrContent = content.TrimEnd('$').Split('$');

                            foreach (string str in arrContent)
                            {
                                if (!string.IsNullOrWhiteSpace(str))
                                {
                                    SaftyCheckModel sc = new SaftyCheckModel();
                                    sc.CheckObject     = objname;
                                    sc.CheckObjectId   = objid;
                                    sc.CheckObjectType = objtype;
                                    sc.CheckContent    = str;
                                    sc.RiskName        = "";
                                    if (AreaList.Where(it => it.DistrictID == qyid).FirstOrDefault() != null)
                                    {
                                        sc.BelongDistrictCode = AreaList.Where(it => it.DistrictID == qyid).FirstOrDefault().DistrictCode;
                                    }
                                    //else
                                    //{
                                    //    falseMessage += "</br>" + "检查对象区域值不在可选范围内,未能导入.";
                                    //    error++;
                                    //    continue;
                                    //}
                                    sc.BelongDistrictID = qyid;
                                    sc.BelongDistrict   = qyname;
                                    sclist.Add(sc);
                                    success++;
                                }
                            }
                        }
                    }
                    else//选择对象情况下用对象的区域  没有对象的情况下 才用导入文档中区域
                    {
                        if (!string.IsNullOrEmpty(content))
                        {
                            string[] arrContent = content.TrimEnd('$').Split('$');
                            objid = Guid.NewGuid().ToString();
                            int j = 0;
                            foreach (string str in arrContent)
                            {
                                if (!string.IsNullOrWhiteSpace(str))
                                {
                                    SaftyCheckModel sc = new SaftyCheckModel();
                                    sc.CheckObject     = checkObj;
                                    sc.CheckObjectId   = objid;
                                    sc.CheckObjectType = "";
                                    sc.CheckContent    = str;
                                    sc.RiskName        = "";
                                    sclist.Add(sc);
                                    success++;
                                }
                            }
                        }
                    }
                }

                //将导入成功的数据存入缓存中
                CacheHelper.SetChache(sclist, "SaftyCheck");
                count    = dt.Rows.Count - 1;
                message  = "共有" + success + "条记录,成功导入" + (success - error) + "条,失败" + error + "条";
                message += "</br>" + falseMessage;
            }

            return(message);
        }
 public DistrictController(DistrictBLL bll)
 {
     _bll = bll;
 }
Example #27
0
        //[AjaxOnly]
        //[HandlerAuthorize(PermissionMode.Ignore)]
        // [ValidateAntiForgeryToken]
        public string ImportGenericFirefighting()
        {
            if (OperatorProvider.Provider.Current().IsSystem)
            {
                return("超级管理员无此操作权限");
            }
            string orgId        = OperatorProvider.Provider.Current().OrganizeId;//所属公司
            int    error        = 0;
            string message      = "请选择格式正确的文件再导入!";
            string falseMessage = "";
            int    count        = HttpContext.Request.Files.Count;

            if (count > 0)
            {
                HttpPostedFileBase file = HttpContext.Request.Files[0];
                if (string.IsNullOrEmpty(file.FileName))
                {
                    return(message);
                }
                if (!(file.FileName.Substring(file.FileName.IndexOf('.')).Contains("xls") || file.FileName.Substring(file.FileName.IndexOf('.')).Contains("xlsx")))
                {
                    return(message);
                }
                string fileName = DateTime.Now.ToString("yyyyMMddHHmmss") + System.IO.Path.GetExtension(file.FileName);
                file.SaveAs(Server.MapPath("~/Resource/temp/" + fileName));
                DataTable dt    = ExcelHelper.ExcelImport(Server.MapPath("~/Resource/temp/" + fileName));
                int       order = 1;
                string    orgid = OperatorProvider.Provider.Current().OrganizeId;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    KeyPartEntity item = new KeyPartEntity();
                    order = i + 1;
                    #region 重点防火部位名称
                    string partname = dt.Rows[i][0].ToString();
                    if (!string.IsNullOrEmpty(partname))
                    {
                        item.PartName = partname;
                        item.PartNo   = partname;
                        //var data = new DataItemCache().ToItemValue("PartName", partname);
                        //if (data != null && !string.IsNullOrEmpty(data))
                        //    item.PartNo = data;
                        //else
                        //{
                        //    falseMessage += string.Format(@"第{0}行导入失败,重点防火部位名称不存在!</br>", order);
                        //    error++;
                        //    continue;
                        //}
                    }
                    else
                    {
                        falseMessage += string.Format(@"第{0}行导入失败,重点防火部位名称不能为空!</br>", order);
                        error++;
                        continue;
                    }
                    #endregion

                    #region 所在位置
                    string district = dt.Rows[i][1].ToString();
                    if (!string.IsNullOrEmpty(district))
                    {
                        var disItem = new DistrictBLL().GetListForCon(x => x.DistrictName == district && x.OrganizeId == orgid).FirstOrDefault();
                        if (disItem != null)
                        {
                            item.DistrictId   = disItem.DistrictID;
                            item.DistrictCode = disItem.DistrictCode;
                            item.District     = district;
                        }
                        else
                        {
                            falseMessage += string.Format(@"第{0}行导入失败,所在位置不存在!</br>", order);
                            error++;
                            continue;
                        }
                    }
                    else
                    {
                        falseMessage += string.Format(@"第{0}行导入失败,所在位置不能为空!</br>", order);
                        error++;
                        continue;
                    }
                    #endregion

                    #region 责任部门
                    string dutydept = dt.Rows[i][2].ToString();
                    if (!string.IsNullOrEmpty(dutydept))
                    {
                        var data = departBLL.GetList().FirstOrDefault(e => e.FullName == dutydept && e.OrganizeId == orgid);
                        if (data != null)
                        {
                            item.DutyDept     = dutydept;
                            item.DutyDeptCode = data.EnCode;
                        }

                        else
                        {
                            falseMessage += string.Format(@"第{0}行导入失败,责任部门不存在!</br>", order);
                            error++;
                            continue;
                        }
                    }
                    else
                    {
                        falseMessage += string.Format(@"第{0}行导入失败,责任部门不能为空!</br>", order);
                        error++;
                        continue;
                    }
                    #endregion

                    #region 责任人
                    string dutyUser = dt.Rows[i][3].ToString();
                    if (!string.IsNullOrEmpty(dutyUser))
                    {
                        var userEntity = userBLL.GetListForCon(x => x.RealName == dutyUser && x.OrganizeId == orgid).FirstOrDefault();
                        if (userEntity != null)
                        {
                            item.DutyUserId = userEntity.UserId;
                            item.DutyUser   = dutyUser;
                        }
                        else
                        {
                            falseMessage += string.Format(@"第{0}行导入失败,责任人不存在!</br>", order);
                            error++;
                            continue;
                        }
                    }
                    else
                    {
                        falseMessage += string.Format(@"第{0}行导入失败,责任人不能为空!</br>", order);
                        error++;
                        continue;
                    }
                    #endregion

                    #region 责任人电话
                    string dutyTel = dt.Rows[i][4].ToString();
                    if (!string.IsNullOrEmpty(dutyTel))
                    {
                        item.DutyTel = dutyTel;
                    }
                    #endregion

                    #region 建筑结构
                    string structure = dt.Rows[i][5].ToString();
                    if (!string.IsNullOrEmpty(structure))
                    {
                        item.Structure = structure;
                        var data = new DataItemCache().ToItemValue("Structure", structure);
                        if (data != null && !string.IsNullOrEmpty(data))
                        {
                            item.Structure = data;
                        }
                        else
                        {
                            falseMessage += string.Format(@"第{0}行导入失败,建筑结构不存在!</br>", order);
                            error++;
                            continue;
                        }
                    }
                    //else
                    //{
                    //    falseMessage += string.Format(@"第{0}行导入失败,建筑结构不能为空!</br>", order);
                    //    error++;
                    //    continue;
                    //}
                    #endregion

                    #region 建筑面积(m2)
                    string acreage = dt.Rows[i][6].ToString();
                    int    tempAcreage;
                    if (!string.IsNullOrEmpty(acreage))
                    {
                        if (int.TryParse(acreage, out tempAcreage))
                        {
                            item.Acreage = tempAcreage;
                        }
                        else
                        {
                            falseMessage += string.Format(@"第{0}行导入失败,建筑面积(m2)必须为数字!</br>", order);
                            error++;
                            continue;
                        }
                    }
                    //else
                    //{
                    //    falseMessage += string.Format(@"第{0}行导入失败,建筑面积(m2)不能为空!</br>", order);
                    //    error++;
                    //    continue;
                    //}
                    #endregion

                    #region 主要存储物品
                    string storegoods = dt.Rows[i][7].ToString();
                    if (!string.IsNullOrEmpty(storegoods))
                    {
                        item.StoreGoods = storegoods;
                    }
                    #endregion

                    #region 主要灭火器装备
                    string outfireequip = dt.Rows[i][8].ToString();
                    if (!string.IsNullOrEmpty(outfireequip))
                    {
                        item.OutfireEquip = outfireequip;
                    }
                    else
                    {
                        falseMessage += string.Format(@"第{0}行导入失败,主要灭火器装备不能为空!</br>", order);
                        error++;
                        continue;
                    }
                    #endregion

                    #region 重点防火部位人数
                    string peoplenum = dt.Rows[i][9].ToString();
                    int    tempPeopleNum;
                    if (!string.IsNullOrEmpty(peoplenum))
                    {
                        if (int.TryParse(peoplenum, out tempPeopleNum))
                        {
                            item.PeopleNum = tempPeopleNum;
                        }
                        else
                        {
                            falseMessage += string.Format(@"第{0}行导入失败,重点防火部位人数必须为数字!</br>", order);
                            error++;
                            continue;
                        }
                    }
                    #endregion

                    #region 动火级别
                    string rank = dt.Rows[i][10].ToString();
                    if (!string.IsNullOrEmpty(rank))
                    {
                        if (rank == "一级动火区域")
                        {
                            item.Rank = 1;
                        }
                        else if (rank == "二级动火区域")
                        {
                            item.Rank = 2;
                        }
                        else
                        {
                            falseMessage += string.Format(@"第{0}行导入失败,动火级别不存在!</br>", order);
                            error++;
                            continue;
                        }
                    }
                    else
                    {
                        falseMessage += string.Format(@"第{0}行导入失败,动火级别不能为空!</br>", order);
                        error++;
                        continue;
                    }
                    #endregion

                    #region 最近巡查日期(年月日)
                    string   latelypatroldate = dt.Rows[i][11].ToString();
                    DateTime tempLatelyPatrolDate;
                    if (!string.IsNullOrEmpty(latelypatroldate))
                    {
                        if (DateTime.TryParse(latelypatroldate, out tempLatelyPatrolDate))
                        {
                            item.LatelyPatrolDate = tempLatelyPatrolDate;
                        }
                        else
                        {
                            falseMessage += string.Format(@"第{0}行导入失败,最近巡查日期不对!</br>", order);
                            error++;
                            continue;
                        }
                    }
                    #endregion

                    #region 巡查周期(天)
                    string patrolperiod = dt.Rows[i][12].ToString();
                    int    tempPatrolPeriod;
                    if (!string.IsNullOrEmpty(patrolperiod))
                    {
                        if (int.TryParse(patrolperiod, out tempPatrolPeriod))
                        {
                            item.PatrolPeriod = tempPatrolPeriod;
                        }
                        else
                        {
                            falseMessage += string.Format(@"第{0}行导入失败,巡查周期(天)必须为数字!</br>", order);
                            error++;
                            continue;
                        }
                    }
                    #endregion

                    #region  次巡查日期
                    string   nextpatroldate = dt.Rows[i][13].ToString();
                    DateTime tempNextPatrolDate;
                    if (!string.IsNullOrEmpty(nextpatroldate))
                    {
                        if (DateTime.TryParse(nextpatroldate, out tempNextPatrolDate))
                        {
                            item.NextPatrolDate = tempNextPatrolDate;
                        }
                        else
                        {
                            falseMessage += string.Format(@"第{0}行导入失败,下次巡查日期不对!</br>", order);
                            error++;
                            continue;
                        }
                    }
                    else
                    {
                        falseMessage += string.Format(@"第{0}行导入失败,下次巡查日期不能为空!</br>", order);
                        error++;
                        continue;
                    }
                    #endregion

                    #region 使用状态
                    string employstate = dt.Rows[i][14].ToString();
                    if (!string.IsNullOrEmpty(employstate))
                    {
                        if (employstate == "在用")
                        {
                            item.EmployState = 0;
                        }
                        else if (employstate == "停用")
                        {
                            item.EmployState = 1;
                        }
                        else if (employstate == "其他")
                        {
                            item.EmployState = 2;
                        }
                        else
                        {
                            falseMessage += string.Format(@"第{0}行导入失败,使用状态不存在!</br>", order);
                            error++;
                            continue;
                        }
                    }
                    else
                    {
                        falseMessage += string.Format(@"第{0}行导入失败,使用状态不能为空!</br>", order);
                        error++;
                        continue;
                    }
                    #endregion

                    #region 火灾危险性分析
                    string analyze = dt.Rows[i][15].ToString();
                    if (!string.IsNullOrEmpty(analyze))
                    {
                        item.Analyze = analyze;
                    }
                    else
                    {
                        falseMessage += string.Format(@"第{0}行导入失败,火灾危险性分析不能为空!</br>", order);
                        error++;
                        continue;
                    }
                    #endregion

                    #region 防火措施
                    string measure = dt.Rows[i][16].ToString();
                    if (!string.IsNullOrEmpty(measure))
                    {
                        item.Measure = measure;
                    }
                    else
                    {
                        falseMessage += string.Format(@"第{0}行导入失败,防火措施不能为空!</br>", order);
                        error++;
                        continue;
                    }
                    #endregion
                    //管理要求
                    string require = dt.Rows[i][17].ToString();
                    if (!string.IsNullOrEmpty(require))
                    {
                        item.Require = require;
                    }
                    //备注
                    string remark = dt.Rows[i][18].ToString();
                    if (!string.IsNullOrEmpty(remark))
                    {
                        item.Remark = remark;
                    }

                    try
                    {
                        keypartbll.SaveForm("", item);
                    }
                    catch
                    {
                        error++;
                    }
                }
                count    = dt.Rows.Count;
                message  = "共有" + count + "条记录,成功导入" + (count - error) + "条,失败" + error + "条";
                message += "</br>" + falseMessage;
            }

            return(message);
        }
Example #28
0
        public object GetEngineerDetails([FromBody] JObject json)
        {
            string  res    = json.Value <string>("json");
            dynamic dy     = JsonConvert.DeserializeObject <ExpandoObject>(res);
            string  userid = dy.userid;

            //获取用户基本信息
            OperatorProvider.AppUserId = userid;  //设置当前用户
            Operator curUser = OperatorProvider.Provider.Current();

            if (null == curUser)
            {
                return(new { code = -1, count = 0, info = "请求失败,请登录!", data = new object() });
            }
            try
            {
                string id      = dy.data ?? "";
                var    disBll  = new DistrictBLL();
                var    didBll  = new DataItemDetailBLL();
                var    deptBll = new DepartmentBLL();
                var    data    = outsouringengineerbll.GetEntity(id);
                if (!string.IsNullOrWhiteSpace(data.ENGINEERAREA))
                {
                    var area = disBll.GetEntity(data.ENGINEERAREA);
                    if (area != null)
                    {
                        data.ENGINEERAREANAME = area.DistrictName;
                    }
                }
                if (!string.IsNullOrWhiteSpace(data.ENGINEERTYPE))
                {
                    var listType = didBll.GetDataItem("ProjectType", data.ENGINEERTYPE).ToList();
                    if (listType != null && listType.Count > 0)
                    {
                        data.ENGINEERTYPENAME = listType[0].ItemName;
                    }
                }
                if (!string.IsNullOrWhiteSpace(data.ENGINEERLEVEL))
                {
                    var listLevel = didBll.GetDataItem("ProjectLevel", data.ENGINEERLEVEL).ToList();
                    if (listLevel != null && listLevel.Count > 0)
                    {
                        data.ENGINEERLEVELNAME = listLevel[0].ItemName;
                    }
                }
                if (!string.IsNullOrWhiteSpace(data.OUTPROJECTID))
                {
                    var dept = deptbll.GetEntity(data.OUTPROJECTID);
                    data.OUTPROJECTCODE = dept.EnCode;
                    data.OUTPROJECTNAME = dept.FullName;
                }
                //return Json(new
                //{
                //    code = 0,
                //    info = "获取数据成功",
                //    count = 0,
                //    data = data
                //}, new JsonSerializerSettings() { DateFormatString = "yyyy-MM-dd HH:mm:ss" });

                JsonSerializerSettings settings = new JsonSerializerSettings
                {
                    //ContractResolver = new LowercaseContractResolver(dict_props), //转小写,并对指定的列进行自定义名进行更换
                    DateFormatString = "yyyy-MM-dd HH:mm:ss", //格式化日期
                    //NullValueHandling = NullValueHandling.Ignore 值为空则在JSON中体现
                };
                return(new { code = 0, info = "获取数据成功", count = 1, data = JObject.Parse(JsonConvert.SerializeObject(data, Formatting.None, settings)) });
                //return new
                //{
                //    code = 0,
                //    info = "获取数据成功",
                //    count = 0,
                //    data = data
                //};
            }
            catch (Exception ex)
            {
                return(new { code = -1, count = 0, info = "获取失败,错误:" + ex.Message, data = new object() });
            }
        }
Example #29
0
        public object GetInfo([FromBody] JObject json)
        {
            try
            {
                string  res     = json.Value <string>("json");
                dynamic dy      = JsonConvert.DeserializeObject <ExpandoObject>(res);
                string  userId  = dy.userid;
                string  disid   = dy.data.disid;
                var     disBll  = new DistrictBLL();
                var     didBll  = new DataItemDetailBLL();
                var     deptBll = new DepartmentBLL();
                //获取用户基本信息
                OperatorProvider.AppUserId = userId;  //设置当前用户
                Operator user    = OperatorProvider.Provider.Current();
                var      entity  = techdisclosurebll.GetEntity(disid);
                var      project = new OutsouringengineerBLL().GetEntity(entity.PROJECTID);
                if (project != null)
                {
                    if (!string.IsNullOrWhiteSpace(project.OUTPROJECTID))
                    {
                        var dept = new DepartmentBLL().GetEntity(project.OUTPROJECTID);
                        project.OUTPROJECTCODE = dept.EnCode;
                        project.OUTPROJECTNAME = dept.FullName;
                    }
                    //if (!string.IsNullOrWhiteSpace(project.ENGINEERAREA))
                    //{
                    //    var area = disBll.GetEntity(project.ENGINEERAREA);
                    //    if (area != null)
                    project.ENGINEERAREANAME = project.EngAreaName;
                    //}
                    if (!string.IsNullOrWhiteSpace(project.ENGINEERTYPE))
                    {
                        var listType = didBll.GetDataItem("ProjectType", project.ENGINEERTYPE).ToList();
                        if (listType != null && listType.Count > 0)
                        {
                            entity.ENGINEERTYPENAME = listType[0].ItemName;
                        }
                    }
                    if (!string.IsNullOrWhiteSpace(project.ENGINEERLEVEL))
                    {
                        var listLevel = didBll.GetDataItem("ProjectLevel", project.ENGINEERLEVEL).ToList();
                        if (listLevel != null && listLevel.Count > 0)
                        {
                            entity.ENGINEERLEVELNAME = listLevel[0].ItemName;
                        }
                    }
                }
                else
                {
                    var listLevel = didBll.GetDataItem("ProjectLevel", entity.ENGINEERLEVEL).ToList();
                    if (listLevel != null && listLevel.Count > 0)
                    {
                        entity.ENGINEERLEVELNAME = listLevel[0].ItemName;
                    }

                    var listType = didBll.GetDataItem("ProjectType", entity.ENGINEERTYPE).ToList();
                    if (listType != null && listType.Count > 0)
                    {
                        entity.ENGINEERTYPENAME = listType[0].ItemName;
                    }
                }
                var listmaj = didBll.GetDataItem("BelongMajor", entity.DISCLOSUREMAJOR).ToList();
                if (listmaj != null && listmaj.Count > 0)
                {
                    entity.DISCLOSUREMAJORNAME = listmaj[0].ItemName;
                }
                var    files  = new FileInfoBLL().GetFiles(disid);        //获取相关附件
                var    pics   = new FileInfoBLL().GetFiles(disid + "01"); //获取相关附件
                string webUrl = new DataItemDetailBLL().GetItemValue("imgUrl");
                foreach (DataRow dr in files.Rows)
                {
                    dr["filepath"] = dr["filepath"].ToString().Replace("~/", webUrl + "/");
                }
                foreach (DataRow dr in pics.Rows)
                {
                    dr["filepath"] = dr["filepath"].ToString().Replace("~/", webUrl + "/");
                }
                List <AptitudeinvestigateauditEntity> AptitudeList = aptitudeinvestigateauditbll.GetAuditList(entity.ID);
                for (int i = 0; i < AptitudeList.Count; i++)
                {
                    if (string.IsNullOrWhiteSpace(AptitudeList[i].AUDITSIGNIMG))
                    {
                        AptitudeList[i].AUDITSIGNIMG = string.Empty;
                    }
                    else
                    {
                        AptitudeList[i].AUDITSIGNIMG = webUrl + AptitudeList[i].AUDITSIGNIMG.ToString().Replace("../../", "/").ToString();
                    }
                }
                //查询审核流程图
                List <CheckFlowData> nodeList = new AptitudeinvestigateinfoBLL().GetAppFlowList(entity.ID, "13", curUser);
                var data = new
                {
                    AuditInfo = AptitudeList,
                    nodeList  = nodeList,
                    project   = project,
                    entity    = entity,
                    piclist   = pics,
                    filelist  = files
                };
                Dictionary <string, string> dict_props = new Dictionary <string, string>();
                //Id 转换前的列名  keyvalue 转换后的列名
                //dict_props.Add("Id", "keyvalue");

                JsonSerializerSettings settings = new JsonSerializerSettings
                {
                    ContractResolver = new LowercaseContractResolver(dict_props), //转小写,并对指定的列进行自定义名进行更换
                    DateFormatString = "yyyy-MM-dd HH:mm",                        //格式化日期
                    //NullValueHandling = NullValueHandling.Ignore 值为空则在JSON中体现
                };
                return(new { code = 0, info = "获取数据成功", count = 1, data = JObject.Parse(JsonConvert.SerializeObject(data, Formatting.None, settings)) });
            }
            catch (Exception ex)
            {
                return(new { code = -1, count = 0, info = ex.Message });
            }
        }
Example #30
0
        public string ImportCamera()
        {
            int    error        = 0;
            string message      = "请选择格式正确的文件再导入!";
            string falseMessage = "";
            int    count        = HttpContext.Request.Files.Count;

            if (count > 0)
            {
                HttpPostedFileBase file = HttpContext.Request.Files[0];
                if (string.IsNullOrEmpty(file.FileName))
                {
                    return(message);
                }
                if (!(file.FileName.Substring(file.FileName.IndexOf('.')).Contains("xls") || file.FileName.Substring(file.FileName.IndexOf('.')).Contains("xlsx")))
                {
                    return(message);
                }
                string fileName = DateTime.Now.ToString("yyyyMMddHHmmss") + System.IO.Path.GetExtension(file.FileName);
                file.SaveAs(Server.MapPath("~/Resource/temp/" + fileName));
                DataTable dt    = ExcelHelper.ExcelImport(Server.MapPath("~/Resource/temp/" + fileName));
                int       order = 1;


                DistrictBLL           districtbll = new DistrictBLL();
                List <DistrictEntity> AreaList    = districtbll.GetListByOrgIdAndParentId("", "");


                DataItemDetailBLL    dataItemDetailBLL = new DataItemDetailBLL();
                List <DataItemModel> data = dataItemDetailBLL.GetDataItemListByItemCode("'CameraType'").ToList();



                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string CameraID     = dt.Rows[i][0].ToString();
                    string CameraName   = dt.Rows[i][1].ToString();
                    string CameraType   = dt.Rows[i][2].ToString();
                    string CameraTypeId = "";
                    //区域
                    string AreaName  = dt.Rows[i][3].ToString();
                    string AreaValue = "";
                    string AreaCode  = "";
                    //楼层编号
                    string FloorNo     = dt.Rows[i][4].ToString();
                    string CameraPoint = dt.Rows[i][5].ToString();
                    string CameraIp    = dt.Rows[i][6].ToString();

                    if (string.IsNullOrEmpty(CameraID))
                    {
                        falseMessage += "</br>" + "第" + (i + 2) + "摄像头ID为空,未能导入.";
                        error++;
                        continue;
                    }

                    if (string.IsNullOrEmpty(CameraName))
                    {
                        falseMessage += "</br>" + "第" + (i + 2) + "摄像头名称为空,未能导入.";
                        error++;
                        continue;
                    }

                    if (string.IsNullOrEmpty(CameraType))
                    {
                        falseMessage += "</br>" + "第" + (i + 2) + "摄像头类别为空,未能导入.";
                        error++;
                        continue;
                    }

                    if (string.IsNullOrEmpty(AreaName))
                    {
                        falseMessage += "</br>" + "第" + (i + 2) + "区域名称为空,未能导入.";
                        error++;
                        continue;
                    }

                    if (string.IsNullOrEmpty(FloorNo))
                    {
                        falseMessage += "</br>" + "第" + (i + 2) + "楼层编号为空,未能导入.";
                        error++;
                        continue;
                    }

                    if (string.IsNullOrEmpty(CameraPoint))
                    {
                        falseMessage += "</br>" + "第" + (i + 2) + "摄像头坐标为空,未能导入.";
                        error++;
                        continue;
                    }

                    if (string.IsNullOrEmpty(CameraIp))
                    {
                        falseMessage += "</br>" + "第" + (i + 2) + "IP地址为空,未能导入.";
                        error++;
                        continue;
                    }
                    var IP    = @"(^(\d+)\.(\d+)\.(\d+)\.(\d+)$)";//@"/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/g";
                    var point = @"(^\d{1,9}(.\d{1,2});\d{1,9}(.\d{1,2})$)";

                    ////验证是否是IP
                    if (!Regex.IsMatch(CameraIp, IP))
                    {
                        falseMessage += "</br>" + "第" + (i + 2) + "行IP地址格式填写错误,未能导入.";
                        error++;
                        continue;
                    }

                    ////验证是否是坐标
                    if (!Regex.IsMatch(CameraPoint, point))
                    {
                        falseMessage += "</br>" + "第" + (i + 2) + "行坐标格式填写错误,格式应为xx.xx;xx.xx,未能导入.";
                        error++;
                        continue;
                    }


                    var ct = data.Where(it => it.ItemName == CameraType).FirstOrDefault();
                    if (ct == null)
                    {
                        falseMessage += "</br>" + "第" + (i + 2) + "行摄像头类别填写错误,未找到对应的摄像头类别,未能导入.";
                        error++;
                        continue;
                    }

                    CameraTypeId = ct.ItemValue;

                    var area = AreaList.Where(it => it.DistrictName == AreaName).FirstOrDefault();
                    if (area == null)
                    {
                        falseMessage += "</br>" + "第" + (i + 2) + "行区域名称填写错误,未找到对应的区域,未能导入.";
                        error++;
                        continue;
                    }

                    AreaValue = area.DistrictID;
                    AreaCode  = area.DistrictCode;

                    KbscameramanageEntity kbs = new KbscameramanageEntity();
                    kbs.AreaCode     = AreaCode;
                    kbs.AreaName     = AreaName;
                    kbs.CameraId     = CameraID;
                    kbs.CameraName   = CameraName;
                    kbs.CameraType   = CameraType;
                    kbs.FloorNo      = FloorNo;
                    kbs.OperuserName = OperatorProvider.Provider.Current().UserName;
                    kbs.AreaId       = AreaValue;
                    kbs.CameraIP     = CameraIp;
                    kbs.CameraPoint  = CameraPoint;
                    kbs.CameraTypeId = Convert.ToInt32(CameraTypeId);
                    kbs.State        = "在线";


                    try
                    {
                        kbscameramanagebll.SaveForm("", kbs);
                    }
                    catch
                    {
                        error++;
                    }
                }
                count    = dt.Rows.Count;
                message  = "共有" + count + "条记录,成功导入" + (count - error) + "条,失败" + error + "条";
                message += "</br>" + falseMessage;
            }

            return(message);
        }