Пример #1
0
 /// <summary>
 /// 动作方法调用之前执行
 /// </summary>
 /// <param name="filterContext"></param>
 protected override void OnActionExecuting(ActionExecutingContext filterContext)
 {
     base.OnActionExecuting(filterContext);
     // 如果用户已经登录,更新在线记录
     if (User.Identity.IsAuthenticated)
     {
         Hashtable has = Panda_UserInfoDal.Get(GetIdentityName());
         if (has != null)
         {
             UpdateOnlineUser();
         }
     }
 }
Пример #2
0
        private void UpdateGrid(JArray Grid1_fields, int gridIndex, int gridPageSize)
        {
            var    Grid1 = UIHelper.Grid("Grid1");
            string sql   = string.Empty;

            if (GetUserType().Equals("3"))  //如果登录用户是客户
            {
                sql = sql + " and a.FCustomerID=" + GetUserCustomer();
            }
            Hashtable table = Panda_UserInfoDal.Search(gridIndex, gridPageSize, "FCreateDate", "DESC", sql);

            Grid1.DataSource(table["data"], Grid1_fields);
            Grid1.RecordCount(Int32.Parse(table["total"].ToString()));
        }
Пример #3
0
        /// <summary>
        /// 当前登录用户泵房组
        /// </summary>
        /// <returns></returns>
        public string GetUserPumpGroup()
        {
            string pumpList = string.Empty;

            if (User.Identity.IsAuthenticated)
            {
                string    group = Panda_UserInfoDal.Get(GetIdentityName())["UserPumpGroup"].ToString();
                DataTable dt    = Panda_PGroupDal.SearchGroupPump(" and a.GroupID='" + group + "'");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    pumpList = pumpList + "'" + dt.Rows[i]["PumpID"] + "',";
                }
                return(pumpList.Substring(0, pumpList.LastIndexOf(',')));
            }
            return(String.Empty);
        }
Пример #4
0
        public ActionResult btnEdit_Click([Bind(Include = "ID,FCompanyNumber,UserName,UserPwd,UserSex,UserBirthday,UserMail,UserEnabledisable,UserRemark,UserPumpGroup,FCustomerID,UserType,IsOther")] Panda_Customer cus)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (Panda_UserInfoDal.Exist(" and UserName='******' and UserName<>'" + Request["tbxOldName"] + "'").Rows.Count == 0)
                    {
                        Hashtable hasData = new Hashtable();
                        hasData["ID"]             = Request["tbxID"];
                        hasData["FCompanyNumber"] = Request["ddlCompany"];
                        hasData["UserName"]       = Request["tbxName"];
                        if (!Request["tbxPassword"].Equals(Request["tbxoldPwd"]))
                        {
                            hasData["UserPwd"] = PasswordUtil.CreateDbPassword(Request["tbxPassword"]);
                        }
                        hasData["UserSex"]      = Request["ddlSex"];
                        hasData["UserBirthday"] = Request["dpBirthday"];
                        //hasData["UserTel"] = Request["ddlCompany"];
                        hasData["UserMail"]          = Request["tbxEmail"];
                        hasData["UserEnabledisable"] = Request["ddlEnable"];
                        hasData["UserRemark"]        = Request["tbxRemark"];
                        hasData["UserPumpGroup"]     = Request["tbxPumpGroupID"];
                        hasData["FCustomerID"]       = Request["tbxCustomerID"];
                        hasData["UserType"]          = Request["ddlType"];
                        hasData["IsOther"]           = Request["ddlType"] == "4" ? "1" : "0";
                        hasData["FUpdUser"]          = GetIdentityName();
                        hasData["FUpdDate"]          = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ssss"));
                        Panda_UserInfoDal.Update(hasData);
                        ShowNotify("修改成功!");
                        // 关闭本窗体(触发窗体的关闭事件)
                        PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                    }
                    else
                    {
                        ShowNotify("用户名重复,请更换!");
                    }
                }
            }
            catch
            {
                ShowNotify("修改失败!");
            }

            return(UIHelper.Result());
        }
Пример #5
0
        public ActionResult Index()
        {
            ViewBag.CoreUserNew    = CheckPower("CoreUserNew");
            ViewBag.CoreUserDelete = CheckPower("CoreUserDelete");
            ViewBag.CoreUserEdit   = CheckPower("CoreUserEdit");
            string sql = string.Empty;

            if (GetUserType().Equals("3"))  //如果登录用户是客户
            {
                sql = sql + " and a.FCustomerID=" + GetUserCustomer();
            }
            Hashtable table = Panda_UserInfoDal.Search(0, 20, "FCreateDate", "DESC", sql);

            ViewBag.Grid1DataSource  = table["data"];
            ViewBag.Grid1RecordCount = Int32.Parse(table["total"].ToString());
            return(View());
        }
Пример #6
0
        public ActionResult btnCreate_Click()
        {
            if (ModelState.IsValid)
            {
                try
                {
                    if (Panda_UserInfoDal.Exist(" and UserName='******'").Rows.Count == 0)
                    {
                        Hashtable hasData = new Hashtable();
                        hasData["FCompanyNumber"] = Request["ddlCompany"];
                        hasData["UserName"]       = Request["tbxName"];
                        hasData["UserPwd"]        = PasswordUtil.CreateDbPassword(Request["tbxPassword"]);
                        hasData["UserSex"]        = Request["ddlSex"];
                        hasData["UserBirthday"]   = Request["dpBirthday"];
                        //hasData["UserTel"] = Request["ddlCompany"];
                        hasData["UserMail"]          = Request["tbxEmail"];
                        hasData["UserEnabledisable"] = Request["ddlEnable"];
                        hasData["UserRemark"]        = Request["tbxRemark"];
                        hasData["UserPumpGroup"]     = Request["tbxPumpGroupID"];
                        hasData["FCustomerID"]       = Request["tbxCustomerID"];
                        hasData["UserType"]          = Request["ddlType"];
                        hasData["IsOther"]           = Request["ddlType"] == "4" ? "1" : "0";
                        hasData["FIsDelete"]         = 0;
                        hasData["FCreateUser"]       = GetIdentityName();
                        hasData["FCreateDate"]       = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ssss"));
                        Panda_UserInfoDal.Insert(hasData);

                        ShowNotify("添加成功!");
                        // 关闭本窗体(触发窗体的关闭事件)
                        PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                    }
                    else
                    {
                        ShowNotify("用户名重复,请更换!");
                    }
                }
                catch
                {
                    ShowNotify("添加失败!");
                }
            }

            return(UIHelper.Result());
        }
Пример #7
0
        public ActionResult Grid1_PageIndexChanged(JArray Grid1_fields, int Grid1_pageIndex, int gridPageSize, string searchMessage)
        {
            var Grid1 = UIHelper.Grid("Grid1");

            string sql = string.Empty;

            if (GetUserType().Equals("3"))  //如果登录用户是客户
            {
                sql = sql + " and a.FCustomerID=" + GetUserCustomer();
            }
            if (!searchMessage.Equals(""))
            {
                sql = sql + " and UserName like '%" + searchMessage + "%'";
            }
            Hashtable table = Panda_UserInfoDal.Search(Grid1_pageIndex, gridPageSize, "FCreateDate", "DESC", sql);

            Grid1.DataSource(table["data"], Grid1_fields);
            Grid1.RecordCount(Int32.Parse(table["total"].ToString()));

            return(UIHelper.Result());
        }
Пример #8
0
        private void BindGrid1(int pageIndex, int pageSize, string selectTest, out DataTable table, out int count, int RoleID)
        {
            string sql = string.Empty;

            if (!selectTest.Equals(""))
            {
                sql = sql + " and UserName like '%" + selectTest + "%'";
            }

            if (GetUserType().Equals("3"))  //如果登录用户是客户
            {
                sql = sql + " and a.FCustomerID=" + GetUserCustomer();
            }
            else
            {
                string roleName = db.roles.Where(x => x.ID == RoleID).FirstOrDefault().Name;
                if (roleName.Contains("管理员"))
                {
                    sql = sql + " and UserType=1";
                }
                else if (roleName.Contains("分公司"))
                {
                    sql = sql + " and UserType=2";
                }
                else if (roleName.Contains("客户"))
                {
                    sql = sql + " and UserType=3";
                }
                else if (roleName.Contains("其他"))
                {
                    sql = sql + " and UserType=4";
                }
            }

            Hashtable has = Panda_UserInfoDal.Search(pageIndex, pageSize, "FCreateDate", "DESC", sql);

            count = Int32.Parse(has["total"].ToString());
            table = (DataTable)has["data"];
        }
Пример #9
0
        //
        // GET: /MobileText/
        public ActionResult Index()
        {
            Hashtable user = Panda_UserInfoDal.GetLogin("panda", "1");

            LoginSuccess(user);

            Panda_PumpJZ model = db.Panda_PumpJZ.Where(x => x.DTUCode.Equals("03170519236")).FirstOrDefault();
            E_DATA_MAIN  data  = db.E_DATA_MAIN.Where(x => x.BaseID.Equals(model.ID)).FirstOrDefault();
            DataTable    dt    = publicDal.TableSearch(@"select TempTime,  RIGHT(a.FDTUCode,3)+'('+RIGHT(a.FName,1)+')' FName,b.FMpa from BASE_YALI a,DATA_YALI_MAIN b 
                                                   where a.id=b.BASEID and a.FDTUCode in('03160926018','03160926076','03160926027','03160926028','03160926015','03160926026') 
                                                order by FName");

            ViewBag.txt_name       = model.PumpJZName;
            ViewBag.txt_time       = data.TempTime.ToString();
            ViewBag.txt_jinchuWat  = data.F41006.ToString() + "/" + data.F41007.ToString();
            ViewBag.txt_jinchuShun = data.F41024.ToString() + "/" + data.F41025.ToString();
            ViewBag.txt_jinchuXian = data.F41109.ToString() + "/" + data.F41107.ToString() + "/" + data.F41113.ToString() + "/" + data.F41111.ToString();
            ViewBag.txt_state      = data.F41003 == "0" ? "手动" : data.F41703 == "1" ? "自动" : "远程-自动";
            ViewBag.Lable1         = dt.Rows[0]["FName"].ToString();
            ViewBag.Text1          = dt.Rows[0]["FMpa"].ToString();
            ViewBag.Time1          = dt.Rows[0]["TempTime"].ToString();
            ViewBag.Lable2         = dt.Rows[1]["FName"].ToString();
            ViewBag.Text2          = dt.Rows[1]["FMpa"].ToString();
            ViewBag.Time2          = dt.Rows[1]["TempTime"].ToString();
            ViewBag.Lable3         = dt.Rows[2]["FName"].ToString();
            ViewBag.Text3          = dt.Rows[2]["FMpa"].ToString();
            ViewBag.Time3          = dt.Rows[2]["TempTime"].ToString();
            ViewBag.Lable4         = dt.Rows[3]["FName"].ToString();
            ViewBag.Text4          = dt.Rows[3]["FMpa"].ToString();
            ViewBag.Time4          = dt.Rows[3]["TempTime"].ToString();
            ViewBag.Lable5         = dt.Rows[4]["FName"].ToString();
            ViewBag.Text5          = dt.Rows[4]["FMpa"].ToString();
            ViewBag.Time5          = dt.Rows[4]["TempTime"].ToString();
            ViewBag.Lable6         = dt.Rows[5]["FName"].ToString();
            ViewBag.Text6          = dt.Rows[5]["FMpa"].ToString();
            ViewBag.Time6          = dt.Rows[5]["TempTime"].ToString();
            return(View());
        }
Пример #10
0
        public ActionResult btnSave_OnClick()
        {
            // 检查当前密码是否正确
            string oldPass        = Request["tbxOldPassword"];
            string newPass        = Request["tbxNewPassword"];
            string confirmNewPass = Request["tbxConfirmNewPassword"];

            if (newPass != confirmNewPass)
            {
                UIHelper.TextBox("tbxConfirmNewPassword").MarkInvalid("确认密码和新密码不一致!");
            }

            if (!PasswordUtil.ComparePasswords(Panda_UserInfoDal.Get(GetIdentityName())["UserPwd"].ToString(), oldPass))
            {
                UIHelper.TextBox("tbxOldPassword").MarkInvalid("当前密码不正确!");
            }

            try
            {
                //string userGH = GetIdentityName();
                //User users = db.users.Where(x => x.Name.Equals(userGH)).FirstOrDefault();
                //users.Password = PasswordUtil.CreateDbPassword(newPass);
                //db.SaveChanges();
                Hashtable hasData = new Hashtable();
                hasData["ID"]      = GetIdentityName();
                hasData["UserPwd"] = PasswordUtil.CreateDbPassword(newPass);
                Panda_UserInfoDal.Update(hasData);
                ShowNotify("修改密码成功!");
            }
            catch
            {
                ShowNotify("修改密码失败,请重新操作!");
            }

            return(UIHelper.Result());
        }