protected void loadUserList()
        {
            Dictionary <String, userDetails> allUserDetails = BackEndObjects.MainBusinessEntity.getUserDetailsforMainEntitybyIdDB(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());


            foreach (KeyValuePair <String, userDetails> kvp in allUserDetails)
            {
                BackEndObjects.userDetails userDetObj = kvp.Value;

                ListItem lt1 = new ListItem();
                lt1.Text  = userDetObj.getUserId();
                lt1.Value = userDetObj.getUserId();

                DropDownList_Users.Items.Add(lt1);
                //DropDownList_Users_Add_Members.Items.Add(lt1);
            }

            ListItem emptyItem = new ListItem();

            emptyItem.Text  = "";
            emptyItem.Value = "";

            DropDownList_Users.Items.Add(emptyItem);
            DropDownList_Users.SelectedValue = "";

            //DropDownList_Users_Add_Members.Items.Add(emptyItem);
            //DropDownList_Users_Add_Members.SelectedValue = "";
        }
Ejemplo n.º 2
0
        protected void GridView_Dept_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow && (e.Row.RowState & DataControlRowState.Edit) == DataControlRowState.Edit)
            {
                GridViewRow gVR = e.Row;

                //BackEndObjects.MainBusinessEntity.getUserDetailsforMainEntitybyIdDB(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
                Dictionary <String, userDetails> allUserDetails = (Dictionary <String, userDetails>)Cache[Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()];
                if (allUserDetails == null)
                {
                    allUserDetails = BackEndObjects.MainBusinessEntity.getUserDetailsforMainEntitybyIdDB(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
                    Cache.Insert(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString(), allUserDetails);
                }

                DropDownList DropDown_Users_List = (DropDownList)gVR.Cells[0].FindControl("DropDownList_Dept_Head_Edit");


                foreach (KeyValuePair <String, userDetails> kvp in allUserDetails)
                {
                    BackEndObjects.userDetails userDetObj = kvp.Value;

                    ListItem lt = new ListItem();
                    lt.Text  = userDetObj.getUserId();
                    lt.Value = userDetObj.getUserId();

                    DropDown_Users_List.Items.Add(lt);
                }

                if (!((Label)gVR.Cells[0].FindControl("Label_Head_Edit")).Text.Equals(""))
                {
                    DropDown_Users_List.SelectedValue = ((Label)gVR.Cells[0].FindControl("Label_Head_Edit")).Text;
                }
            }
        }
Ejemplo n.º 3
0
        protected void Button_Submit_Req_Click(object sender, EventArgs e)
        {
            BackEndObjects.userDetails userObj = BackEndObjects.userDetails.getUserDetailsbyIdDB(User.Identity.Name);
            //Combine salt and generate the password
            byte[]        plainTextBytes = System.Text.Encoding.UTF8.GetBytes(TextBox_Pass2.Text + userObj.getSalt());
            HashAlgorithm hashConverter  = new SHA256Managed();

            byte[] hashedByteStream = hashConverter.ComputeHash(plainTextBytes);
            String encryptedAndConvertedPassword = Convert.ToBase64String(hashedByteStream);

            Dictionary <String, String> targetVals = new Dictionary <string, string>();

            targetVals.Add(BackEndObjects.userDetails.USER_DETAILS_COL_PASSWORD, encryptedAndConvertedPassword);

            Dictionary <String, String> whereCls = new Dictionary <string, string>();

            whereCls.Add(BackEndObjects.userDetails.USER_DETAILS_COL_BUSINESS_ID, Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
            whereCls.Add(BackEndObjects.userDetails.USER_DETAILS_COL_USERID, User.Identity.Name);
            try
            {
                BackEndObjects.userDetails.updateUserDetailsDB(targetVals, whereCls, DBConn.Connections.OPERATION_UPDATE);
                Label_Pass_Change_Stat.Visible   = true;
                Label_Pass_Change_Stat.Text      = "Password Changed Successfully";
                Label_Pass_Change_Stat.ForeColor = System.Drawing.Color.Green;
            }
            catch (Exception ex)
            {
                Label_Pass_Change_Stat.Visible   = true;
                Label_Pass_Change_Stat.Text      = "Password Change Failed";
                Label_Pass_Change_Stat.ForeColor = System.Drawing.Color.Red;
            }
        }
Ejemplo n.º 4
0
        protected void GridView_User_List_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow gVR   = GridView_User_List.Rows[e.RowIndex];
            int         index = GridView_User_List.Rows[e.RowIndex].DataItemIndex;

            String userId = ((Label)gVR.Cells[0].FindControl("Label_User_Id")).Text;

            String userName = ((TextBox)gVR.Cells[0].FindControl("TextBox_Name_Edit")).Text;

            BackEndObjects.userDetails userObj = BackEndObjects.userDetails.getUserDetailsbyIdDB(userId);
            //Combine salt and generate the password
            byte[]        plainTextBytes = System.Text.Encoding.UTF8.GetBytes(((TextBox)gVR.Cells[0].FindControl("TextBox_Password_Edit")).Text + userObj.getSalt());
            HashAlgorithm hashConverter  = new SHA256Managed();

            byte[] hashedByteStream = hashConverter.ComputeHash(plainTextBytes);
            String encryptedAndConvertedPassword = Convert.ToBase64String(hashedByteStream);

            String passWord  = encryptedAndConvertedPassword;
            String emailId   = ((TextBox)gVR.Cells[0].FindControl("TextBox_Email_Id_Edit")).Text;
            String contactNo = ((TextBox)gVR.Cells[0].FindControl("TextBox_Contact_No_Edit")).Text;
            String reportsTo = ((DropDownList)gVR.Cells[0].FindControl("DropDownList_Reports_To")).SelectedValue;

            Dictionary <String, String> whereCls  = new Dictionary <string, string>();
            Dictionary <String, String> targetCls = new Dictionary <string, string>();

            whereCls.Add(BackEndObjects.userDetails.USER_DETAILS_COL_BUSINESS_ID, Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
            whereCls.Add(BackEndObjects.userDetails.USER_DETAILS_COL_USERID, userId);

            targetCls.Add(BackEndObjects.userDetails.USER_DETAILS_COL_PASSWORD, passWord);
            targetCls.Add(BackEndObjects.userDetails.USER_DETAILS_COL_NAME, userName);
            targetCls.Add(BackEndObjects.userDetails.USER_DETAILS_COL_EMAIL_ID, emailId);
            targetCls.Add(BackEndObjects.userDetails.USER_DETAILS_COL_CONTACT_NO, contactNo);
            targetCls.Add(BackEndObjects.userDetails.USER_DETAILS_COL_REPORTS_TO, reportsTo);

            try
            {
                BackEndObjects.userDetails.updateUserDetailsDB(targetCls, whereCls, DBConn.Connections.OPERATION_UPDATE);
                DataTable dt = (DataTable)Session[SessionFactory.ADMIN_PREF_USER_MGMT_BASIC_USER_DET_GRID];

                dt.Rows[index]["UserName"]  = userName;
                dt.Rows[index]["Password"]  = ((TextBox)gVR.Cells[0].FindControl("TextBox_Password_Edit")).Text;
                dt.Rows[index]["EmailId"]   = emailId;
                dt.Rows[index]["ContactNo"] = contactNo;
                dt.Rows[index]["reportsTo"] = reportsTo;

                GridView_User_List.EditIndex  = -1;
                GridView_User_List.DataSource = dt;
                GridView_User_List.DataBind();
                Session[SessionFactory.ADMIN_PREF_USER_MGMT_BASIC_USER_DET_GRID] = dt;
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 5
0
        protected void LoginButton_Click(object sender, EventArgs e)
        {
            // BackEndObjects.userDetails uDObj = new BackEndObjects.userDetails();

            BackEndObjects.userDetails userObj = BackEndObjects.userDetails.getUserDetailsbyIdDB(UserName.Text);
            //Combine salt and generate the password
            byte[]        plainTextBytes = System.Text.Encoding.UTF8.GetBytes(Password.Text + userObj.getSalt());
            HashAlgorithm hashConverter  = new SHA256Managed();

            byte[] hashedByteStream = hashConverter.ComputeHash(plainTextBytes);
            String encryptedAndConvertedPassword = Convert.ToBase64String(hashedByteStream);


            if (userObj.authenticateUserDB(UserName.Text, encryptedAndConvertedPassword))
            {
                Session[SessionFactory.LOGGED_IN_USER_ID_STRING] = UserName.Text.Trim();
                Session[SessionFactory.LOGGED_IN_USER_THEME]     = userObj.getTheme() == null || userObj.getTheme().Equals("") ? "ThemeBlue" : userObj.getTheme();
                //Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING] = BackEndObjects.userDetails.getUserDetailsbyIdDB(UserName.Text).getMainEntityId();
                Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING] = userObj.getMainEntityId();
                Session[SessionFactory.ACCESSLIST_FOR_USER]            = new ActionLibrary.LoginActions().
                                                                         retrieveAccessList(UserName.Text.Trim(), Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
                Session[SessionFactory.CURRENCY_LIST] = BackEndObjects.Currency.getAllCurrencyDetailsDB();
                Session[SessionFactory.MAIN_BUSINESS_ENTITY_DEFAULT_CURRENCY] = AddressDetails.
                                                                                getAddressforMainBusinessEntitybyIdDB(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()).getBaseCurrencyId();

                ArrayList contactObjList = Contacts.
                                           getAllContactsbyEntityIdDB(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
                Dictionary <String, String> existingContactDict = new Dictionary <string, string>();
                for (int i = 0; i < contactObjList.Count; i++)
                {
                    String contactName  = ((Contacts)contactObjList[i]).getContactName();
                    String contactEntId = ((Contacts)contactObjList[i]).getContactEntityId();

                    if (!existingContactDict.ContainsKey(contactName))
                    {
                        existingContactDict.Add(contactName, contactEntId);
                    }
                }
                Session[SessionFactory.EXISTING_CONTACT_DICTIONARY] = existingContactDict;

                FormsAuthentication.RedirectFromLoginPage(UserName.Text, RememberMe.Checked);
            }
            else
            {
                FailureText.Visible = true;
            }
        }
Ejemplo n.º 6
0
        protected void fillBasicUserDetailGrid(String userFilterText)
        {
            Dictionary <String, userDetails> userDetDict = BackEndObjects.MainBusinessEntity.
                                                           getUserDetailsforMainEntitybyIdDB(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());

            DataTable dt = new DataTable();

            dt.Columns.Add("UserName");
            dt.Columns.Add("UserId");
            dt.Columns.Add("Password");
            dt.Columns.Add("EmailId");
            dt.Columns.Add("ContactNo");
            dt.Columns.Add("AccessDet");
            dt.Columns.Add("reportsTo");

            int counter = 0;

            foreach (KeyValuePair <String, userDetails> kvp in userDetDict)
            {
                BackEndObjects.userDetails userObj = kvp.Value;

                bool considerRecord = (userFilterText != null && !userFilterText.Equals(""))? (userObj.getUserId().IndexOf(userFilterText.Trim(), StringComparison.InvariantCultureIgnoreCase) >= 0?true:false):true;

                if (considerRecord)
                {
                    dt.Rows.Add();

                    dt.Rows[counter]["UserName"]  = userObj.getName();
                    dt.Rows[counter]["UserId"]    = userObj.getUserId();
                    dt.Rows[counter]["Password"]  = "";
                    dt.Rows[counter]["EmailId"]   = userObj.getEmailId();
                    dt.Rows[counter]["ContactNo"] = userObj.getContactNo();
                    dt.Rows[counter]["AccessDet"] = userObj.getPrivilege();
                    dt.Rows[counter]["reportsTo"] = userObj.getReportsTo();
                    counter++;
                }
            }

            GridView_User_List.DataSource = dt;
            GridView_User_List.DataBind();
            GridView_User_List.SelectedIndex = -1;
            Session[SessionFactory.ADMIN_PREF_USER_MGMT_BASIC_USER_DET_GRID] = dt;
        }
Ejemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING] == null)
                {
                    Response.Redirect("Login.aspx");
                }
                else
                {
                    ((HtmlGenericControl)(Master.FindControl("UserPref"))).Attributes.Add("class", "active");

                    String entId = Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString();
                    Dictionary <String, bool>     accessList  = (Dictionary <String, bool>)Session[SessionFactory.ACCESSLIST_FOR_USER];
                    Dictionary <String, Currency> allCurrList = (Dictionary <String, Currency>)Session[SessionFactory.CURRENCY_LIST];
                    String defaultCurr = Session[SessionFactory.MAIN_BUSINESS_ENTITY_DEFAULT_CURRENCY].ToString();
                    Dictionary <String, String> allExistingContacts = (Dictionary <String, String>)Session[SessionFactory.EXISTING_CONTACT_DICTIONARY];
                    String theme = Session[SessionFactory.LOGGED_IN_USER_THEME].ToString();

                    Session.RemoveAll();
                    Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING] = entId;
                    Session[SessionFactory.LOGGED_IN_USER_ID_STRING]       = User.Identity.Name;
                    Session[SessionFactory.ACCESSLIST_FOR_USER]            = accessList;
                    Session[SessionFactory.CURRENCY_LIST] = allCurrList;
                    Session[SessionFactory.MAIN_BUSINESS_ENTITY_DEFAULT_CURRENCY] = defaultCurr;
                    Session[SessionFactory.EXISTING_CONTACT_DICTIONARY]           = allExistingContacts;
                    Session[SessionFactory.LOGGED_IN_USER_THEME] = theme;

                    //((Menu)Master.FindControl("Menu1")).Items[7].Selected = true;
                    TextBox_Pass1.Text = "";
                    TextBox_Pass2.Text = "";
                    BackEndObjects.userDetails uDObj = populatePersonalData();
                    loadThemes(uDObj);
                    populateChainData(uDObj);
                    populateLogo();
                }
            }
        }
Ejemplo n.º 8
0
        protected void Button_Add_To_Dept_Click(object sender, EventArgs e)
        {
            Dictionary <String, String> existingIdListForThisDept = (Dictionary <String, String>)Cache["DeptMembersList"];

            existingIdListForThisDept = (existingIdListForThisDept == null ? new Dictionary <String, String>() : existingIdListForThisDept);

            BackEndObjects.userDetails userObj = userDetails.getUserDetailsbyIdDB(DropDownList_Users_Add_Members.SelectedValue, Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
            if (userObj.getDeptId() != null && !userObj.getDeptId().Equals(""))
            {
                String deptName = BackEndObjects.DeptDetails.
                                  getDeptDetailsForEntIdAndDeptIdDB(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString(), userObj.getDeptId()).getDeptName();

                Label_Add_To_Dept_Status.Visible   = true;
                Label_Add_To_Dept_Status.Text      = "The user already part of " + deptName;
                Label_Add_To_Dept_Status.ForeColor = System.Drawing.Color.Red;
            }
            else if (existingIdListForThisDept.ContainsKey(DropDownList_Users_Add_Members.SelectedValue))
            {
                Label_Add_To_Dept_Status.Visible   = true;
                Label_Add_To_Dept_Status.Text      = "User already in the list below";
                Label_Add_To_Dept_Status.ForeColor = System.Drawing.Color.Red;
            }
            else
            {
                Dictionary <String, String> whereCls   = new Dictionary <string, string>();
                Dictionary <String, String> targetVals = new Dictionary <string, string>();
                whereCls.Add(BackEndObjects.userDetails.USER_DETAILS_COL_BUSINESS_ID, Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
                whereCls.Add(BackEndObjects.userDetails.USER_DETAILS_COL_USERID, userObj.getUserId());

                targetVals.Add(BackEndObjects.userDetails.USER_DETAILS_COL_DEPT_ID, hdnValueDeptId.Value);

                BackEndObjects.userDetails.updateUserDetailsDB(targetVals, whereCls, DBConn.Connections.OPERATION_UPDATE);
                loadMembersGrid(null);
                Label_Add_To_Dept_Status.Visible = false;
            }
        }