示例#1
0
        public string GetRoleList(RoleView ri, string ChildrenSel, int rows, int page)
        {
            //RoleView ri = new RoleView();
            if (ri.DeptId == null || ri.DeptId.Trim() == "")
            {
                UserInfo user = new UserInfo();
                user      = (UserInfo)Session["LoginUser"];
                ri.DeptId = user.EnterId;
            }

            if (ChildrenSel == "true")
            {
                DeptInfo di = deptInfoBll.GetDeptInfo(ri.DeptId);
                if (di != null)
                {
                    ri.Businessdivisioncode = di.Businessdivisioncode;
                    ri.DeptId = "";
                }
            }
            ri.StartData = (page - 1) * rows + 1;
            ri.EndData   = ri.StartData + rows;
            IList <RoleView> iri = roleInfoBll.GetRoleInfoPage(ri);
            int total            = roleInfoBll.GetRoleInfoCount(ri);

            return(ConvertToJson(iri, total));
        }
示例#2
0
        public string GetList(Selectcarmonitor rtv, string DeptCode, string SelType, int RowNumber)
        {
            UserInfo user = new UserInfo();

            user = (UserInfo)Session["LoginUser"];

            DeptInfo  dif = new DeptInfo();
            Hashtable ht  = new Hashtable();

            ht.Add("TerStatus", rtv.TerStatus);
            ht.Add("TerNo", rtv.TerNo == null ? "" : rtv.TerNo.Trim().ToUpper());
            //ht.Add("CarNo", rtv.CarNo == null ? "" : rtv.CarNo.Trim());
            //ht.Add("CarAdminName", rtv.CarAdminName == null ? "" : rtv.CarAdminName.Trim());
            ht.Add("StartData", rtv.StartData);
            ht.Add("EndData", 0); // RowNumber * 20 + 1
            ht.Add("ReplydataCode", rtv.ReplydataCode == null?"":rtv.ReplydataCode.Trim());
            ht.Add("Northorsouth", rtv.Northorsouth);
            if (rtv.Businessdivisionid != null && rtv.Businessdivisionid.Trim() == "")
            {
                if (user.EnterId != null)
                {
                    ht.Add("Businessdivisionid", user.EnterId);
                }
                else
                {
                    ht.Add("UserLname", user.UserLname);
                }
            }
            else
            {
                ht.Add("Businessdivisionid", rtv.Businessdivisionid);
            }

            if (DeptCode == "true")
            {
                if (user.EnterId != null)
                {
                    dif = deptInfoBll.GetDeptInfo(ht["Businessdivisionid"].ToString());
                    ht.Add("Businessdivisioncode", dif.Businessdivisioncode);
                    ht["Businessdivisionid"] = "";
                }
            }

            if (SelType == "Ter" || SelType == "Dept")
            {
                ht.Add("SelType", "true");
            }
            else
            {
                ht.Add("SelType", "");
            }

            IList <Selectcarmonitor> irt = realtimeDataBll.SelectCarMonitor(ht);
            string uu = ConvertToJson(irt);

            return(uu);
        }
        public ActionResult UserList()
        {
            IList <MenuInfo> imi = (IList <MenuInfo>)Session["Right"];

            ViewBag.AddDept  = "false";
            ViewBag.EditDept = "false";
            ViewBag.DelDept  = "false";

            ViewBag.AddUser  = "******";
            ViewBag.EditUser = "******";
            ViewBag.DelUser  = "******";
            ViewBag.PwdReste = "false";

            UserInfo user = new UserInfo();

            user           = (UserInfo)Session["LoginUser"];
            ViewBag.Deptid = user.EnterId;
            DeptInfo di = deptInfoBll.GetDeptInfo(user.EnterId);

            ViewBag.Deptname = di.Businessdivisionname;
            for (int i = 0; i < imi.Count; i++)
            {
                switch (imi[i].MenuName)
                {
                case "添加企业":
                    ViewBag.AddDept = "true";
                    break;

                case "删除企业":
                    ViewBag.DelDept = "true";
                    break;

                case "编辑企业":
                    ViewBag.EditDept = "true";
                    break;

                case "添加用户":
                    ViewBag.AddUser = "******";
                    break;

                case "删除用户":
                    ViewBag.DelUser = "******";
                    break;

                case "修改用户":
                    ViewBag.EditUser = "******";
                    break;

                case "密码初始化":
                    ViewBag.PwdReste = "true";
                    break;
                }
            }
            return(View());
        }
        public int TerExChange(TerminalInfo entity, bool flag)
        {
            if (entity.TerGuid != null && entity.TerGuid.Trim() != "")
            {
                string   TerGuids   = "";
                string   RealTerNos = "";
                string[] TerArr     = entity.TerGuid.Trim(',').Split(',');

                for (int i = 0; i < TerArr.Length; i++)
                {
                    DeptInfoBLL  deptInfoBll = new DeptInfoBLL();
                    TerminalInfo terinfo     = this.GetTerminalInfo(TerArr[i]);
                    DeptInfo     scdi        = deptInfoBll.GetDeptInfo("dabf8b57-75a3-43f8-b540-03fefc9e43c3"); //生产测试的类
                    if (terinfo.TerDeptcode.StartsWith(scdi.Businessdivisioncode))
                    {
                        RealTerNos += "'" + terinfo.TerNo + "',";
                    }
                    TerGuids += "'" + TerArr[i] + "',";
                }
                entity.TerGuid = TerGuids.Trim(',');
                if (RealTerNos.Trim(',') != "" && flag == false)
                {
                    entity.TerNo = RealTerNos.Trim(',');
                    int result = _iTerminalInfoDao.SetReplyRealdata(entity);
                }
                int k = _iTerminalInfoDao.CarExChange(entity);
                return(_iTerminalInfoDao.TerExChange(entity));
            }
            else
            {
                return(0);
            }
        }
        public string GetCarTypeList(string TypeMode, string DeptId)
        {
            UserInfo user = new UserInfo();

            user = (UserInfo)Session["LoginUser"];
            if (user != null)
            {
                DeptInfo    di = deptInfoBll.GetDeptInfo(user.EnterId);
                CarTypeList ct = new CarTypeList();
                if (DeptId != null && DeptId.Trim() != "")
                {
                    ct.Businessdivisionid = DeptId;
                }
                else
                {
                    ct.Businessdivisioncode = di.Businessdivisioncode;
                }

                IList <CarTypeList> ictlist = carTypeBll.GetCarTypeList(ct);
                if (TypeMode == "true")
                {
                    CarTypeList c = new CarTypeList();
                    c.TypeId   = "";
                    c.TypeName = "--选择车辆类型--";
                    ictlist.Insert(0, c);
                }
                string json = ConvertToJson(ictlist);
                return(json);
            }
            else
            {
                return("");
            }
        }
        public ActionResult ENode(string DeptId, string DepType)
        {
            DeptInfo df   = deptInfoBll.GetDeptInfo(DeptId);
            UserInfo user = new UserInfo();

            user = (UserInfo)Session["LoginUser"];
            if (DeptId.Equals(user.EnterId))
            {
                df.Fatherid = user.EnterId;
            }
            if (DepType != null)
            {
                ViewBag.DepType = DepType;
            }
            else
            {
                ViewBag.DepType = "";
            }
            return(View(df));
        }
示例#7
0
        public string AddCarAndTer(TerminalBind tb)
        {
            UserInfo user = new UserInfo();

            user = (UserInfo)Session["LoginUser"];
            if (user != null)
            {
                if (tb.DeptId != null && tb.DeptId.Trim() == "")
                {
                    tb.DeptId = user.EnterId;
                }
                DeptInfoBLL deptInfoBll = new DeptInfoBLL();
                DeptInfo    di          = deptInfoBll.GetDeptInfo(tb.DeptId);
                string      deptcode    = di.Businessdivisioncode;
                tb.Businessdivisioncode = deptcode;
                string     carinfostr = "";
                CarTypeBLL cartypebll = new CarTypeBLL();
                CarType    ct         = cartypebll.GetCarType(tb.TypeId);
                if (ct != null)
                {
                    carinfostr = ct.TypeName + "||||||||||||||||||||||||||||||";
                }
                string result = tib.AddCarAndTer(tb);

                new LogMessage().Save("TerNo:" + tb.TerNo + "。");

                if (result == "true")
                {
                    //绑车接口
                    Transfers.ClintSendCommData(1107, "50", "", tb.CarNo, "", "", "", "", "", "", "", deptcode, tb.CarNo, carinfostr, "", "", "", "", user.UserName);

                    //刷新车辆
                    Transfers.ClintSendCommData(1160, "1108", "", "", "", "", "", "", "", "", "", "1", "2", "", "", "", "", "", "");
                }
                return(result);
            }
            else
            {
                return("false");
            }
        }
        public ActionResult CarInfoForm(CarInfo carInfo, string Hid_FieldsVal, string TerGuid, string TypeName)
        {
            if (carInfo.CarNo != null && carInfo.CarNo.Trim() != "")
            {
                new LogMessage().Save("CarNo:" + carInfo.CarNo + ";");

                ArrayList arr = new ArrayList();
                carInfo.CarId = System.Guid.NewGuid().ToString();
                if (carInfo.Businessdivisionid != null || carInfo.Businessdivisionid.Trim() != "")
                {
                    DeptInfo di = deptInfoBll.GetDeptInfo(carInfo.Businessdivisionid);
                    carInfo.CarDeptcode = di.Businessdivisioncode;
                }
                else
                {
                    ViewBag.Result = "所属企业不正确或者为空";
                    return(View());
                }
                arr.Add(carInfo);

                if (TerGuid != null && TerGuid.Trim() != "")
                {
                    arr.Add(TerGuid);
                }
                else
                {
                    ViewBag.Result = "终端号不正确或者为空";
                    return(View());
                }

                string kku = carInfoBll.InsertCarInfo(arr, TypeName);
                ViewBag.Result = kku;

                //绑定车辆终端
                UserInfo user      = (UserInfo)Session["LoginUser"];
                string   carhbinfo = "";
                if (carInfo.CarColor != "" || TypeName != "")
                {
                    string cartypename = "";
                    if (TypeName.Split('-').Length == 3)
                    {
                        cartypename = TypeName.Split('-')[2];
                    }
                    else
                    {
                        cartypename = TypeName;
                    }

                    carhbinfo = cartypename + "|" + carInfo.CarColor + "|||||||||||||||||||||||||||||";
                }
                string[] terguids = TerGuid.Split(',');
                foreach (string terguid in terguids)
                {
                    TerminalInfoBLL terbll  = new TerminalInfoBLL();
                    TerminalInfo    terinfo = terbll.GetTerminalInfo(terguid);
                    if (terinfo != null && terinfo.TerNo != "")
                    {
                        Transfers.ClintSendCommData(1107, "50", "", terinfo.TerNo, "", "", "", "", "", "", "", carInfo.CarDeptcode, carInfo.CarNo, carhbinfo, carInfo.CarAdminName, carInfo.CarFrame, "", "", user.UserName);
                    }
                }
                //刷新车辆
                //Transfers.ClintSendCommData(1160, "1108", "", "", "", "", "", "", "", "", "", "1", "2", "", "", "", "", "", "");
                return(View());
            }
            else
            {
                ViewBag.Result = "false";
                return(View());
            }
        }
        public string GetCarList(int page, int rows)
        {
            UserInfo user = new UserInfo();

            user = (UserInfo)Session["LoginUser"];
            if (user != null)
            {
                string CarNo       = Request.Params["CarNo"].ToString();
                string TerNo       = Request.Params["TerNo"].ToString();
                string DeptSelId   = Request.Params["DeptSelId"].ToString();
                string ChildrenSel = Request.Params["ChildrenSel"].ToString();

                StringBuilder sb      = new StringBuilder();
                StringBuilder sbCount = new StringBuilder();
                sb.Append("select ci.car_id,ci.car_no,ct.type_name,di.businessdivisionname,ti.ter_no,ti.TER_SIMCARD");
                sb.Append(" from terminal_info ti left join Car_Info ci on ci.car_id=ti.car_id left join car_type ct on ci.type_id=ct.type_id left join dept_info di on ti.dept_id=di.businessdivisionid");
                sb.Append("  where 1=1");
                sbCount.Append("select count(*) from terminal_info ti left join Car_Info ci on ci.car_id=ti.car_id  left join car_type ct on ci.type_id=ct.type_id left join dept_info di on ti.dept_id=di.businessdivisionid  where 1=1");
                if (TerNo != null && TerNo.Trim() != "")
                {
                    sb.Append(string.Format(" and ti.ter_no like '%{0}%'", TerNo));
                    sbCount.Append(string.Format(" and ti.ter_no like '%{0}%'", TerNo));
                }
                if (CarNo != null && CarNo.Trim() != "")
                {
                    sb.Append(string.Format(" and ci.car_no like '%{0}%'", CarNo));
                    sbCount.Append(string.Format(" and ci.car_no like '%{0}%'", CarNo));
                }
                if (DeptSelId != null && DeptSelId.Trim() != "")
                {
                    if (ChildrenSel != "true")
                    {
                        sb.Append(string.Format(" and di.businessdivisionid='{0}'", DeptSelId));
                        sbCount.Append(string.Format(" and di.businessdivisionid='{0}'", DeptSelId));
                    }
                    else
                    {
                        DeptInfo di = null;
                        di = deptInfoBll.GetDeptInfo(DeptSelId);
                        sb.Append(string.Format(" and di.businessdivisioncode like '{0}%'", di.Businessdivisioncode));
                        sbCount.Append(string.Format(" and di.businessdivisioncode like '{0}%'", di.Businessdivisioncode));
                    }
                }
                else
                {
                    if (ChildrenSel != "true")
                    {
                        sb.Append(string.Format(" and di.businessdivisionid='{0}'", user.EnterId));
                        sbCount.Append(string.Format(" and di.businessdivisionid='{0}'", user.EnterId));
                    }
                    else
                    {
                        DeptInfo di = null;
                        di = deptInfoBll.GetDeptInfo(user.EnterId);
                        sb.Append(string.Format(" and di.businessdivisioncode like '{0}%'", di.Businessdivisioncode));
                        sbCount.Append(string.Format(" and di.businessdivisioncode like '{0}%'", di.Businessdivisioncode));
                    }
                }
                sb.Append(" order by car_no ");
                DataSet ds      = c.GetColligateQuery("ColligateQuery.ProteanQuery", sb.ToString(), page, rows);
                DataSet dsCount = c.GetColligateQuery("ColligateQuery.ProteanQuery", sbCount.ToString());
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    return(DtbConvertToJson(ds.Tables[0], int.Parse(dsCount.Tables[0].Rows[0][0].ToString())));
                }
                else
                {
                    return(DtbConvertToJson(new DataTable(), 0));
                }
            }
            else
            {
                return(DtbConvertToJson(new DataTable(), 0));
            }
        }
示例#10
0
        public ActionResult UpLoadForm(string DeptId, HttpPostedFileBase file)
        {
            //CreateExcel();
            if (file != null && file.ContentLength > 0 && DeptId != null && DeptId.Trim() != "")
            {
                string filePath = Path.Combine(HttpContext.Server.MapPath("../Files"), System.Guid.NewGuid().ToString() + Path.GetExtension(file.FileName));
                file.SaveAs(filePath);

                new LogMessage().Save("文件:" + filePath + "。");

                string               val = "";
                ExcelUpLoad          eu  = new ExcelUpLoad();
                string               msg = "";
                List <UpLoadTerBind> lut = eu.ReadExcel(filePath, ref msg);

                if (lut != null && lut.Count > 0)
                {
                    val = tib.InsertExcelData(DeptId, lut);
                    DeptInfoBLL deptInfoBll = new DeptInfoBLL();
                    DeptInfo    di          = deptInfoBll.GetDeptInfo(DeptId);
                    string      deptcode    = di.Businessdivisioncode;
                    UserInfo    user        = (UserInfo)Session["LoginUser"];
                    for (int m = 0; m < lut.Count; m++)
                    {
                        if (!val.Contains(lut[m].TerNo) && val != "false")
                        {
                            string tertype = "";
                            if (lut[m].TerType == "一代无线GPS")
                            {
                                tertype = "104";
                            }
                            else if (lut[m].TerType == "二代无线GPS")
                            {
                                tertype = "102";
                            }
                            else if (lut[m].TerType == "Homer3M" || lut[m].TerType == "Homer3B-2")
                            {
                                tertype = "101";
                            }
                            else if (lut[m].TerType == "五代无线GPS")
                            {
                                tertype = "112";
                            }
                            else if (lut[m].TerType == "五代有线GPS")
                            {
                                tertype = "111";
                            }
                            //添加终端的接口
                            Transfers.ClintSendCommData(1108, "2", "1", lut[m].TerNo, "", "", "", lut[m].TerInnettime.ToString("yyyy-MM-dd HH:mm:ss"), "", "", "", deptcode, lut[m].SimCard, tertype, "", "", "", "", user.UserName);
                        }
                    }

                    ViewBag.ReturnVal = val.Trim(',');
                }
                else if (msg.Trim() != "")
                {
                    ViewBag.ReturnVal = msg;
                }
                else
                {
                    ViewBag.ReturnVal = "false";
                }
            }
            else if (DeptId == null || DeptId.Trim() == "")
            {
                ViewBag.ReturnVal = "请选择导入终端的企业";
            }
            else if (file == null || file.ContentLength <= 0)
            {
                ViewBag.ReturnVal = "请选择导入的文件!";
            }
            return(View());
        }