コード例 #1
0
        protected void UsersDetailsView_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
        {
            string ID = UsersDetailsView.DataKey[0].ToString();
            Int64 userid = Convert.ToInt32(HttpContext.Current.Session["UserID"]);
            Int64 currentuserid = Int64.Parse(ID);
            UserBL userBL = new UserBL();
            long edituser = Convert.ToInt32(HttpContext.Current.Session["EditUserID"]);
            string password = null;
            string passwordsalt = null;
            var user = userBL.GetUsersByID(edituser);

            if (user.Count() > 0)
            {
                password = user.ElementAt(0).Password;
                passwordsalt = user.ElementAt(0).PasswordSalt;
            }

            e.NewValues["Password"] = password;
            e.NewValues["PasswordSalt"] = passwordsalt;
            e.NewValues["Gender"] = genderDropDownList.SelectedValue;
            e.NewValues["ModifiedBy"] = userid;
            e.NewValues["ModifiedTime"] = DateTime.Now;
            e.NewValues["IsActive"] = isActiveDropDownList.SelectedValue;
            e.NewValues["MessengerType"] = messengerTypeDropDownList.SelectedValue;
               // e.NewValues["SecurityQuestion"] = securityQuestionDropDownList.SelectedValue;
            e.NewValues["TeamID"] = teamDropDownList.SelectedValue;
            Int64 teamid = Convert.ToInt64(teamDropDownList.SelectedValue);
            e.NewValues["TeamSetID"] = userBL.GetTeamSetID(teamid);

            if (Convert.ToInt32(countryDropDownList.SelectedValue) == 0) { e.NewValues["CountryID"] = null; }
            else { e.NewValues["CountryID"] = countryDropDownList.SelectedValue; }

            if (Convert.ToInt32(roleDropDownList.SelectedValue) == 0) { e.NewValues["RoleID"] = null; e.NewValues["IsAdmin"] = null; }
            else
            {
                e.NewValues["RoleID"] = roleDropDownList.SelectedValue;
                int roleid = Convert.ToInt32(roleDropDownList.SelectedValue);
                string rolename = userBL.GetRoleName(roleid);
                if (rolename == "Administrator" || rolename == "Admin")
                {
                    e.NewValues["IsAdmin"] = true;
                }
                else
                {
                    e.NewValues["IsAdmin"] = false;
                }

            }

            if (Convert.ToInt32(reportsToDropDownList.SelectedValue) == 0) { e.NewValues["ReportsTo"] = null; }
            else { e.NewValues["ReportsTo"] = reportsToDropDownList.SelectedValue; }
        }
コード例 #2
0
        protected void UsersDetailsView_ItemInserting(object sender, DetailsViewInsertEventArgs e)
        {
            TextBox pe = (TextBox)UsersDetailsView.FindControl("txtPrimaryEmail");
            string pemail = pe.Text;
            UserBL userBL = new UserBL();
            bool emailaddress = false;
            emailaddress = userBL.IsEmailExists(pemail);

            int companyid = Convert.ToInt32(HttpContext.Current.Session["CompanyID"]);
            Int64 userid = Convert.ToInt32(HttpContext.Current.Session["UserID"]);

            e.Values["TeamID"] = teamDropDownList.SelectedValue;

            Int64 teamid = Convert.ToInt64(teamDropDownList.SelectedValue);
            e.Values["TeamSetID"] = userBL.GetTeamSetID(teamid);

            e.Values["CreatedBy"] = userid;
            e.Values["ModifiedBy"] = userid;
            e.Values["ModifiedTime"] = DateTime.Now;
            e.Values["CreatedTime"] = DateTime.Now;
            e.Values["ActivationID"] = Guid.NewGuid();
            e.Values["CompanyID"] = companyid;

            if (Convert.ToInt32(roleDropDownList.SelectedValue) == 0) { e.Values["RoleID"] = null; e.Values["IsAdmin"] = null; }
            else
            {
                e.Values["RoleID"] = roleDropDownList.SelectedValue;
                int roleid = Convert.ToInt32(roleDropDownList.SelectedValue);
                string rolename = userBL.GetRoleName(roleid);
                if (rolename == "Administrator" || rolename == "Admin")
                {
                    e.Values["IsAdmin"] = true;
                }
                else
                {
                    e.Values["IsAdmin"] = false;
                }

            }
            e.Values["IsActive"] = true;
            e.Values["IsEmployee"] = true;
            e.Values["CountryID"] = countryDropDownList.SelectedValue;
            e.Values["PrimaryEmail"] = pe.Text;
        }
コード例 #3
0
        protected void UsersDetailsView_ItemInserting(object sender, DetailsViewInsertEventArgs e)
        {
            TextBox pe = (TextBox)UsersDetailsView.FindControl("txtPrimaryEmail");
            string pemail = pe.Text;

            TextBox pa = (TextBox)UsersDetailsView.FindControl("CreatePasswordTextBox");
            string password = pa.Text;

            UserBL userBL = new UserBL();
            bool emailaddress = false;
            emailaddress = userBL.IsEmailExists(pemail);

            int companyid = Convert.ToInt32(HttpContext.Current.Session["CompanyID"]);
            Int64 userid = Convert.ToInt32(HttpContext.Current.Session["UserID"]);

                e.Values["Gender"] = genderDropDownList.SelectedValue;
                e.Values["IsActive"] = isActiveDropDownList.SelectedValue;
                //e.Values["MaritalStatus"] = maritalStatusDropDownList.SelectedValue;
                e.Values["MessengerType"] = messengerTypeDropDownList.SelectedValue;
               // e.Values["SecurityQuestion"] = securityQuestionDropDownList.SelectedValue;
                e.Values["TeamID"] = teamDropDownList.SelectedValue;

                Int64 teamid = Convert.ToInt64(teamDropDownList.SelectedValue);
                e.Values["TeamSetID"] = userBL.GetTeamSetID(teamid);

                e.Values["CreatedBy"] = userid;
                e.Values["ModifiedBy"] = userid;
                e.Values["ModifiedTime"] = DateTime.Now;
                e.Values["CreatedTime"] = DateTime.Now;
                e.Values["ActivationID"] = Guid.NewGuid();
                e.Values["Password"] = password;
                e.Values["CompanyID"] = companyid;

                if (Convert.ToInt32(countryDropDownList.SelectedValue) == 0) { e.Values["CountryID"] = null; }
                else { e.Values["CountryID"] = countryDropDownList.SelectedValue; }

                if (Convert.ToInt32(roleDropDownList.SelectedValue) == 0) { e.Values["RoleID"] = null; e.Values["IsAdmin"] = null; }
                else
                {
                    e.Values["RoleID"] = roleDropDownList.SelectedValue;
                    int roleid = Convert.ToInt32(roleDropDownList.SelectedValue);
                    string rolename = userBL.GetRoleName(roleid);
                    if (rolename == "Administrator" || rolename == "Admin")
                    {
                        e.Values["IsAdmin"] = true;
                    }
                    else
                    {
                        e.Values["IsAdmin"] = false;
                    }

                }

                if (Convert.ToInt32(reportsToDropDownList.SelectedValue) == 0) { e.Values["ReportsTo"] = null; }
                else { e.Values["ReportsTo"] = reportsToDropDownList.SelectedValue; }
                e.Values["PrimaryEmail"] = pe.Text;
        }