예제 #1
0
        private void ShowResults()
        {
            try {
                grdResults.DataSource = null;
                grdResults.DataBind();

                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                    if (radLogonName.Checked)
                    {
                        using (SqlDataReader dr = WSCEmployee.UserFindLogon(conn, txtCriteria.Text)) {
                            grdResults.DataSource = dr;
                            grdResults.DataBind();
                        }
                    }
                    else
                    {
                        using (SqlDataReader dr = WSCEmployee.UserFindDisplay(conn, txtCriteria.Text)) {
                            grdResults.DataSource = dr;
                            grdResults.DataBind();
                        }
                    }
                }
            }
            catch (Exception ex) {
                Common.CException wex = new Common.CException("UserFinder.ShowResults", ex);
                throw (wex);
            }
        }
예제 #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnSave_Click";

            WSCSecurity auth = Globals.SecurityState;

            if (auth.SecurityGroupName.ToUpper().IndexOf("AG ADMIN") == -1)
            {
                Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "Sorry, you are not authorized to update this information");
                return;
            }

            try {
                string phoneNumber = Common.CodeLib.FormatPhoneNumber2Db(txtPhoneNumber.Text);

                if (phoneNumber.Length != 0 && phoneNumber.Length != 10)
                {
                    Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "The phone number must contain 10 digits.");
                    return;
                }
                int userID = 0;
                if (txtUserID.Text.Length > 0)
                {
                    userID = Convert.ToInt32(txtUserID.Text);
                }
                //if (userID == 0) {
                //    Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "You MUST use the find button, '...', to lookup this user before editing his information.");
                //    return;
                //}
                WSCEmployee.UserSave(ref userID, txtUserName.Text, txtDisplayName.Text,
                                     phoneNumber, Globals.SecurityState.UserName);

                if (userID > 0)
                {
                    Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "Save was Successful.");
                    ShowUserDetail(userID);
                }
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
예제 #3
0
        private void ShowUserDetail(int userID)
        {
            ClearUserDetail();

            try {
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                    using (SqlDataReader dr = WSCEmployee.UserGetByID(conn, userID)) {
                        if (dr.Read())
                        {
                            txtUserName.Text    = dr.GetString(dr.GetOrdinal("usr_login_name"));
                            txtUserID.Text      = dr.GetInt16(dr.GetOrdinal("usr_user_id")).ToString();
                            txtDisplayName.Text = dr.GetString(dr.GetOrdinal("usr_display_name"));
                            txtPhoneNumber.Text = dr.GetString(dr.GetOrdinal("usr_phone_number"));
                        }
                    }
                }
            }
            catch (Exception ex) {
                Common.CException wex = new Common.CException("UserMaintenance.ShowUserDetail", ex);
                throw (wex);
            }
        }