コード例 #1
0
ファイル: Login.aspx.cs プロジェクト: menasbeshay/ivalley-svn
    protected void Login1_LoggedIn(object sender, EventArgs e)
    {
        //MHOCommon.ClearCurrentSession();
        Session.Remove("Error");
        aspnet_Users user = new aspnet_Users();
        user.GetUserByName(Login1.UserName);

        // Validate User IP and Status
        // Check if the logged user is valid under his current IP
        OrgUser objOrgUser = new OrgUser();
        if (!objOrgUser.ValidateUserIPStatus(user.UserId, MHOCommon.CurrentOrgIP))
        {
            if (MHOCommon.EnableSmartLogin == 1)
            {
                FormsAuthentication.SignOut();
                Session["Error"] = true;
            }
        }

        OrgUser orgUser = new OrgUser();
        orgUser.LoadByPrimaryKey(user.UserId);

        if (orgUser.Status)
        {

            if (Roles.IsUserInRole(Login1.UserName, "SuperAdmin"))
            {
                Response.Redirect("~/Admin/AdminHomePage.aspx");
            }
            else if ( Roles.IsUserInRole(Login1.UserName, "SubAdmin"))
            {
                Response.Redirect("~/Admin/SubAdminHome.aspx");
            }
            else if (Roles.IsUserInRole(Login1.UserName, "Admin"))
            {
                Response.Redirect("~/Admin/AdminGovHome.aspx");
            }
            else
            {
                Response.Redirect("Default.aspx");
            }
        }
        else
        {
            FormsAuthentication.SignOut();
            Session["Error"] = true;

        }
    }
コード例 #2
0
 protected void btnEdit_Click(object sender, EventArgs e)
 {
     try
     {
         OrgUser orgUser = new MHO.BLL.OrgUser();
         orgUser.Update(UserId.Value, txtFirstName.Text, txtFatherName.Text, txtNationalId.Text, Convert.ToInt32(drpGov.SelectedValue), Convert.ToInt32(drpCivil.SelectedValue), Convert.ToInt32(drpHealthOffice.SelectedValue),
                 txtPhoneNo.Text, txtqulification.Text, drpStatus.SelectedValue == "1" ? true : false);
         orgUser = new MHO.BLL.OrgUser();
         orgUser.UpdateUserDetails(UserId.Value, new Guid(dropRole.SelectedValue), UserName.Text, Email.Text);
         ErrorMessage.Text = "تم التعديل بنجاح";
     }
     catch (Exception ex)
     {
         //ErrorMessage.Text = ex.ToString();
         ErrorMessage.Text = "لقد ادخلت رقم قومى موجود من قبل او هناك خطأ فى البيانات";
     }
 }
コード例 #3
0
    private void setCurrentUserInfo()
    {
        try
        {
            OrgUser Current = new OrgUser();
            if (MHOCommon.CurrentLoggedUserID != null && MHOCommon.CurrentLoggedUserID != Guid.Empty)
            {
                Current.LoadByPrimaryKey(MHOCommon.CurrentLoggedUserID);
                uiTextBoxNotifierName.Text = Current.FirstName.Trim() + " " + Current.FatherName.Trim();

                if (Current.GovId != 0)
                {
                    uiDropDownListGov.SelectedValue = Current.GovId.ToString();
                    uiDropDownListGov.Enabled = false;
                    uiDropDownListMachineGov.SelectedValue = Current.GovId.ToString();
                    uiDropDownListMachineGov.Enabled = false;

                    /*********************/
                    if (uiDropDownListGov.SelectedIndex != 0)
                    {
                        CIVIL_OFFICE pol = new CIVIL_OFFICE();
                        pol.Where.FK_GOVCD.Value = short.Parse(uiDropDownListGov.SelectedValue);
                        pol.Where.FK_GOVCD.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
                        pol.Query.AddOrderBy(CIVIL_OFFICE.ColumnNames.DESCR, MyGeneration.dOOdads.WhereParameter.Dir.ASC);
                        pol.Query.Load();
                        uiDropDownListCivil.DataSource = pol.DefaultView;
                        uiDropDownListCivil.DataTextField = POLICE_STATION.ColumnNames.DESCR;
                        uiDropDownListCivil.DataValueField = POLICE_STATION.ColumnNames.CD;
                        uiDropDownListCivil.DataBind();
                        uiDropDownListCivil.Items.Insert(0, new ListItem("---", "0"));
                        uiDropDownListCivil.SelectedIndex = 0;
                    }

                    if (uiDropDownListMachineGov.SelectedIndex != 0)
                    {
                        CIVIL_OFFICE pol = new CIVIL_OFFICE();
                        pol.Where.FK_GOVCD.Value = short.Parse(uiDropDownListMachineGov.SelectedValue);
                        pol.Where.FK_GOVCD.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
                        pol.Query.AddOrderBy(CIVIL_OFFICE.ColumnNames.DESCR, MyGeneration.dOOdads.WhereParameter.Dir.ASC);
                        pol.Query.Load();
                        uiDropDownListMachineCivil.DataSource = pol.DefaultView;
                        uiDropDownListMachineCivil.DataTextField = POLICE_STATION.ColumnNames.DESCR;
                        uiDropDownListMachineCivil.DataValueField = POLICE_STATION.ColumnNames.CD;
                        uiDropDownListMachineCivil.DataBind();
                        uiDropDownListMachineCivil.Items.Insert(0, new ListItem("---", "0"));
                        uiDropDownListMachineCivil.SelectedIndex = 0;
                    }

                    if (Current.CivilId != 0)
                    {
                        uiDropDownListCivil.SelectedValue = Current.CivilId.ToString();
                        uiDropDownListCivil.Enabled = false;
                        uiDropDownListMachineCivil.SelectedValue = Current.CivilId.ToString();
                        uiDropDownListMachineCivil.Enabled = false;

                        if (uiDropDownListCivil.SelectedIndex != 0 && uiDropDownListGov.SelectedIndex != 0)
                        {
                            health_office obj = new health_office();
                            uiDropDownListHealthOffice.DataSource = obj.GetHealthOfficeDetails(short.Parse(uiDropDownListGov.SelectedValue), short.Parse(uiDropDownListCivil.SelectedValue)).DefaultView;
                            uiDropDownListHealthOffice.DataTextField = health_office.ColumnNames.HEALTHDESCR;
                            uiDropDownListHealthOffice.DataValueField = health_office.ColumnNames.HEALTHCD;
                            uiDropDownListHealthOffice.DataBind();
                            uiDropDownListHealthOffice.Items.Insert(0, new ListItem("---", "0"));
                            uiDropDownListHealthOffice.SelectedIndex = 0;
                        }

                        if (uiDropDownListMachineGov.SelectedIndex != 0 && uiDropDownListMachineCivil.SelectedIndex != 0)
                        {
                            health_office obj = new health_office();
                            uiDropDownListMachineHealthOffice.DataSource = obj.GetHealthOfficeDetails(short.Parse(uiDropDownListMachineGov.SelectedValue), short.Parse(uiDropDownListMachineCivil.SelectedValue)).DefaultView;
                            uiDropDownListMachineHealthOffice.DataTextField = health_office.ColumnNames.HEALTHDESCR;
                            uiDropDownListMachineHealthOffice.DataValueField = health_office.ColumnNames.HEALTHCD;
                            uiDropDownListMachineHealthOffice.DataBind();
                            uiDropDownListMachineHealthOffice.Items.Insert(0, new ListItem("---", "0"));
                            uiDropDownListMachineHealthOffice.SelectedIndex = 0;
                        }
                    }
                }
                /************************/
            }
        }
        catch (Exception)
        {
            // gives error when log out
        }
    }
コード例 #4
0
 private void LoadGridData()
 {
     OrgUser user = new OrgUser();
     grduser.DataSource = user.GetUserDetails(new Guid(dropRole.SelectedValue), Convert.ToInt32(drpGov.SelectedValue), Convert.ToInt32(drpCivil.SelectedValue), Convert.ToInt32(drpHealthOffice.SelectedValue),txtNationalID.Text);
     grduser.DataBind();
 }
コード例 #5
0
    protected void lnkDel_Click(object sender, EventArgs e)
    {
        try
        {
            Button delbtn = (Button)sender;
            Guid userId = new Guid(delbtn.CommandArgument);

            OrgUser orguser = new OrgUser();
            orguser.DeleteUser(userId);
            MembershipUser user = Membership.GetUser(userId);
            Membership.DeleteUser(user.UserName);

            LoadGridData();
        }
        catch (Exception ex)
        {
            lblMsg.Visible = true;
            lblMsg.Text = "توجد مشكلة في الحذف";
        }
    }
コード例 #6
0
    protected void CreateUserWizard1_CreatingUser(object sender, LoginCancelEventArgs e)
    {
        OrgUser objUser = new OrgUser();
        objUser.Where.NationalId.Value = ((TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtNationalId")).Text;
        objUser.Where.NationalId.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
        //if (objUser.Query.Load())
        //{
        //    MHOCommon.ShowMessage("لقد ادخلت رقم قومى موجود من قبل ", this.Page);
        //    e.Cancel = true;
        //    return;
        //}

        DropDownList dropRole = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("dropRole");
        if (dropRole.SelectedValue == "Admin")
        {

            if (DropGov.SelectedValue == "-1")
            {
                MHOCommon.ShowMessage("يجب اختيار مديرية صحية", this.Page);
                e.Cancel = true;
            }
            return;
        }

        if (dropRole.SelectedValue == "SubAdmin")
        {

            if (DropGov.SelectedValue == "-1" || DrpCivil.SelectedValue == "-1")
            {
                MHOCommon.ShowMessage("يجب اختيار مديرية صحية /ادارة صحية", this.Page);
                e.Cancel = true;
            }
            return;
        }
        if (dropRole.SelectedValue == "Doctor" || dropRole.SelectedValue == "Writer")
        {

            if (DropGov.SelectedValue == "-1" || DrpCivil.SelectedValue == "-1" || DrpHealthOffice.SelectedValue == "-1")
            {
                MHOCommon.ShowMessage("يجب اختيار مديرية صحية/ ادارة صحية / مكتب صحة", this.Page);
                e.Cancel = true;
            }
            return;
        }
    }
コード例 #7
0
    /// <summary>
    /// 
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
    {
        try
        {

            DropDownList dropOrg = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("droOrg");
            DropDownList dropRole = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("dropRole");
            TextBox txtPhoneNumber = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtPhoneNo");
            TextBox txtQalification = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtqulification");
            DropDownList dropStatus = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("drpStatus");

            OrgUser orgUser = new MHO.BLL.OrgUser();
            aspnet_Users user = new aspnet_Users();
            // string currentUserName = user.UserName;
            user.GetUserByName(((TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("username")).Text);
            orgUser.Insert(user.UserId, FirstName.Text, FatherName.Text, NationalId.Text, Convert.ToInt32(DropGov.SelectedValue), Convert.ToInt32(DrpCivil.SelectedValue), Convert.ToInt32(DrpHealthOffice.SelectedValue),
                txtPhoneNumber.Text, txtQalification.Text, dropStatus.SelectedValue == "1" ? true : false);
            Roles.AddUserToRole(((TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("username")).Text, dropRole.SelectedValue);
            user = null;
            aspnet_Users user1 = new aspnet_Users();
            user1.GetUserByName(Page.User.Identity.Name);
            // CreateUserWizard1.MoveTo(CreateUserWizardStep2);
        }
        catch (Exception ex)
        {
        }
        finally
        {
            Response.Redirect("RegisterUserResult.aspx");
        }
    }