Example #1
0
 private void CreateddlAdministrators()
 {
     Johnny.CMS.BLL.Access.Administrator administrator = new Johnny.CMS.BLL.Access.Administrator();
     ddlAdministrators.DataSource     = administrator.GetList();
     ddlAdministrators.DataTextField  = "AdminName";
     ddlAdministrators.DataValueField = "AdminId";
     ddlAdministrators.DataBind();
 }
Example #2
0
 private void CreateddlAdministrators()
 {
     Johnny.CMS.BLL.Access.Administrator administrator = new Johnny.CMS.BLL.Access.Administrator();
     ddlAdministrators.DataSource = administrator.GetList();
     ddlAdministrators.DataTextField = "AdminName";
     ddlAdministrators.DataValueField = "AdminId";
     ddlAdministrators.DataBind();
 }
 protected void btnResetPassword_Click(object sender, System.EventArgs e)
 {
     Johnny.CMS.BLL.Access.Administrator bll   = new Johnny.CMS.BLL.Access.Administrator();
     Johnny.CMS.OM.Access.Administrator  model = new Johnny.CMS.OM.Access.Administrator();
     model.AdminId       = Convert.ToInt32(Request.QueryString["id"]);
     model.Password      = FormsAuthentication.HashPasswordForStoringInConfigFile(Johnny.CMS.WebUI.utility.ConfigInfo.DefaultPassword, "MD5");
     model.UpdatedTime   = System.DateTime.Now;
     model.UpdatedById   = DataConvert.GetInt32(Session["UserId"]);
     model.UpdatedByName = DataConvert.GetString(Session["UserName"]);
     bll.ResetPassword(model);
     SetMessage(GetMessage("E00119", Johnny.CMS.WebUI.utility.ConfigInfo.DefaultPassword));
 }
Example #4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //check input
            if (DataValidation.IsEmpty(txtOriginalPassword.Text))
            {
                SetMessage(GetMessage("E00113"));
                txtOriginalPassword.Focus();
                return;
            }
            if (DataValidation.IsEmpty(txtNewPassword.Text))
            {
                SetMessage(GetMessage("E00114"));
                txtNewPassword.Focus();
                return;
            }
            if (DataValidation.IsEmpty(txtConfirmedPassword.Text))
            {
                SetMessage(GetMessage("E00115"));
                txtConfirmedPassword.Focus();
                return;
            }

            if (!DataValidation.IsEqual(txtNewPassword.Text, txtConfirmedPassword.Text))
            {
                SetMessage(GetMessage("E00116"));
                txtNewPassword.Focus();
                return;
            }

            Johnny.CMS.BLL.Access.Administrator admin = new Johnny.CMS.BLL.Access.Administrator();
            string strPwd = FormsAuthentication.HashPasswordForStoringInConfigFile(txtOriginalPassword.Text, "MD5");

            //check old password
            if (!admin.CheckLogin(DataConvert.GetString(Session["UserName"]), strPwd))
            {
                SetMessage(GetMessage("E00117"));
                txtOriginalPassword.Focus();
                return;
            }

            Johnny.CMS.OM.Access.Administrator model = new Johnny.CMS.OM.Access.Administrator();
            model.AdminId       = DataConvert.GetInt32(Session["UserId"]);
            model.Password      = FormsAuthentication.HashPasswordForStoringInConfigFile(txtNewPassword.Text, "MD5");
            model.UpdatedTime   = System.DateTime.Now;
            model.UpdatedById   = DataConvert.GetInt32(Session["UserId"]);
            model.UpdatedByName = DataConvert.GetString(Session["UserName"]);
            admin.ResetPassword(model);
            SetMessage(GetMessage("E00118"));
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //check input
            if (DataValidation.IsEmpty(txtOriginalPassword.Text))
            {
                SetMessage(GetMessage("E00113"));
                txtOriginalPassword.Focus();
                return;
            }
            if (DataValidation.IsEmpty(txtNewPassword.Text))
            {
                SetMessage(GetMessage("E00114"));
                txtNewPassword.Focus();
                return;
            }
            if (DataValidation.IsEmpty(txtConfirmedPassword.Text))
            {
                SetMessage(GetMessage("E00115"));
                txtConfirmedPassword.Focus();
                return;
            }

            if (!DataValidation.IsEqual(txtNewPassword.Text, txtConfirmedPassword.Text))
            {
                SetMessage(GetMessage("E00116"));
                txtNewPassword.Focus();
                return;
            }

            Johnny.CMS.BLL.Access.Administrator admin = new Johnny.CMS.BLL.Access.Administrator();
            string strPwd = FormsAuthentication.HashPasswordForStoringInConfigFile(txtOriginalPassword.Text, "MD5");

            //check old password
            if (!admin.CheckLogin(DataConvert.GetString(Session["UserName"]), strPwd))
            {
                SetMessage(GetMessage("E00117"));
                txtOriginalPassword.Focus();
                return;
            }

            Johnny.CMS.OM.Access.Administrator model = new Johnny.CMS.OM.Access.Administrator();
            model.AdminId = DataConvert.GetInt32(Session["UserId"]);
            model.Password = FormsAuthentication.HashPasswordForStoringInConfigFile(txtNewPassword.Text, "MD5");
            model.UpdatedTime = System.DateTime.Now;
            model.UpdatedById = DataConvert.GetInt32(Session["UserId"]);
            model.UpdatedByName = DataConvert.GetString(Session["UserName"]);
            admin.ResetPassword(model);
            SetMessage(GetMessage("E00118"));
        }
Example #6
0
        protected void imgbtnLogin_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            this.lblStatus.Text = "";

            string strAdminname = StringHelper.htmlInputText(this.txtAdminName.Text);
            string strAdminPW   = StringHelper.htmlInputText(this.txtPassword.Text);

            if (strAdminname == String.Empty || strAdminPW == String.Empty)
            {
                this.lblStatus.Text = GetMessage("F00101");
                return;
            }

            if (Session["CheckCode"] == null)
            {
                Response.Redirect("login.aspx");
                return;
            }

            //check validation code
            if (Session["CheckCode"].ToString() != txtVerifyCode.Text.Trim())
            {
                this.lblStatus.Text     = GetMessage("F00102");
                this.txtVerifyCode.Text = "";
                this.txtVerifyCode.Focus();
                return;
            }

            Johnny.CMS.BLL.Access.Administrator admin = new Johnny.CMS.BLL.Access.Administrator();
            strAdminPW = FormsAuthentication.HashPasswordForStoringInConfigFile(strAdminPW, "MD5");
            if (admin.CheckLogin(strAdminname, strAdminPW))
            {
                //update login times and login time
                admin.UpdateLoginTimes(strAdminname);
                Session["UserId"]        = admin.GetUserIdByName(strAdminname);
                Session["UserName"]      = strAdminname;
                Session["IsFirstAccess"] = "true";
                Response.Redirect("index.aspx");
            }
            else
            {
                this.txtVerifyCode.Text = "";
                this.lblStatus.Text     = GetMessage("F00103");
            }
        }
Example #7
0
        protected void imgbtnLogin_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            this.lblStatus.Text = "";

            string strAdminname = StringHelper.htmlInputText(this.txtAdminName.Text);
            string strAdminPW = StringHelper.htmlInputText(this.txtPassword.Text);

            if (strAdminname == String.Empty || strAdminPW == String.Empty)
            {
                this.lblStatus.Text = GetMessage("F00101");                 
                return;
            }

            if (Session["CheckCode"] == null)
            {
                Response.Redirect("login.aspx");
                return;
            }

            //check validation code
            if (Session["CheckCode"].ToString() != txtVerifyCode.Text.Trim())
            {
                this.lblStatus.Text = GetMessage("F00102");
                this.txtVerifyCode.Text = "";
                this.txtVerifyCode.Focus();
                return;
            }

            Johnny.CMS.BLL.Access.Administrator admin = new Johnny.CMS.BLL.Access.Administrator();
            strAdminPW = FormsAuthentication.HashPasswordForStoringInConfigFile(strAdminPW, "MD5");
            if (admin.CheckLogin(strAdminname, strAdminPW))
            {
                //update login times and login time
                admin.UpdateLoginTimes(strAdminname);
                Session["UserId"] = admin.GetUserIdByName(strAdminname);
                Session["UserName"] = strAdminname;
                Session["IsFirstAccess"] = "true";
                Response.Redirect("index.aspx");
            }
            else
            {
                this.txtVerifyCode.Text = "";
                this.lblStatus.Text = GetMessage("F00103");
            }
        }
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            foreach (GridViewRow row in myManageGridView.Rows)
            {
                TableCell cell = row.Cells[0];
                Johnny.Controls.Web.CheckBox.CheckBox chkSelect = (Johnny.Controls.Web.CheckBox.CheckBox)cell.FindControl("chkSelect");
                if (chkSelect.Checked)
                {
                    string strId = ((Label)row.FindControl(STR_LABEL_ID)).Text;

                    //delete
                    Johnny.CMS.BLL.Access.Administrator bll = new Johnny.CMS.BLL.Access.Administrator();
                    bll.Delete(DataConvert.GetInt32(strId));
                }
            }

            SetMessage(GetMessage("C00005"));

            //update grid
            getData();
        }
Example #9
0
        protected void btnAdd_Click(object sender, System.EventArgs e)
        {
            SetMessage("");

            //check full name
            if (!CheckInputLength(txtFullName, "E00104", false))
            {
                return;
            }
            //check tel
            if (!CheckInputLength(txtTel, "E00106"))
            {
                return;
            }
            //check email
            if (!CheckInputLength(txtEmail, "E00106"))
            {
                return;
            }

            Johnny.CMS.BLL.Access.Administrator bll   = new Johnny.CMS.BLL.Access.Administrator();
            Johnny.CMS.OM.Access.Administrator  model = new Johnny.CMS.OM.Access.Administrator();

            //update
            model.AdminId  = DataConvert.GetInt32(Session["UserId"]);
            model.FullName = txtFullName.Text;
            model.Gender   = rdbGender0.Checked;
            model.Tel      = txtTel.Text;
            model.Email    = txtEmail.Text;
            //model.BeginTime = DataConvert.GetDateTime(lblBeginTime.Text);
            //model.EndTime = DataConvert.GetDateTime(lblEndTime.Text);
            //model.IsActivated = rdbActivated0.Checked;
            model.UpdatedTime   = System.DateTime.Now;
            model.UpdatedById   = DataConvert.GetInt32(Session["UserId"]);
            model.UpdatedByName = DataConvert.GetString(Session["UserName"]);

            bll.UpdatePersonal(model);
            SetMessage(GetMessage("C00003"));
        }
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            foreach (GridViewRow row in myManageGridView.Rows)
            {
                TableCell cell = row.Cells[0];
                Johnny.Controls.Web.CheckBox.CheckBox chkSelect = (Johnny.Controls.Web.CheckBox.CheckBox)cell.FindControl("chkSelect");
                if (chkSelect.Checked)
                {
                    string strId = ((Label)row.FindControl(STR_LABEL_ID)).Text;

                    //delete
                    Johnny.CMS.BLL.Access.Administrator bll = new Johnny.CMS.BLL.Access.Administrator();
                    bll.Delete(DataConvert.GetInt32(strId));

                }
            }

            SetMessage(GetMessage("C00005"));

            //update grid
            getData();
        }
        protected void btnAdd_Click(object sender, System.EventArgs e)
        {
            SetMessage("");

            //check admin name
            if (!CheckInputEmptyAndLength(txtAdminName, "E00101", "E00102"))
                return;
            //check full name
            if (!CheckInputLength(txtFullName, "E00104", false))
                return;
            //check tel
            if (!CheckInputLength(txtTel, "E00106"))
                return;
            //check email
            if (!CheckInputLength(txtEmail, "E00106"))
                return;
            if (!DataValidation.IsEmail(txtEmail.Text))
            {
                SetMessage(GetMessage("C00010"));
                txtEmail.Focus();
                return;
            }
            ////check date
            if (!DataValidation.IsDate(txtValidFrom.Text))
            {
                SetMessage(GetMessage("C00009"));
                txtValidFrom.Focus();
                return;
            }

            if (!DataValidation.IsDate(txtValidTo.Text))
            {
                SetMessage(GetMessage("C00009"));
                txtValidTo.Focus();
                return;
            }

            Johnny.CMS.BLL.Access.Administrator bll = new Johnny.CMS.BLL.Access.Administrator();
            Johnny.CMS.OM.Access.Administrator model = new Johnny.CMS.OM.Access.Administrator();

            if (Request.QueryString["action"] == "modify")
            {
                //update
                model.AdminId = Convert.ToInt32(Request.QueryString["id"]);
                model.AdminName = txtAdminName.Text;
                model.FullName = txtFullName.Text;
                model.Gender = rdbGender0.Checked;
                model.Tel = txtTel.Text;
                model.Email = txtEmail.Text;
                model.ValidFrom = DataConvert.GetDateTime(txtValidFrom.Text);
                model.ValidTo = DataConvert.GetDateTime(txtValidTo.Text);
                model.IsActivated = rdbActivated0.Checked;
                model.UpdatedTime = System.DateTime.Now;
                model.UpdatedById = DataConvert.GetInt32(Session["UserId"]);
                model.UpdatedByName = DataConvert.GetString(Session["UserName"]);

                bll.Update(model);
                SetMessage(GetMessage("C00003"));
            }
            else
            {
                //insert
                model.AdminName = txtAdminName.Text;
                model.Password = "******";
                model.FullName = txtFullName.Text;
                model.Gender = rdbGender0.Checked;
                model.Tel = txtTel.Text;
                model.Email = txtEmail.Text;
                model.ValidFrom = DataConvert.GetDateTime(txtValidFrom.Text);
                model.ValidTo = DataConvert.GetDateTime(txtValidTo.Text);
                model.IsActivated = rdbActivated0.Checked;
                model.LoginTimes = 0;
                model.CreatedTime = System.DateTime.Now;
                model.CreatedById = DataConvert.GetInt32(Session["UserId"]);
                model.CreatedByName = DataConvert.GetString(Session["UserName"]);
                model.UpdatedTime = System.DateTime.Now;
                model.UpdatedById = DataConvert.GetInt32(Session["UserId"]);
                model.UpdatedByName = DataConvert.GetString(Session["UserName"]);

                if (bll.Add(model) > 0)
                {
                    SetMessage(GetMessage("C00001"));
                    txtAdminName.Text = "";
                    txtFullName.Text = "";
                    txtTel.Text = "";
                    txtEmail.Text = "";
                    txtValidFrom.Text = "";
                    txtValidTo.Text = "";
                    lblLoginTimes.Text = "";
                    lblCreatedTime.Text = "";
                    lblCreatedByName.Text = "";
                    lblUpdatedTime.Text = "";
                    lblUpdatedByName.Text = "";
                }
                else
                    SetMessage(GetMessage("C00002"));
            }
        }
 protected void btnResetPassword_Click(object sender, System.EventArgs e)
 {            
     Johnny.CMS.BLL.Access.Administrator bll = new Johnny.CMS.BLL.Access.Administrator();
     Johnny.CMS.OM.Access.Administrator model = new Johnny.CMS.OM.Access.Administrator();
     model.AdminId = Convert.ToInt32(Request.QueryString["id"]);
     model.Password = FormsAuthentication.HashPasswordForStoringInConfigFile(Johnny.CMS.WebUI.utility.ConfigInfo.DefaultPassword, "MD5");
     model.UpdatedTime = System.DateTime.Now;
     model.UpdatedById = DataConvert.GetInt32(Session["UserId"]);
     model.UpdatedByName = DataConvert.GetString(Session["UserName"]);
     bll.ResetPassword(model);
     SetMessage(GetMessage("E00119", Johnny.CMS.WebUI.utility.ConfigInfo.DefaultPassword));
 }
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);            

            if (!this.IsPostBack)
            {
                litPageTitle.Text = GetLabelText("Administrator_Title");
                litAdminName.Text = GetLabelText("Administrator_AdminName");
                txtAdminName.ToolTip = GetLabelText("Administrator_AdminName");
                litFullName.Text = GetLabelText("Administrator_FullName");
                txtFullName.ToolTip = GetLabelText("Administrator_FullName");
                litGender.Text = GetLabelText("Administrator_Gender");
                rdbGender0.Text = GetLabelText("Common_Male");
                rdbGender1.Text = GetLabelText("Common_Female");
                litRdbTip.Text = GetLabelText("Administrator_Gender");
                litTel.Text = GetLabelText("Administrator_Tel");
                txtTel.ToolTip = GetLabelText("Administrator_Tel");
                litEmail.Text = GetLabelText("Administrator_Email");
                txtEmail.ToolTip = GetLabelText("Administrator_Email");
                litValidFrom.Text = GetLabelText("Administrator_ValidFrom");
                txtValidFrom.ToolTip = GetLabelText("Administrator_ValidFrom");
                litValidTo.Text = GetLabelText("Administrator_ValidTo");
                txtValidTo.ToolTip = GetLabelText("Administrator_ValidTo");
                litActivated.Text = GetLabelText("Administrator_IsActivated");
                rdbActivated0.Text = GetLabelText("Common_Yes");
                rdbActivated1.Text = GetLabelText("Common_No");
                litRdbActivatedTip.Text = GetLabelText("Administrator_IsActivated");
                litLoginTimes.Text = GetLabelText("Administrator_LoginTimes");
                litCreatedTime.Text = GetLabelText("Common_CreatedTime");
                litCreatedByName.Text = GetLabelText("Common_CreatedByName");
                litUpdatedTime.Text = GetLabelText("Common_UpdatedTime");
                litUpdatedByName.Text = GetLabelText("Common_UpdatedByName");
                
                if (Request.QueryString["action"] == "modify")
                {
                    //get UserId
                    int UserId = Convert.ToInt32(Request.QueryString["id"]);

                    Johnny.CMS.BLL.Access.Administrator bll = new Johnny.CMS.BLL.Access.Administrator();
                    Johnny.CMS.OM.Access.Administrator model = new Johnny.CMS.OM.Access.Administrator();
                    model = bll.GetModel(UserId);

                    txtAdminName.Text = model.AdminName;
                    txtFullName.Text = model.FullName;
                    if (model.Gender)
                        rdbGender0.Checked = true;
                    else
                        rdbGender1.Checked = true;
                    txtTel.Text = model.Tel;
                    txtEmail.Text = model.Email;
                    txtValidFrom.Text = DataConvert.GetShortDateString(model.ValidFrom);
                    txtValidTo.Text = DataConvert.GetShortDateString(model.ValidTo);
                    if (model.IsActivated)
                        rdbActivated0.Checked = true;
                    else
                        rdbActivated1.Checked = true;
                    lblLoginTimes.Text = DataConvert.GetString(model.LoginTimes);
                    lblCreatedTime.Text = DataConvert.GetLongDateString(model.CreatedTime);
                    lblCreatedByName.Text = model.CreatedByName;
                    lblUpdatedTime.Text = DataConvert.GetLongDateString(model.UpdatedTime);
                    lblUpdatedByName.Text = model.UpdatedByName;

                    btnAdd.ButtonType = Johnny.Controls.Web.Button.Button.EnumButtonType.Save;
                    //btnAdd.Text = CONST_BUTTONTEXT_SAVE;
                }
                else
                {
                    rdbGender0.Checked = true;
                    rdbActivated0.Checked = true;
                }
            }
        }
 public override void getData()
 {
     Johnny.CMS.BLL.Access.Administrator bll = new Johnny.CMS.BLL.Access.Administrator();
     myManageGridView.DataSource = bll.GetList();
     myManageGridView.DataBind();
 }
Example #15
0
        protected void btnAdd_Click(object sender, System.EventArgs e)
        {
            SetMessage("");

            //check admin name
            if (!CheckInputEmptyAndLength(txtAdminName, "E00101", "E00102"))
            {
                return;
            }
            //check full name
            if (!CheckInputLength(txtFullName, "E00104", false))
            {
                return;
            }
            //check tel
            if (!CheckInputLength(txtTel, "E00106"))
            {
                return;
            }
            //check email
            if (!CheckInputLength(txtEmail, "E00106"))
            {
                return;
            }
            if (!DataValidation.IsEmail(txtEmail.Text))
            {
                SetMessage(GetMessage("C00010"));
                txtEmail.Focus();
                return;
            }
            ////check date
            if (!DataValidation.IsDate(txtValidFrom.Text))
            {
                SetMessage(GetMessage("C00009"));
                txtValidFrom.Focus();
                return;
            }

            if (!DataValidation.IsDate(txtValidTo.Text))
            {
                SetMessage(GetMessage("C00009"));
                txtValidTo.Focus();
                return;
            }

            Johnny.CMS.BLL.Access.Administrator bll   = new Johnny.CMS.BLL.Access.Administrator();
            Johnny.CMS.OM.Access.Administrator  model = new Johnny.CMS.OM.Access.Administrator();

            if (Request.QueryString["action"] == "modify")
            {
                //update
                model.AdminId       = Convert.ToInt32(Request.QueryString["id"]);
                model.AdminName     = txtAdminName.Text;
                model.FullName      = txtFullName.Text;
                model.Gender        = rdbGender0.Checked;
                model.Tel           = txtTel.Text;
                model.Email         = txtEmail.Text;
                model.ValidFrom     = DataConvert.GetDateTime(txtValidFrom.Text);
                model.ValidTo       = DataConvert.GetDateTime(txtValidTo.Text);
                model.IsActivated   = rdbActivated0.Checked;
                model.UpdatedTime   = System.DateTime.Now;
                model.UpdatedById   = DataConvert.GetInt32(Session["UserId"]);
                model.UpdatedByName = DataConvert.GetString(Session["UserName"]);

                bll.Update(model);
                SetMessage(GetMessage("C00003"));
            }
            else
            {
                //insert
                model.AdminName     = txtAdminName.Text;
                model.Password      = "******";
                model.FullName      = txtFullName.Text;
                model.Gender        = rdbGender0.Checked;
                model.Tel           = txtTel.Text;
                model.Email         = txtEmail.Text;
                model.ValidFrom     = DataConvert.GetDateTime(txtValidFrom.Text);
                model.ValidTo       = DataConvert.GetDateTime(txtValidTo.Text);
                model.IsActivated   = rdbActivated0.Checked;
                model.LoginTimes    = 0;
                model.CreatedTime   = System.DateTime.Now;
                model.CreatedById   = DataConvert.GetInt32(Session["UserId"]);
                model.CreatedByName = DataConvert.GetString(Session["UserName"]);
                model.UpdatedTime   = System.DateTime.Now;
                model.UpdatedById   = DataConvert.GetInt32(Session["UserId"]);
                model.UpdatedByName = DataConvert.GetString(Session["UserName"]);

                if (bll.Add(model) > 0)
                {
                    SetMessage(GetMessage("C00001"));
                    txtAdminName.Text     = "";
                    txtFullName.Text      = "";
                    txtTel.Text           = "";
                    txtEmail.Text         = "";
                    txtValidFrom.Text     = "";
                    txtValidTo.Text       = "";
                    lblLoginTimes.Text    = "";
                    lblCreatedTime.Text   = "";
                    lblCreatedByName.Text = "";
                    lblUpdatedTime.Text   = "";
                    lblUpdatedByName.Text = "";
                }
                else
                {
                    SetMessage(GetMessage("C00002"));
                }
            }
        }
Example #16
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            if (!this.IsPostBack)
            {
                litPageTitle.Text       = GetLabelText("Administrator_Title");
                litAdminName.Text       = GetLabelText("Administrator_AdminName");
                txtAdminName.ToolTip    = GetLabelText("Administrator_AdminName");
                litFullName.Text        = GetLabelText("Administrator_FullName");
                txtFullName.ToolTip     = GetLabelText("Administrator_FullName");
                litGender.Text          = GetLabelText("Administrator_Gender");
                rdbGender0.Text         = GetLabelText("Common_Male");
                rdbGender1.Text         = GetLabelText("Common_Female");
                litRdbTip.Text          = GetLabelText("Administrator_Gender");
                litTel.Text             = GetLabelText("Administrator_Tel");
                txtTel.ToolTip          = GetLabelText("Administrator_Tel");
                litEmail.Text           = GetLabelText("Administrator_Email");
                txtEmail.ToolTip        = GetLabelText("Administrator_Email");
                litValidFrom.Text       = GetLabelText("Administrator_ValidFrom");
                txtValidFrom.ToolTip    = GetLabelText("Administrator_ValidFrom");
                litValidTo.Text         = GetLabelText("Administrator_ValidTo");
                txtValidTo.ToolTip      = GetLabelText("Administrator_ValidTo");
                litActivated.Text       = GetLabelText("Administrator_IsActivated");
                rdbActivated0.Text      = GetLabelText("Common_Yes");
                rdbActivated1.Text      = GetLabelText("Common_No");
                litRdbActivatedTip.Text = GetLabelText("Administrator_IsActivated");
                litLoginTimes.Text      = GetLabelText("Administrator_LoginTimes");
                litCreatedTime.Text     = GetLabelText("Common_CreatedTime");
                litCreatedByName.Text   = GetLabelText("Common_CreatedByName");
                litUpdatedTime.Text     = GetLabelText("Common_UpdatedTime");
                litUpdatedByName.Text   = GetLabelText("Common_UpdatedByName");

                if (Request.QueryString["action"] == "modify")
                {
                    //get UserId
                    int UserId = Convert.ToInt32(Request.QueryString["id"]);

                    Johnny.CMS.BLL.Access.Administrator bll   = new Johnny.CMS.BLL.Access.Administrator();
                    Johnny.CMS.OM.Access.Administrator  model = new Johnny.CMS.OM.Access.Administrator();
                    model = bll.GetModel(UserId);

                    txtAdminName.Text = model.AdminName;
                    txtFullName.Text  = model.FullName;
                    if (model.Gender)
                    {
                        rdbGender0.Checked = true;
                    }
                    else
                    {
                        rdbGender1.Checked = true;
                    }
                    txtTel.Text       = model.Tel;
                    txtEmail.Text     = model.Email;
                    txtValidFrom.Text = DataConvert.GetShortDateString(model.ValidFrom);
                    txtValidTo.Text   = DataConvert.GetShortDateString(model.ValidTo);
                    if (model.IsActivated)
                    {
                        rdbActivated0.Checked = true;
                    }
                    else
                    {
                        rdbActivated1.Checked = true;
                    }
                    lblLoginTimes.Text    = DataConvert.GetString(model.LoginTimes);
                    lblCreatedTime.Text   = DataConvert.GetLongDateString(model.CreatedTime);
                    lblCreatedByName.Text = model.CreatedByName;
                    lblUpdatedTime.Text   = DataConvert.GetLongDateString(model.UpdatedTime);
                    lblUpdatedByName.Text = model.UpdatedByName;

                    btnAdd.ButtonType = Johnny.Controls.Web.Button.Button.EnumButtonType.Save;
                    //btnAdd.Text = CONST_BUTTONTEXT_SAVE;
                }
                else
                {
                    rdbGender0.Checked    = true;
                    rdbActivated0.Checked = true;
                }
            }
        }
Example #17
0
        protected void btnAdd_Click(object sender, System.EventArgs e)
        {
            SetMessage("");

            //check full name
            if (!CheckInputLength(txtFullName, "E00104", false))
                return;
            //check tel
            if (!CheckInputLength(txtTel, "E00106"))
                return;
            //check email
            if (!CheckInputLength(txtEmail, "E00106"))
                return;

            Johnny.CMS.BLL.Access.Administrator bll = new Johnny.CMS.BLL.Access.Administrator();
            Johnny.CMS.OM.Access.Administrator model = new Johnny.CMS.OM.Access.Administrator();

            //update
            model.AdminId = DataConvert.GetInt32(Session["UserId"]);
            model.FullName = txtFullName.Text;
            model.Gender = rdbGender0.Checked;
            model.Tel = txtTel.Text;
            model.Email = txtEmail.Text;
            //model.BeginTime = DataConvert.GetDateTime(lblBeginTime.Text);
            //model.EndTime = DataConvert.GetDateTime(lblEndTime.Text);
            //model.IsActivated = rdbActivated0.Checked;
            model.UpdatedTime = System.DateTime.Now;
            model.UpdatedById = DataConvert.GetInt32(Session["UserId"]);
            model.UpdatedByName = DataConvert.GetString(Session["UserName"]);

            bll.UpdatePersonal(model);
            SetMessage(GetMessage("C00003"));          
        }
 public override void getData()
 {
     Johnny.CMS.BLL.Access.Administrator bll = new Johnny.CMS.BLL.Access.Administrator();
     myManageGridView.DataSource = bll.GetList();
     myManageGridView.DataBind();
 }