示例#1
0
        protected void CreateUser_Click(object sender, EventArgs e)
        {
            var manager = new UserManager();
            var user    = new ApplicationUser()
            {
                UserName = UserName.Text
            };
            var identiyRole = new IdentityUserRole();

            identiyRole.RoleId = cbRoles.SelectedItem.Value.ToString();
            identiyRole.UserId = user.Id;
            user.Roles.Add(identiyRole);
            IdentityResult result = manager.Create(user, Password.Text);

            if (result.Succeeded)
            {
                var sec = new DentistManager.Domain.Entities.Secretary()
                {
                    SecretaryID = int.Parse(ViewState["SecretaryID"].ToString()), UserID = identiyRole.UserId
                };
                SecertaryRepository secertaryRepository = new SecertaryRepository();
                secertaryRepository.updateSecertaryUserID(sec);


                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Saved sucessfully');window.location ='Secretary.aspx';", true);
            }
            else
            {
                ErrorMessage.Text = result.Errors.FirstOrDefault();
            }
        }
        public int getClinecIDForCurrentSecurtary(string userID)
        {
            string clinecID = getSeassionValue(userID, seassionNamesList.SecurtaryActiveClinec.ToString(), seassionProbertyNamesList.ActiveClinecID.ToString());

            if (clinecID == null)
            {
                SecertaryRepository secertaryRepository = new SecertaryRepository();
                int clinecIDholder = secertaryRepository.getClinecIDByUserID(userID);
                clinecID = clinecIDholder.ToString();
                setSeassionValue(userID, seassionNamesList.SecurtaryActiveClinec.ToString(), seassionProbertyNamesList.ActiveClinecID.ToString(), clinecID);
            }
            return(int.Parse(clinecID));
        }
示例#3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (User.IsInRole("Secretary"))
     {
         SecertaryRepository sec = new SecertaryRepository();
         dsAppoiments.SelectParameters["ClinicID"].DefaultValue = sec.getClinecIDByUserID(User.Identity.GetUserId()).ToString();
     }
     else if (User.IsInRole("Doctor"))
     {
         DoctorRepository doc = new DoctorRepository();
         dsAppoiments.SelectParameters["ClinicID"].DefaultValue = doc.getClinecIDByUserID(User.Identity.GetUserId()).ToString();
     }
     if (!IsPostBack)
     {
         ASPxScheduler1.Start = DateTime.Now.Date;
     }
 }
示例#4
0
        protected void CreateButton_Click(object sender, EventArgs e)
        {
            string key = ASPxGridView.GetDetailRowKeyValue((Control)sender).ToString();

            ViewState["SecretaryID"] = key;
            SecertaryRepository secertaryRepository = new SecertaryRepository();
            string UserID = secertaryRepository.GetUserIDBySecertaryID(int.Parse(key));

            if (UserID == null)
            {
                popup.Left           = 400;
                popup.Top            = 600;
                popup.ResizingMode   = DevExpress.Web.ASPxClasses.ResizingMode.Live;
                popup.ShowOnPageLoad = true;
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('This Secretary Has An Account ');", true);
            }
        }
示例#5
0
        protected void ChangePasswordpopup_Click(object sender, EventArgs e)
        {
            string key = ASPxGridView.GetDetailRowKeyValue((Control)sender).ToString();

            ViewState["SecretaryID"] = key;
            SecertaryRepository secertaryRepository = new SecertaryRepository();
            string UserID = secertaryRepository.GetUserIDBySecertaryID(int.Parse(key));

            ViewState["UserID"] = UserID;
            if (UserID != null)
            {
                lblUserName.Text             = secertaryRepository.getUserNameByUserID(UserID);
                ChangePSpopup.Left           = 400;
                ChangePSpopup.Top            = 600;
                ChangePSpopup.ResizingMode   = DevExpress.Web.ASPxClasses.ResizingMode.Live;
                ChangePSpopup.ShowOnPageLoad = true;
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('This Secretary Don't Have An Account ');", true);
            }
        }