protected void CompanyDetailsView_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
        {
            UserBL userBL = new UserBL();

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

            if (Convert.ToInt32(companyTypesDropDownList.SelectedValue) == 0) { e.NewValues["CompanyTypeID"] = null; }
            else { e.NewValues["CompanyTypeID"] = companyTypesDropDownList.SelectedValue; }
            e.NewValues["ModifiedTime"] = DateTime.Now;
            e.NewValues["ModifiedBy"] = userid;
        }
Esempio n. 2
0
        protected void BankAccountDetailsView_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
        {
            UserBL userBL = new UserBL();

            string accountname = userBL.GetBankAccountName();

            if (accountname != null)
            {
                TextBox pe = (TextBox)CompanyDetailsView.FindControl("BankAccountTextBox");
                pe.Text = accountname;

            }
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "CloseModal('BodyContent_ModalPanel1');", true);
        }
Esempio n. 3
0
        protected void BankAccountDetailsView_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
        {
            UserBL userBL = new UserBL();

            int bankaccountid = Convert.ToInt32(Session["NewBankID"]);
            int bankid = userBL.CompanySetBankAccountID(bankaccountid);

            string accountname = userBL.GetBankAccountName();

            if (accountname != null)
            {
                TextBox pe = (TextBox)CompanyDetailsView.FindControl("BankAccountTextBox");
                pe.Text = accountname;

            }
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "CloseModal('BodyContent_ModalPanel1');", true);
        }
Esempio n. 4
0
        //after updating an account
        protected void AccountDetailsView_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
        {
            if (e.Exception != null)
            {
                var customValidator = new CustomValidator();
                customValidator.IsValid = false;
                customValidator.ErrorMessage = "Save failed: " + e.Exception.InnerException.Message;
                customValidator.ValidationGroup = "sum";
                Page.Validators.Add(customValidator);
                e.ExceptionHandled = true;
            }
            else
            {
                int rowcount = e.AffectedRows;
                string receiverName = string.Empty;
                string receiverEmail = string.Empty;
                if (rowcount == -1)
                {
                    string name = e.NewValues["Name"].ToString();
                    MsgLiteral.Text = "Success";
                    alertLabel.Text = "This account " + name + " has been saved";
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "ShowAlertModal();", true);
                }

                //else
                //{
                //    MsgLiteral.Text = "Save failed";
                //    alertLabel.Text = "Sorry,this Account has not been saved";
                //}

                if (Session["NotifyStatus"] != null)
                {
                    UserBL userBL = new UserBL();
                    long assignedUserID = Convert.ToInt64(e.NewValues["AssignedUserID"]);
                    string accountName = e.NewValues["Name"].ToString();
                    IEnumerable<DAL.User> userdetails = userBL.GetUsersByID(assignedUserID);
                    foreach (var user in userdetails)
                    {
                        receiverName = user.FirstName;
                        receiverEmail = user.PrimaryEmail;
                    }
                    const string subject = "Account Notification";
                    string body = "Dear " + receiverName + ",Your new assignment is to deal with " + accountName + " ";
                    try
                    {
                        Notification.SendEmail(receiverEmail, subject, body);
                        Session["NotifyStatus"] = 0;
                        MiniAccountsFormView.DataBind();
                        miniAccountDetailsView.DataBind();
                        ViewAccountsGridView.DataBind();
                        miniAccountDetailsUpdatePanel.Update();
                        Session["EditAccountID"] = 0;
                        AccountDetailsView.DataBind();
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
        }
        protected void submit_Click(object sender, EventArgs e)
        {
            try
                {
                    string companyname = "";
                    companyname = CompanyTextBox.Text;
                    int countryid = Convert.ToInt32(countryDropDownList.SelectedValue);
                    string rolename = "Administrator";
                    UserBL userBL = new UserBL();
                    ACLRoleBL aclroleBL = new ACLRoleBL();

                    bool existcompany = false;
                    bool emailaddress = false;

                    existcompany = userBL.IsCompanyExists(companyname);
                    emailaddress = userBL.IsEmailExists(PrimaryEmailTextBox.Text);

                    if (
                        existcompany == false && emailaddress == false && companyname != "" && FirstNameTextBox.Text != ""
                        && LastNameTextBox.Text != "" && TitleTextBox.Text != "" && StreetTextBox.Text != ""
                        && CityTextBox.Text != "" && PostalCodeTextBox.Text != ""
                        && MobilePhoneTextBox.Text != "" && PrimaryEmailTextBox.Text != ""
                     )
                    {
                        Int32 companyID = userBL.GetCompanyID(companyname, countryid);
                        Int32 roleID = userBL.GetRoleID(rolename, companyID);
                        string password = userBL.GenerateRandomPassword();
                        string m = aclroleBL.InsertCompanyModules(companyID);
                        aclroleBL.InsertACLAction(roleID, companyID);
                        object[] objp;
                        int i = 0;

                        objp = new object[12];

                        objp.SetValue(FirstNameTextBox.Text, i++);
                        objp.SetValue(LastNameTextBox.Text, i++);
                        objp.SetValue(TitleTextBox.Text, i++);
                        objp.SetValue(StreetTextBox.Text, i++);
                        objp.SetValue(CityTextBox.Text, i++);
                        //objp.SetValue(StateTextBox.Text, i++);
                        objp.SetValue(PostalCodeTextBox.Text, i++);
                        objp.SetValue(countryDropDownList.SelectedValue, i++);
                        objp.SetValue(MobilePhoneTextBox.Text, i++);
                        objp.SetValue(PrimaryEmailTextBox.Text, i++);
                        objp.SetValue(companyID, i++);
                        objp.SetValue(roleID, i++);
                        objp.SetValue(password, i++);

                        long id = userBL.RegisterUser(objp);

                        /// Code done by Pavel to Activate Registered User
                        /// Start

                        string emailID = PrimaryEmailTextBox.Text;
                       // String mailbody = null;
                        Guid? activationID = userBL.GetActivationID(emailID);

                        ListDictionary templateValues = new ListDictionary();
                        templateValues.Add("<%=PrimaryEmail%>", emailID);
                        templateValues.Add("<%=ActivationID%>", activationID);
                        templateValues.Add("<%=Password%>", password);

                        Session["CompanyID"] = companyID;
                        Session["UserID"] = id;

                        C3App.App_Code.Notification.Notify("User", id, 1, emailID, 1, templateValues);

                        Session.Clear();
                        Session.Abandon();

                        Literal1.Text = "Registration Successfull";
                        Label1.Text = "To activate your account please check your email.<br>";
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$('#myModal').reveal();", true);
                        CloseHyperLink.NavigateUrl = "~/UserLogin.aspx";
                        // ClientScript.RegisterClientScriptBlock(Page.GetType(), "validation", "<script language='javascript'>ShowAlertModal();</script>");
                    }
                    else
                    {
                        Literal1.Text = "Registration Error";
                        Label1.Text = "Registration is not completed.Please try again";
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$('#myModal').reveal();", true);
                        CloseHyperLink.NavigateUrl = "~/UserRegister.aspx";
                        //ClientScript.RegisterClientScriptBlock(Page.GetType(), "validation", "<script language='javascript'>ShowAlertModal();</script>");
                    }

                }

                catch (Exception ex)
                {
                    throw ex;
                }
        }
        protected void UsersDetailsView_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
        {
            TextBox pe = (TextBox)UsersDetailsView.FindControl("txtPrimaryEmail");
            string pemail = pe.Text;
            UserBL userBL = new UserBL();
            bool emailaddress = true;
            emailaddress = userBL.IsEmailExists(pemail);

            long id = 0;
            string value = Convert.ToString(Session["NewUser"]);
            if (value != "")
            id = int.Parse(value);

            if (id > 0)
            {
                Label3.Text = "Success !</br> <p>User information has been saved successfully</p>";
                UpdatePanel3.Update();
            }
            else
            {
                if (emailaddress == false)
                {

                    Label3.Text = "Error !</br> <p>User information did not save.</p>";
                    UpdatePanel3.Update();

                }
                else
                {
                    Label3.Text = "Error !</br> <p>This Primary Email Address Already Exists.Please try another one.</p>";
                    UpdatePanel3.Update();

                }

            }
        }
Esempio n. 7
0
        protected void SelectLinkButton1_Command(object sender, CommandEventArgs e)
        {
            UserBL userBL = new UserBL();
            string value = e.CommandArgument.ToString();

            int bankaccountid = Convert.ToInt32(value);
            int test = userBL.CompanySetBankAccountID(bankaccountid);
        }
Esempio n. 8
0
        protected void CompanyDetailsView_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
        {
            UserBL userBL = new UserBL();
            int bankid = 0;
            Int64 userid = Convert.ToInt32(HttpContext.Current.Session["UserID"]);
            var bank = userBL.GetBankAccountByCompanyID();
            if (bank.Count() > 0)
            {
                bankid = bank.ElementAt(0).BankAccountID;
            }
            if (bankid == 0)
            {
                bankid = Convert.ToInt32(Session["NewBankID"]);

            }

            e.NewValues["ModifiedBy"] = userid;
            e.NewValues["ModifiedTime"] = DateTime.Now;
            if (bankid == 0)
            {
                e.NewValues["BankAccount"] = null;
            }
            else if (bankid > 0)
            {
                e.NewValues["BankAccount"] = bankid;
            }

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

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

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

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

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

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

            if (Convert.ToInt32(companyTypesDropDownList.SelectedValue) == 0) { e.NewValues["CompanyTypeID"] = null; }
            else { e.NewValues["CompanyTypeID"] = companyTypesDropDownList.SelectedValue; }
        }
Esempio n. 9
0
        protected void PasswordTextBox_Load(object sender, EventArgs e)
        {
            UserBL userBL = new UserBL();
            string password = "";
            ErrorLabel.Text = "message will show here";

            password = userBL.GetUserPassword();

            if (password != null)
            {
                TextBox pe = (TextBox)UsersDetailsView.FindControl("PasswordTextBox");
                pe.Text = password;

            }
        }
Esempio n. 10
0
        protected void PasswordSaveButton_Click(object sender, EventArgs e)
        {
            long userid = Convert.ToInt64(Session["EditUserID"]);
            string newpassword = NewPasswordTextBox.Text;
            string confirmpassword = ConfirmPasswordTextBox.Text;

            UserBL userBL = new UserBL();

                if (newpassword.Length >= 6)
                {
                    if (newpassword == confirmpassword)
                    {
                        // save password
                        ErrorLabel.Text = "Success and Saved!";
                        userBL.SetUserPassword(newpassword,userid);

                        TextBox pe = (TextBox)UsersDetailsView.FindControl("PasswordTextBox");
                        pe.Text = newpassword;
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "CloseModal('BodyContent_ModalPanel1');", true);

                    }
                    else
                    {
                        // new and confirm did not match
                        ErrorLabel.Text = "Confirm Password did not match! Please try again";
                    }

                }
                else
                {
                    // more than 6 char
                    ErrorLabel.Text = "Password length should be more than 5 characters";
                }
        }
Esempio n. 11
0
 protected void MessengerTypeDropDownList_Init(object sender, EventArgs e)
 {
     UserBL userBL = new UserBL();
     messengerTypeDropDownList = sender as DropDownList;
     string value = userBL.GetMessengerType(Convert.ToInt64(Session["EditUserID"]));
     foreach (ListItem item in messengerTypeDropDownList.Items)
     {
         if (item.Text == value)
         {
             item.Selected = true;
             break;
         }
     }
 }
Esempio n. 12
0
        protected void IsActiveDropDownList_Init(object sender, EventArgs e)
        {
            isActiveDropDownList = sender as DropDownList;
            UserBL userBL = new UserBL();
            string value = userBL.IsActive(Convert.ToInt64(Session["EditUserID"]));

            foreach (ListItem item in isActiveDropDownList.Items)
            {
                if ( item.Value == value)
                {
                    item.Selected = true;
                    break;
                }
            }
        }
Esempio n. 13
0
        protected void GenderDropDownList_Init(object sender, EventArgs e)
        {
            UserBL userBL = new UserBL();

            genderDropDownList = sender as DropDownList;
            string value = userBL.GetGender(Convert.ToInt64(Session["EditUserID"]));

            if (value == "Male")
            genderDropDownList.SelectedIndex = genderDropDownList.Items.IndexOf(genderDropDownList.Items.FindByText("Male"));
            else if (value == "Female")
            genderDropDownList.SelectedIndex = genderDropDownList.Items.IndexOf(genderDropDownList.Items.FindByText("Female"));
            else
            genderDropDownList.SelectedIndex = genderDropDownList.Items.IndexOf(genderDropDownList.Items.FindByText(""));
        }
Esempio n. 14
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            string username = UserNameTextBox.Text;
            string password = PasswordTextBox.Text;
            string status = "";
            string sessionid = "";
            string target = "Dashboard.aspx";
            bool islocked = false;

            UserBL objUserBL = new UserBL();
            var users = objUserBL.GetUserByEmail(username);
            if (users.Count() > 0)
            {
                islocked = Convert.ToBoolean(users.ElementAt(0).IsLockedOut);
                if (islocked == false)
                {
                    var user = objUserBL.VerifyLogIn(username, password);
                    Session.Clear();

                    if (user != null)
                    {

                        string primaryEmail = user.ElementAt(0).PrimaryEmail;
                        string firstName = user.ElementAt(0).FirstName;
                        string lastName = user.ElementAt(0).LastName;
                        string userName = user.ElementAt(0).UserName;
                        string mobilePhone = user.ElementAt(0).MobilePhone;
                        Int64 userId = user.ElementAt(0).UserID;
                        Int32 companyId = user.ElementAt(0).CompanyID;
                        Int32 roleid = Convert.ToInt32(user.ElementAt(0).RoleID);
                        bool isactive = Convert.ToBoolean(user.ElementAt(0).IsActive);
                        bool isadmin = Convert.ToBoolean(user.ElementAt(0).IsAdmin);
                        bool isemployee = Convert.ToBoolean(user.ElementAt(0).IsEmployee);
                        bool isapproved = Convert.ToBoolean(user.ElementAt(0).IsApproved);
                        bool isfirstlogin = Convert.ToBoolean(user.ElementAt(0).IsFirstLogin);

                        Session["UserName"] = userName;
                        Session["FirstName"] = firstName;
                        Session["LastName"] = lastName;
                        Session["PrimaryEmail"] = primaryEmail;
                        Session["MobilePhone"] = mobilePhone;
                        Session["UserID"] = userId;
                        Session["CompanyID"] = companyId;
                        Session["IsAuthorized"] = true;
                        Session["RoleID"] = roleid;
                        Session["IsAdmin"] = isadmin;
                        Session["FirstLogin"] = isfirstlogin;
                        status = "succeed";
                        sessionid = Session.SessionID;
                        long log = 0;

                        if (isapproved == false)
                        {
                            status = "Failed-approved";
                            log = objUserBL.InsertUserLogin(companyId, userId, sessionid, status, target);
                            Literal1.Text = "Login failed";
                            Label1.Text = "Your account is not activated.<br>Please check your email to activate your account.<br>";
                            ClientScript.RegisterStartupScript(Page.GetType(), "validation", "<script language='javascript'>ShowAlertModal();</script>");
                            return;
                        }

                        if (isactive == false)
                        {
                            status = "Failed-activate";
                            log = objUserBL.InsertUserLogin(companyId, userId, sessionid, status, target);
                            Literal1.Text = "Login failed";
                            Label1.Text = "Your account is deactivated.<br>Please contact system administrator for details.<br>";
                            ClientScript.RegisterStartupScript(Page.GetType(), "validation", "<script language='javascript'>ShowAlertModal();</script>");
                            return;
                        }

                        else
                        {
                            status = "Success";
                            log = objUserBL.InsertUserLogin(companyId, userId, sessionid, status, target);
                            if (isfirstlogin == false && isadmin == false)
                            {
                                Response.Redirect("~/Dashboard/Dashboard.aspx");
                            }
                            else if (isfirstlogin == true && isadmin == false)
                            {
                                Response.Redirect("~/Dashboard/Dashboard.aspx");
                            }
                            else if (isfirstlogin == true && isadmin == true)
                            {
                                Response.Redirect("~/CompanySetup.aspx");
                            }
                            else if (isfirstlogin == false && isadmin == true)
                            {
                                Response.Redirect("~/Dashboard/Dashboard.aspx");
                            }

                        }

                    }
                    else
                    {
                        int lockoutnumber = 0;
                        lockoutnumber = objUserBL.UserLockOut(username);
                        if (lockoutnumber >= 5)
                        {
                            Literal1.Text = "Login failed";
                            Label1.Text = "This Account has been Locked. Please Contact to your Administrator.<br>";
                        }
                        else
                        {
                            Literal1.Text = "Login failed";
                            Label1.Text = "Invalid username or password.<br>";
                        }
                        ClientScript.RegisterStartupScript(Page.GetType(), "validation", "<script language='javascript'>ShowAlertModal();</script>");
                    }
                }
                else
                {

                        Literal1.Text = "Login failed";
                        Label1.Text = "This Account has been Locked. Please Contact to your Administrator.<br>";
                        ClientScript.RegisterStartupScript(Page.GetType(), "validation", "<script language='javascript'>ShowAlertModal();</script>");
                }
            }

            else
            {

                Literal1.Text = "Login failed";
                Label1.Text = "Invalid username or password.<br>";
                ClientScript.RegisterStartupScript(Page.GetType(), "validation", "<script language='javascript'>ShowAlertModal();</script>");

            }
        }
Esempio n. 15
0
        //select an account from list
        protected void SelectLinkButton_Command(object sender, CommandEventArgs e)
        {
            //highlight selected row start
            int gindex = Convert.ToInt32(ViewAccountsGridView.SelectedIndex);
            if (gindex > -1)
            {
                LinkButton nlbtn = ViewAccountsGridView.Rows[gindex].FindControl("SelectLinkButton") as LinkButton;
                nlbtn.CssClass = "";
            }
            LinkButton lbtn = sender as LinkButton;
            if (lbtn != null) lbtn.CssClass = "active";
            //highlight selected row end

            if (CheckEdit() != false)
                EditLinkButton.Visible = true;
            if (CheckDelete() != false)
                DeleteLinkButton.Visible = true;
            ModalPopButton2.Visible = true;
            NotifyLinkButton.Visible = true;

            // Session["EditAccountID"] = e.CommandArgument.ToString();
            //added on 17.01.2013
            try
            {
                UserBL userBL = new UserBL();
                string arguments = Convert.ToString(e.CommandArgument);
                string[] arg = arguments.Split(';');
                Session["EditAccountID"] = Convert.ToInt64(arg[0]);
                if (arg[1] != string.Empty)
                {
                    long assignedUserID = Convert.ToInt64(arg[1]);
                    Session["AccountName"] = Convert.ToString(arg[2]);
                    try
                    {
                        IEnumerable<DAL.User> userdetails = userBL.GetUsersByID(assignedUserID);
                        foreach (var user in userdetails)
                        {
                            Session["ReceiverName"] = user.FirstName;
                            Session["ReceiverEmail"] = user.PrimaryEmail;
                        }

                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }

                MiniAccountsFormView.DataBind();
                miniAccountDetailsView.DataBind();
                miniAccountDetailsUpdatePanel.Update();
            }

            catch (Exception ex)
            {
                throw ex;
            }
            //end on 17.01.2013
            //comment out to enable singleaccount in formview
        }
Esempio n. 16
0
 protected void BankAccountTypeDropDownList_Init(object sender, EventArgs e)
 {
     bankAccountTypeDropDownList = sender as DropDownList;
     UserBL userBL = new UserBL();
     string value = userBL.CompanyBankAccountType();
     foreach (ListItem item in bankAccountTypeDropDownList.Items)
     {
         if (item.Value == value)
         {
             item.Selected = true;
             break;
         }
     }
 }
Esempio n. 17
0
 protected void BankInsertLinkButton_Click(object sender, EventArgs e)
 {
     UserBL userBL = new UserBL();
     int bankaccountid = 0;
        int bankid = userBL.CompanySetBankAccountID(bankaccountid);
 }
Esempio n. 18
0
        protected void UserDeleteButton_Click(object sender, EventArgs e)
        {
            UserBL userBL = new UserBL();
            Int64 userid = Convert.ToInt64(Session["EditUserID"]);
            userBL.DeactivateUser(userid);
            Session["EditUserID"] = 0;
            this.UsersGridView.DataBind();
            this.UsersGridView.SelectedIndex = -1;
            this.MiniUserFormView.DataBind();
            this.MiniUserDetailsView.DataBind();
            upListView.Update();
            miniDetails.Update();
            EditLinkButton.Visible = false;
              //  ModalPopButton2.Visible = false;
            DeleteLinkButton.Visible = false;

               // ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "GoToTab(2);", true);
        }
Esempio n. 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            UserBL userBL = new UserBL();

               int cc =  Convert.ToInt32(Session["CompanyID"]);

               try
               {
               if (Request.QueryString["ShowPanel"] != null)
               {
                   if ((!IsPostBack))
                   {
                       Session["CompanyID"] = Convert.ToInt32(Session["CompanyID"]);
                   }
               }

               if (Session["CompanyID"] != null)
               {

                   Int32 companyid = Convert.ToInt32(Session["CompanyID"]);

                   if (companyid == 0)
                   {

                       Response.Redirect("~/UserLogin.aspx");

                   }
                   else if (companyid > 0)
                   {
                       CompanyDetailsView.ChangeMode(DetailsViewMode.Edit);
                       //CompanyDetailsView.AutoGenerateEditButton = true;

                   }

                   var bank = userBL.GetBankAccountByCompanyID();
                   if (bank.Count() > 0)
                   {
                       int bankaccountid = bank.ElementAt(0).BankAccountID;
                       if (bankaccountid == 0)
                       {
                           BankAccountDetailsView.ChangeMode(DetailsViewMode.Insert);
                       }
                       else if (bankaccountid > 0)
                       {
                           BankAccountDetailsView.ChangeMode(DetailsViewMode.Edit);
                       }
                   }
                   else
                   {
                       BankAccountDetailsView.ChangeMode(DetailsViewMode.Insert);
                   }

               }
               else
               {

                   Response.Redirect("~/UserLogin.aspx");
               }
               }
               catch (Exception ex)
               {
               throw ex;
               }
        }
Esempio n. 20
0
        protected void UsersDetailsView_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
        {
            this.UsersGridView.DataBind();
            this.MiniUserFormView.DataBind();
            this.MiniUserDetailsView.DataBind();
            upListView.Update();
            miniDetails.Update();

            TextBox pe = (TextBox)UsersDetailsView.FindControl("txtPrimaryEmail");
            string pemail = pe.Text;
            UserBL userBL = new UserBL();
            bool emailaddress = false;
            emailaddress = userBL.IsEmailExists(pemail);

            Int64 id = 0;
            string value = Convert.ToString(Session["NewUser"]);
            if(value !="")
            id = int.Parse(value);

                if (id > 0)
                {
                    //Literal1.Text = "Success";
                    //Label6.Text = "User information has been saved successfully.";
                    Literal1.Text = "Success !</br></br> <p>User information has been saved successfully</p>";
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$('#myModal').reveal();", true);
                    Session["EditUserID"] = 0;
                    UsersDetailsView.DataBind();

                }
                else
                {
                    if (emailaddress == true)
                    {
                        //Literal1.Text = "Error";
                        //Label6.Text = "User information did not save.";
                        Literal1.Text = "Error !</br></br> <p>User information did not save.</p>";
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$('#myModal').reveal();", true);
                        Session["EditUserID"] = 0;
                        UsersDetailsView.DataBind();

                    }

                }
        }
Esempio n. 21
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;
        }
Esempio n. 22
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; }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     UserBL userBL = new UserBL();
     long uid = Convert.ToInt64(HttpContext.Current.Session["UserID"]);
     userBL.FirstLoginSetToZero(uid);
     Firstname.Text = "Logged in as " + Session["FirstName"]+ " " + Session["LastName"];
 }
Esempio n. 24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            switch (Request.QueryString["ShowPanel"])
                {
                    case "DetailsPanel":
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "showTabs", "GoToTab(1);", true);
                        break;
                    case "ViewPanel":
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "showTabs", "GoToTab(2);", true);
                        break;
                }

            // Role Based Page Access //
            // START //

                Session["EditLinkButton"] = "True";
                Session["DeleteLinkButton"] = "True";

            string[] pageurl = Path.GetFileName(Request.Url.AbsolutePath).Split('.');
            string page = pageurl[0];
            UserBL userBL = new UserBL();
            string pageaccess = userBL.PageAccess(page);
            string functionname = "";
            string functionaccess = "";
            string createpage = "";
            string viewpage = "";
            string cpermission = "";
            string vpermission = "";
            string[] pid = { "" };
            pid = pageaccess.Split(':');
            for (int x = 0; x < pid.Length; x++)
            {
                string[] fid = { "" };
                fid = pid[x].Split('#');

                if (fid.Length > 0 && fid[0] != "")
                {
                    functionname = fid[0];
                    functionaccess = fid[1];

                    if (functionname == "Search" && functionaccess == "False")
                    {
                        Panel search = (Panel)BodyContent.FindControl("SearchPanel");
                        search.Visible = false;
                    }
                    else if (functionname == "List" && functionaccess == "False")
                    {
                        Panel list = (Panel)BodyContent.FindControl("ListPanel");
                        list.Visible = false;

                        //Panel mini = (Panel)BodyContent.FindControl("MiniDetailsPanel");
                        //mini.Visible = false;

                        //Panel more = (Panel)BodyContent.FindControl("MiniDetailMorePanel");
                        //more.Visible = false;
                    }
                    else if (functionname == "Edit" && functionaccess == "False")
                    {
                        LinkButton edit = (LinkButton)BodyContent.FindControl("EditLinkButton");
                        edit.Visible = false;
                        Session["EditLinkButton"] = "False";
                    }

                    else if (functionname == "Delete" && functionaccess == "False")
                    {
                       LinkButton delete = (LinkButton)BodyContent.FindControl("DeleteLinkButton");
                        delete.Visible = false;
                        Session["DeleteLinkButton"] = "False";
                    }
                    else if (functionname == "Create" && functionaccess == "False")
                    {
                        createpage = "Create"; cpermission = "False";
                        Panel create = (Panel)BodyContent.FindControl("DetailsPanel");
                        create.Visible = false;
                    }
                    else if (functionname == "View" && functionaccess == "False")
                    {
                        viewpage = "View"; vpermission = "False";
                        Panel view = (Panel)BodyContent.FindControl("ViewPanel");
                        view.Visible = false;
                    }

                }//if

            }//for

            // if a user do not have any permission it will take to the dashboard page.

            if ((viewpage == "View" && vpermission == "False") && (createpage == "Create" && cpermission == "False"))
            {
                Response.Redirect("~/Dashboard/Dashboard.aspx");
            }

            //for left panel Contact + Task + Document + Administrator

            String[] pages = {"Contacts","Tasks","Documents"};

            for (int i = 0; i < 3; i++)
            {
                string ps = userBL.PageAccess(pages[i]);

                    if ((ps.Contains("Create#False")) && (ps.Contains("View#False")) && i == 0)
                        {
                            contact.Visible = false;
                        }
                    if ((ps.Contains("Create#False")) && (ps.Contains("View#False")) && i == 1)
                        {
                            task.Visible = false;
                        }
                    if ((ps.Contains("Create#False")) && (ps.Contains("View#False")) && i == 2)
                        {
                            documents.Visible = false;
                        }
              }

                string isadmin = Convert.ToString(Session["IsAdmin"]);
                if (isadmin !="True")
                {
                    administrator.Visible = false;
                }

            // END //
        }
        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;
        }
Esempio n. 26
0
 protected void signout_Click(object sender, EventArgs e)
 {
     UserBL objUserBL = new UserBL();
     string sessionid = Session.SessionID;
     long log = 0;
     string target = "UserLogin.aspx";
     string status = "Logout";
     int companyId = Convert.ToInt32(Session["CompanyID"]);
     long userId = Convert.ToInt64(Session["UserID"]);
     log = objUserBL.InsertUserLogout(companyId, userId, sessionid, status, target);
     Session.Clear();
     Session.Abandon();
     Response.Redirect("~/UserLogin.aspx");
 }
        protected void SubmitLinkButton_Click(object sender, EventArgs e)
        {
            string fname = FirstNameTextBox.Text;
            string lname = LastNameTextBox.Text;
            string designation = TitleTextBox.Text;
            string company = CompanyTextBox.Text;
            UserBL userBL = new UserBL();
            bool existcompany = userBL.IsCompanyExists(company);
            Regex regex = new Regex(@"^[a-zA-Z''-'.\s]{1,200}$");
            Match fmatch = regex.Match(fname);
            Match lmatch = regex.Match(lname);
            Match dmatch = regex.Match(designation);
            Match cmatch = regex.Match(company);

            if (fname !="" && lname !="" && designation!="" && company!="" && existcompany==false)
            {
                if (!fmatch.Success)
                {
                    Literal1.Text = "Error";
                    Label1.Text = "First Name is not valid ";
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$('#myModal').reveal();", true);
                    return;
                }
                if (!lmatch.Success)
                {
                    Literal1.Text = "Error";
                    Label1.Text = "Last Name is not valid ";
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$('#myModal').reveal();", true);
                    return;
                }
                if (!dmatch.Success)
                {
                    Literal1.Text = "Error";
                    Label1.Text = "Designation Field is not valid ";
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$('#myModal').reveal();", true);
                    return;
                }
                if (!cmatch.Success)
                {
                    Literal1.Text = "Error";
                    Label1.Text = "Company Name is not valid ";
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$('#myModal').reveal();", true);
                    return;
                }
                if (fmatch.Success && lmatch.Success && dmatch.Success && cmatch.Success)
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "GoToSlide(1);", true);
                }
            }

            if(fname == "")
            {
                Literal1.Text = "Error";
                Label1.Text = "First Name cannot be empty";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$('#myModal').reveal();", true);
                return;
            }
            if (lname == "")
            {
                Literal1.Text = "Error";
                Label1.Text = "Last Name cannot be empty";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$('#myModal').reveal();", true);
                return;
            }
            if (designation == "")
            {
                Literal1.Text = "Error";
                Label1.Text = "Designation Field cannot be empty";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$('#myModal').reveal();", true);
                return;
            }
            if (company == "")
            {
                Literal1.Text = "Error";
                Label1.Text = "Company Name cannot be empty";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$('#myModal').reveal();", true);
                return;
            }
            if (existcompany == true)
            {
                Literal1.Text = "Error";
                Label1.Text = "This company alreday exists. Please try another one.";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$('#myModal').reveal();", true);
                return;
            }
        }
Esempio n. 28
0
        protected void BankAccountTextBox_Load(object sender, EventArgs e)
        {
            UserBL userBL = new UserBL();
            string accountname = "";

            accountname = userBL.GetBankAccountName();

            if (accountname != null)
            {
                TextBox pe = (TextBox)CompanyDetailsView.FindControl("BankAccountTextBox");
                pe.Text = accountname;

            }
        }
        protected void SubmitLinkButton2_Click(object sender, EventArgs e)
        {
            string street = StreetTextBox.Text;
            string city = CityTextBox.Text;
            string postal = PostalCodeTextBox.Text;
            string phone = MobilePhoneTextBox.Text;
            string email = PrimaryEmailTextBox.Text;
            UserBL userBL = new UserBL();
            bool emailaddress = userBL.IsEmailExists(PrimaryEmailTextBox.Text);
            Regex regex = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$");
            Match match = regex.Match(email);
            Regex sregex = new Regex(@"^[a-zA-Z0-9\s\(\)\/,\:\;\.-]+$");
            Match smatch = sregex.Match(street);
            Regex cregex = new Regex(@"^[a-zA-Z''-'.\s]{1,200}$");
            Match cmatch = cregex.Match(city);
            Regex pregex = new Regex(@"^\d{4}$");
            Match pmatch = pregex.Match(postal);
            Regex mregex = new Regex(@"^(\+?(88)?)((02)|(0?1))((\d{9})|(\d{7}))$");
            Match mmatch = mregex.Match(phone);

            if (street != "" && city != "" && postal != "" && phone != "" && email !="" && emailaddress == false)
            {
                if (!smatch.Success)
                {
                    Literal1.Text = "Error";
                    Label1.Text = "Street Field is not valid ";
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$('#myModal').reveal();", true);
                    return;
                }
                if (!cmatch.Success)
                {
                    Literal1.Text = "Error";
                    Label1.Text = "City Name is not valid ";
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$('#myModal').reveal();", true);
                    return;
                }
                if (!pmatch.Success)
                {
                    Literal1.Text = "Error";
                    Label1.Text = "Postal code is not valid ";
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$('#myModal').reveal();", true);
                    return;
                }
                if (!mmatch.Success)
                {
                    Literal1.Text = "Error";
                    Label1.Text = "Phone number is not valid ";
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$('#myModal').reveal();", true);
                    return;
                }
                if (!match.Success)
                {
                    Literal1.Text = "Error";
                    Label1.Text = "This Email Address is not valid. Please give valid Email Address.";
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$('#myModal').reveal();", true);
                    return;
                }
                if (smatch.Success && cmatch.Success && pmatch.Success && mmatch.Success && match.Success)
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "GoToSlide(2);", true);
                }

            }

            if (street == "")
            {
                Literal1.Text = "Error";
                Label1.Text = "Street Field cannot be empty";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$('#myModal').reveal();", true);
                return;
            }
            if (city == "")
            {
                Literal1.Text = "Error";
                Label1.Text = "City field cannot be empty";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$('#myModal').reveal();", true);
                return;
            }
            if (postal == "")
            {
                Literal1.Text = "Error";
                Label1.Text = "Postal Code Field cannot be empty";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$('#myModal').reveal();", true);
                return;
            }
            if (phone == "")
            {
                Literal1.Text = "Error";
                Label1.Text = "Phone field cannot be empty";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$('#myModal').reveal();", true);
                return;
            }
            if (email == "")
            {
                Literal1.Text = "Error";
                Label1.Text = "Email Address cannot be empty";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$('#myModal').reveal();", true);
                return;
            }
            if (emailaddress == true)
            {
                Literal1.Text = "Error";
                Label1.Text = "This Email Address alreday exists. Please try another one.";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$('#myModal').reveal();", true);
                return;
            }
        }
        protected void UsersDetailsView_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
        {
            string ID = UsersDetailsView.DataKey[0].ToString();
            long userid = Convert.ToInt32(HttpContext.Current.Session["UserID"]);
            long currentuserid = Int64.Parse(ID);
            string password = null;
            string passwordsalt = null;
            UserBL userBL = new UserBL();
            var user = userBL.GetUsersByID(userid);

            if (user.Count() > 0)
            {
                password = user.ElementAt(0).Password;
                passwordsalt = user.ElementAt(0).PasswordSalt;
            }
            //FileUpload imageFileUpload = (FileUpload)UsersDetailsView.FindControl("fileUpload");
            //if (imageFileUpload.HasFile)
            //{
            //    const string fileUploadDirectory = "Images/";
            //    string fileName = Server.HtmlEncode(imageFileUpload.FileName);
            //    string extension = System.IO.Path.GetExtension(fileName);
            //    string fileNameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(imageFileUpload.FileName);
            //    string imagefilename = userid + "_" + "ProfilePic";
            //    string encodedImageName = Encryptdata(imagefilename);

            //    string imagePath = fileUploadDirectory + encodedImageName + extension;

            //    string fileString = System.IO.Path.GetExtension(imageFileUpload.FileName);
            //    if (extension == ".jpg" || extension == ".bmp" || extension == ".gif")
            //    {
            //        string file = imagefilename + extension;
            //        //imageFileUpload.SaveAs(Path.Combine(fileUploadDirectory, file));
            //       imageFileUpload.SaveAs(Server.MapPath("Images/" + imagefilename + extension));
            //        // imageFileUpload.SaveAs(fileUploadDirectory + imageFileUpload.FileName);
            //        e.NewValues["Image"] = imagePath;
            //    }
            //    else
            //    {
            //        ScriptManager.RegisterStartupScript(this,this.GetType(), "script", "alert('Only jpg, bmp and gif files are allowed.')",true);

            //    }
            //}

            e.NewValues["Image"] = Convert.ToString(Session["ImagePath"]);
            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["MaritalStatus"] = maritalStatusDropDownList.SelectedValue;
            e.NewValues["MessengerType"] = messengerTypeDropDownList.SelectedValue;
            e.NewValues["SecurityQuestion"] = securityQuestionDropDownList.SelectedValue;
            //e.NewValues["TeamID"] = teamDropDownList.SelectedValue;

            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; }
            //else { e.NewValues["RoleID"] = roleDropDownList.SelectedValue; }

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