Exemplo n.º 1
0
    //public void BindDrpOrg()
    //{
    //    BLLCollection<Organization_mst> col = new BLLCollection<Organization_mst>();
    //    Organization_mst ObjOrganization = new Organization_mst();
    //    col = ObjOrganization.Get_All();
    //    DrpOrg.DataTextField = "Orgname";
    //    DrpOrg.DataValueField = "orgid";
    //    DrpOrg.DataSource = col;
    //    DrpOrg.DataBind();
    //}

    protected void btnSave_Click(object sender, EventArgs e)
    {
        objOrganization = objOrganization.Get_Organization();
        int FlagStatus, FlagStatus1;
        int userid = Convert.ToInt16(Request.QueryString[0]);

        ObjUserLogin.Userid = userid;
        ObjUserLogin.Roleid = Convert.ToInt16(dropRole.SelectedValue.ToString());
        if (lblAdUser.Text.ToString().Trim() == "Yes")
        {
            ObjUserLogin.ADEnable = true;
        }
        else
        {
            ObjUserLogin.ADEnable = false;
        }
        if (DropEnable.SelectedValue == "1")
        {
            ObjUserLogin.Enable = true;
        }
        else
        {
            ObjUserLogin.Enable = false;
        }
        ObjUserLogin.Orgid         = objOrganization.Orgid;
        ObjUserLogin.Username      = txtUserName.Text.ToString().Trim();
        ObjUserLogin.Password      = txtPassword.Text.ToString().Trim();
        ObjContactInfo.Firstname   = txtFname.Text.ToString().Trim();
        ObjContactInfo.Lastname    = txtLname.Text.ToString().Trim();
        ObjContactInfo.Mobile      = txtMobile.Text.ToString().Trim();
        ObjContactInfo.Landline    = txtLandline.Text.ToString().Trim();
        ObjContactInfo.Empid       = txtEmpId.Text.ToString().Trim();
        ObjContactInfo.Siteid      = Convert.ToInt16(DrpSite.SelectedValue.ToString());
        ObjContactInfo.Deptid      = Convert.ToInt16(DrpDepartment.SelectedValue.ToString());
        ObjContactInfo.Emailid     = txtEmailId.Text.ToString().Trim();
        ObjContactInfo.Description = txtDesc.Text.ToString().Trim();
        ObjContactInfo.Userid      = userid;
        FlagStatus  = ObjUserLogin.Update();
        FlagStatus1 = ObjContactInfo.Update();
        RoleInfo_mst objR   = new RoleInfo_mst();
        int          roleid = Convert.ToInt16(ViewState["Roleid"].ToString());

        objR = objRole.Get_By_id(roleid);

        if (objR.Roleid != 0)
        {
            Roles.RemoveUserFromRole(txtUserName.Text.ToString().Trim(), objR.Rolename);
            Roles.AddUserToRole(txtUserName.Text.ToString().Trim(), dropRole.SelectedItem.Text.ToString().Trim());
        }
        if (FlagStatus == 1 && FlagStatus1 == 1)
        {
            // Redirect to page ViewSite.aspx page after successfully Updation
            Response.Redirect("~/admin/ViewUser.aspx");
        }
        else
        {
            //If Updation is not successfully,Display Error Message
            //lblErrorMsg.Text = Resources.MessageResource.errOccured.ToString().Trim();
        }
    }