コード例 #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            tb_clerkTableAdapter clerkTableAdapter = new tb_clerkTableAdapter();
            DataRowCollection rows = clerkTableAdapter.GetDataByid(Convert.ToInt32(Session["UserId"])).Rows;

            if (rows.Count > 0)
            {
                AfterSaleServiceSystem.DAL.dsClerk.tb_clerkDataTable dt = clerkTableAdapter.GetDataByid(Convert.ToInt32(Session["UserId"]));
                AfterSaleServiceSystem.DAL.dsClerk.tb_clerkRow row = (AfterSaleServiceSystem.DAL.dsClerk.tb_clerkRow )dt.Rows[0];

                // row .password
                TextBox tbOld = (TextBox)this.Master.FindControl("ContentPlaceHolderContent").FindControl("TextBoxOldVal");
                TextBox tbNew = (TextBox)this.Master.FindControl("ContentPlaceHolderContent").FindControl("TextBoxNewVal");
                TextBox tbConfirm = (TextBox)this.Master.FindControl("ContentPlaceHolderContent").FindControl("TextBoxConfirm");

                string sOld = tbOld.Text;
                string sNew = tbNew.Text;
                string sConfirm = tbConfirm.Text;
                if (row.password.Trim() == sOld)//原密码验证成功
                {
                    row.password = sNew;
                    clerkTableAdapter.Update(dt);
                }
                else
                {
                    RequiredFieldValidatorOldVal.Text = "原始密码错误";
                }

            }
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int authorityid = Convert.ToInt32((Session["authorityid"]));

            #if DEBUG
            if (Session["UserId"] == null)
            {

                Session["UserId"] = 1;
            }
            #endif

            if (Session["UserId"] == null)
            {
                Response.Redirect("~\\Default.aspx");
            }
            else
            {

                if (authorityid == 1)
                {

                    HyperLink1.NavigateUrl = "../Serviceman/ClerkMain.aspx";

                }
                else if (authorityid == 2)
                { HyperLink1.NavigateUrl = "../Supervisor/supervisorHomePage.aspx"; }
                //更新用户信
                ///*
                int userid = Convert.ToInt32(Session["UserId"]);

                tb_clerkTableAdapter clerkTableAdapter = new tb_clerkTableAdapter();
                DataRowCollection clerkRows = clerkTableAdapter.GetDataByid(userid).Rows;

                if (clerkRows.Count > 0)
                {
                    AfterSaleServiceSystem.DAL.dsClerk.tb_clerkRow clerkRow = (AfterSaleServiceSystem.DAL.dsClerk.tb_clerkRow)clerkRows[0];

                    LabelUserName.Text = clerkRow.realname;

                    if (clerkRow.headpic != null && File.Exists(Server.MapPath("~\\img\\" + clerkRow.headpic)))
                    {
                        ImageUser.ImageUrl = Server.MapPath("~\\img\\" + clerkRow.headpic);
                    }
                    else
                    {
                        ImageUser.ImageUrl = "~\\img\\noavatar_small.gif";
                    }
                }
                //*/

                ////from cooks
                //LabelUserName.Text = Request.Cookies["UserName"].ToString();
                //ImageUser.ImageUrl =

            }
        }
コード例 #3
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            string str_ispostBack = context.Request["btn"];

            if (string.IsNullOrEmpty(str_ispostBack))//请求展示
            {
                string result = CommonHelper.RenderHtml("LogIn.htm", new { tips = "" });
                context.Response.Write(result);
            }
            else//提交请求
            {

                string username = context.Request["txtName"];
                string passwd = context.Request["txtPwd"];

                using (tb_clerkTableAdapter clerkTableAdapter = new tb_clerkTableAdapter())
                {
                    if (clerkTableAdapter.GetDataByUsernameAndPassword(username, passwd).Rows.Count > 0)//存在用户
                    {
                        AfterSaleServiceSystem.DAL.dsClerk.tb_clerkRow row = (AfterSaleServiceSystem.DAL.dsClerk.tb_clerkRow)clerkTableAdapter.GetDataByUsernameAndPassword(username, passwd).Rows[0];
                        context.Session["UserId"] = (int)row.id;
                        context.Session["authorityid"] = row.authorityid;
                        if (row.authorityid == 2)//管理员登陆
                        {

                            context.Response.Redirect("/Supervisor/supervisorHomePage.aspx");
                            //进入管理员页面
                            //todo

                        }
                        else if (row.authorityid == 1)//维修人员登陆
                        {

                            //进入维修人员页面
                            context.Response.Redirect("/Serviceman/ClerkMain.aspx");
                        }

                    }
                    else //用户名或密码错误
                    {
                        string result = CommonHelper.RenderHtml("LogIn.htm", new { tips = "用户名或密码错误" });
                        context.Response.Write(result);
                    }
                }
            }
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
#if DEBUG
            if (Session["UserId"] == null)
            {
                Session["UserId"] = 1;
            }
#endif

            if (Session["UserId"] == null)
            {
                Response.Redirect("~\\Default.aspx");
            }
            else
            {
                //更新用户信息
                ///*
                int userid = Convert.ToInt32(Session["UserId"]);

                tb_clerkTableAdapter clerkTableAdapter = new tb_clerkTableAdapter();
                DataRowCollection    clerkRows         = clerkTableAdapter.GetDataByid(userid).Rows;


                if (clerkRows.Count > 0)
                {
                    AfterSaleServiceSystem.DAL.dsClerk.tb_clerkRow clerkRow = (AfterSaleServiceSystem.DAL.dsClerk.tb_clerkRow)clerkRows[0];

                    LabelUserName.Text = clerkRow.realname;

                    if (clerkRow.headpic != null && File.Exists(Server.MapPath("~\\img\\" + clerkRow.headpic)))
                    {
                        ImageUser.ImageUrl = Server.MapPath("~\\img\\" + clerkRow.headpic);
                    }
                    else
                    {
                        ImageUser.ImageUrl = "~\\img\\noavatar_small.gif";
                    }
                }
                //*/

                ////from cooks
                //LabelUserName.Text = Request.Cookies["UserName"].ToString();
                //ImageUser.ImageUrl =
            }
        }
コード例 #5
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            tb_clerkTableAdapter clerkTableAdapter = new tb_clerkTableAdapter();
            DataRowCollection    rows = clerkTableAdapter.GetDataByid(Convert.ToInt32(Session["UserId"])).Rows;

            if (rows.Count > 0)
            {
                AfterSaleServiceSystem.DAL.dsClerk.tb_clerkRow row = (AfterSaleServiceSystem.DAL.dsClerk.tb_clerkRow)rows[0];

                // row .password
                TextBox tbOld     = (TextBox)this.Master.FindControl("ContentPlaceHolderContent").FindControl("TextBoxOldVal");
                TextBox tbNew     = (TextBox)this.Master.FindControl("ContentPlaceHolderContent").FindControl("TextBoxNewVal");
                TextBox tbConfirm = (TextBox)this.Master.FindControl("ContentPlaceHolderContent").FindControl("TextBoxConfirm");

                string sOld     = tbOld.Text;
                string sNew     = tbNew.Text;
                string sConfirm = tbConfirm.Text;
            }
        }
コード例 #6
0
        protected void FormView_report_ItemCreated(object sender, EventArgs e)
        {
            TextBox TextBoxStartTime;
            Literal LiteralstartTime;

            TextBox TextBoxEndTime;
            Literal LiteralEndTime;

            TextBox TextBoxEdtTime;
            Literal LiteralEdtTime;

            TextBox TextBoxSendTime;
            Literal LiteralSendTime;

            //Label labelclerk;
            TextBox Textboxclerk;

            if (FormView_Report.CurrentMode == FormViewMode.Edit)
            {
                TextBoxStartTime = (TextBox)FormView_Report.FindControl("TextBoxStartTime");
                LiteralstartTime = (Literal)FormView_Report.FindControl("LiteralstartTime");

                TextBoxEndTime = (TextBox)FormView_Report.FindControl("TextBoxEndTime");
                LiteralEndTime = (Literal)FormView_Report.FindControl("LiteralEndTime");

                TextBoxEdtTime = (TextBox)FormView_Report.FindControl("TextBoxEdtTime");
                LiteralEdtTime = (Literal)FormView_Report.FindControl("LiteralEdtTime");

                TextBoxSendTime = (TextBox)FormView_Report.FindControl("TextBoxSendTime");
                LiteralSendTime = (Literal)FormView_Report.FindControl("LiteralSendTime");

                Textboxclerk = (TextBox)FormView_Report.FindControl("Textboxclerk");

                if (TextBoxStartTime != null && LiteralstartTime != null)
                {
                    LiteralstartTime.Text = TextBoxStartTime.ClientID;
                }

                if (TextBoxEndTime != null && LiteralEndTime != null)
                {
                    LiteralEndTime.Text = TextBoxEndTime.ClientID;
                }

                if (TextBoxEdtTime != null && LiteralEdtTime != null)
                {
                    LiteralEdtTime.Text = TextBoxEdtTime.ClientID;
                }

                if (TextBoxSendTime != null && LiteralSendTime != null)
                {
                    LiteralSendTime.Text = TextBoxSendTime.ClientID;
                }

                if (Textboxclerk != null)
                {
                    Textboxclerk.Text = "";

                    if (Convert.ToInt32(Session["authorityid"]) == 1)
                    {
                        tb_clerkTableAdapter clerks = new tb_clerkTableAdapter();
                        AfterSaleServiceSystem.DAL.dsClerk.tb_clerkDataTable clerktb =
                            (AfterSaleServiceSystem.DAL.dsClerk.tb_clerkDataTable)clerks.GetDataByid(Convert.ToInt32(Session["UserId"]));

                        if (clerktb.Rows.Count > 0)
                        {
                            AfterSaleServiceSystem.DAL.dsClerk.tb_clerkRow clerkrow =
                                (AfterSaleServiceSystem.DAL.dsClerk.tb_clerkRow)clerktb.Rows[0];

                            Textboxclerk.Text = clerkrow.realname;
                        }
                    }
                }

            }
            else if (FormView_Report.CurrentMode == FormViewMode.Insert)
            {
                TextBoxStartTime = (TextBox)FormView_Report.FindControl("TextBoxStartTimeIns");
                LiteralstartTime = (Literal)FormView_Report.FindControl("LiteralstartTimeIns");

                TextBoxEndTime = (TextBox)FormView_Report.FindControl("TextBoxEndTimeIns");
                LiteralEndTime = (Literal)FormView_Report.FindControl("LiteralEndTimeIns");

                TextBoxEdtTime = (TextBox)FormView_Report.FindControl("TextBoxEdtTimeIns");
                LiteralEdtTime = (Literal)FormView_Report.FindControl("LiteralEdtTimeIns");

                TextBoxSendTime = (TextBox)FormView_Report.FindControl("TextBoxSendTimeIns");
                LiteralSendTime = (Literal)FormView_Report.FindControl("LiteralSendTimeIns");

                //labelclerk = (Label)FormView_Report.FindControl("labelclerkIns");

                if (TextBoxStartTime != null && LiteralstartTime != null)
                {
                    LiteralstartTime.Text = TextBoxStartTime.ClientID;
                }

                if (TextBoxEndTime != null && LiteralEndTime != null)
                {
                    LiteralEndTime.Text = TextBoxEndTime.ClientID;
                }

                if (TextBoxEdtTime != null && LiteralEdtTime != null)
                {
                    LiteralEdtTime.Text = TextBoxEdtTime.ClientID;
                }

                if (TextBoxSendTime != null && LiteralSendTime != null)
                {
                    LiteralSendTime.Text = TextBoxSendTime.ClientID;
                }

                //if (labelclerk != null)
                //{
                //    labelclerk.Text = "测试员";

                //    tb_clerkTableAdapter clerks = new tb_clerkTableAdapter();
                //    AfterSaleServiceSystem.DAL.dsClerk.tb_clerkDataTable clerktb =
                //        (AfterSaleServiceSystem.DAL.dsClerk.tb_clerkDataTable)clerks.GetDataByid(Convert.ToInt32(Session["UserId"]));

                //    if (clerktb.Rows.Count > 0)
                //    {
                //        AfterSaleServiceSystem.DAL.dsClerk.tb_clerkRow clerkrow =
                //            (AfterSaleServiceSystem.DAL.dsClerk.tb_clerkRow)clerktb.Rows[0];

                //        labelclerk.Text = clerkrow.realname;
                //    }
                //}

            }
        }