Esempio n. 1
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        int InsertRow = 0;

        try
        {
            DS = Obj_PR.ChkDuplicate(TxtDepartment.Text.Trim(), out StrError);
            if (DS.Tables[0].Rows.Count > 0)
            {
                obj_Comm.ShowPopUpMsg("City Already Exist..!", this.Page);
                TxtDepartment.Focus();
            }
            else
            {
                Entity_PR.City      = TxtDepartment.Text.Trim();
                Entity_PR.LoginId   = Convert.ToInt32(Session["UserId"]);
                Entity_PR.LoginDate = DateTime.Now;
                InsertRow           = Obj_PR.InsertRecord(ref Entity_PR, out StrError);

                if (InsertRow != 0)
                {
                    obj_Comm.ShowPopUpMsg("Record Saved Successfully", this.Page);
                    MakeEmptyForm();
                    Entity_PR = null;
                    obj_Comm  = null;
                }
            }
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
Esempio n. 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (this.IsPostBack == false)
     {
         this.Form.DefaultButton = BtnAdd.UniqueID;
         TxtDepartment.Focus();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (this.IsPostBack == false)
     {
         TxtDepartment.Focus();
         this.Form.DefaultButton = BtnUpdate.UniqueID;
         MyJobPortalModel.Department ObjDepartment = new MyJobPortalModel.Department(int.Parse(Request.QueryString["Id"]));
         TxtDepartment.Text      = ObjDepartment.DepartmentName;
         DdlStatus.SelectedValue = ObjDepartment.Status;
     }
 }
Esempio n. 4
0
    private void MakeEmptyForm()
    {
        TxtDepartment.Focus();
        if (!FlagAdd)
        {
            BtnSave.Visible = true;
        }
        BtnUpdate.Visible  = false;
        BtnDelete.Visible  = false;
        TxtDepartment.Text = string.Empty;
        TxtSearch.Text     = string.Empty;

        ReportGrid(StrCondition);
    }
Esempio n. 5
0
        private void TxtDepartment_Validating(object sender, CancelEventArgs e)
        {
            if (_Tag == "" || ActiveControl == TxtDepartment)
            {
                return;
            }

            if (TxtDepartment.Enabled == false)
            {
                return;
            }

            if (ClsGlobal.PurchaseMDepartmentControlVal == 'Y' && string.IsNullOrEmpty(TxtDepartment.Text))
            {
                MessageBox.Show("Department cannot be left blank.", "Mr solution", MessageBoxButtons.OK, MessageBoxIcon.Information);
                TxtDepartment.Focus();
            }
        }
Esempio n. 6
0
    protected void GrdReport_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        try
        {
            switch (e.CommandName)
            {
            case ("Select"):
            {
                if (Convert.ToInt32(e.CommandArgument) != 0)
                {
                    ViewState["EditID"] = Convert.ToInt32(e.CommandArgument);
                    DS = Obj_PR.GetDepartmentForEdit(Convert.ToInt32(e.CommandArgument), out StrError);
                    if (DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0)
                    {
                        TxtDepartment.Text = DS.Tables[0].Rows[0]["City"].ToString();
                    }
                    else
                    {
                        MakeEmptyForm();
                    }
                    DS     = null;
                    Obj_PR = null;
                    if (!FlagEdit)
                    {
                        BtnUpdate.Visible = true;
                    }
                    BtnSave.Visible = false;
                    if (!FlagDel)
                    {
                        BtnDelete.Visible = true;
                    }
                    TxtDepartment.Focus();
                }

                break;
            }
            }
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
Esempio n. 7
0
        /***************************************
        *
        *  This is where the UTILITY METHODS are.
        *
        ***************************************/

        /// <summary>
        /// This clears the form after an entry is added.
        /// </summary>
        private void ClearForm()
        {
            TxtEmpID.Clear();
            TxtFirstName.Clear();
            TxtLastName.Clear();
            TxtMiddleName.Clear();
            TxtXtraProp1.Clear();
            TxtXtraProp2.Clear();
            CkbActiveEmployee.Checked = true;
            CkbBenefits.Checked       = true;
            CkbApproved.Checked       = true;
            LVxCourses.Items.Clear();
            TxtCourseID.Clear();
            TxtGrade.Clear();
            TxtDescription.Clear();
            TxtDateApproved.Clear();
            TxtCredits.Clear();
            TxtMaritalStatus.Clear();
            TxtDepartment.Clear();
            TxtTitle.Clear();
            TxtStartDate.Clear();
        }
Esempio n. 8
0
 private void GetEditRecord()
 {
     if (DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0)
     {
         TxtDepartment.Text = DS.Tables[0].Rows[0]["City"].ToString();
     }
     else
     {
         MakeEmptyForm();
     }
     DS     = null;
     Obj_PR = null;
     if (!FlagEdit)
     {
         BtnUpdate.Visible = true;
     }
     BtnSave.Visible = false;
     if (!FlagDel)
     {
         BtnDelete.Visible = true;
     }
     TxtDepartment.Focus();
 }
    protected void BtnUpdate_Click(object sender, EventArgs e)
    {
        if (this.IsValid == true)
        {
            bool      AllOk = true;
            DataTable ObjDepartmentTable = MyJobPortalModel.Department.GetDepartmentRecords("DepartmentName ='" + TxtDepartment.Text.Replace("'", "''").Trim() + "' and Id<>" + Request.QueryString["Id"]);

            if ((int)ObjDepartmentTable.Rows.Count > 0)
            {
                LblDuplicateDepartmentError.Visible = true;
                AllOk = false;
                TxtDepartment.Focus();
                return;
            }
            if (AllOk == true)
            {
                MyJobPortalModel.Department ObjDepartment = new MyJobPortalModel.Department(int.Parse(Request.QueryString["Id"]));
                ObjDepartment.DepartmentName = TxtDepartment.Text.Replace("'", "''");
                ObjDepartment.Status         = DdlStatus.SelectedValue;
                ObjDepartment.Update();
                Response.Redirect("DepartmentList.aspx?Message=Record has been Updated");
            }
        }
    }
Esempio n. 10
0
        } // end method UpdateCurrEmp()

        /// <summary>
        /// To change eligible fields & compensation types based on the selected emp type
        /// </summary>
        /// <param name="sender">The object generating the event</param>
        /// <param name="e">The event args</param>
        private void CBxType_SelectionChangeCommitted(object sender, EventArgs e)
        {
            //Show dialog prompting user that they are about to change the emp type
            //Results in a change of benefit & comp values
            DialogResult result = MessageBox.Show(TYPE_CHANGE_MSG, TYPE_CHANGE_CAPTION, MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            //If user does want to change the emp type
            if (result.Equals(DialogResult.Yes))
            {
                //Clear comp txt boxes
                TxtComp1.Clear();
                TxtComp2.Clear();
                TxtComp3.Clear();
                TxtDepartment.Clear();
                TxtTitle.Clear();

                //Determine selected emp type
                if (CBxType.Text.Equals(LITERAL_HOURLY))
                {
                    //Change eligible benefits
                    TxtOvertime.Text    = LITERAL_YES;
                    TxtCommission.Text  = LITERAL_NO;
                    TxtBenefits.Text    = LITERAL_NO;
                    TxtEduBenefits.Text = LITERAL_YES;

                    //Change comp types
                    LblComp1.Text    = LITERAL_HRY_RATE;
                    LblComp2.Visible = true;
                    TxtComp2.Visible = true;
                    LblComp2.Text    = LITERAL_HOURS_WORKED;
                    LblComp3.Visible = false;
                    TxtComp3.Visible = false;
                } // end if
                if (CBxType.Text.Equals(LITERAL_SALARY))
                {
                    //Change eligible benefits
                    TxtOvertime.Text    = LITERAL_NO;
                    TxtCommission.Text  = LITERAL_NO;
                    TxtBenefits.Text    = LITERAL_YES;
                    TxtEduBenefits.Text = LITERAL_YES;

                    //Change comp types
                    LblComp1.Text    = LITERAL_SAL_RATE;
                    LblComp2.Visible = false;
                    TxtComp2.Visible = false;
                    LblComp3.Visible = false;
                    TxtComp3.Visible = false;
                } // end if
                if (CBxType.Text.Equals(LITERAL_SALES))
                {
                    //Change eligible benefits
                    TxtOvertime.Text    = LITERAL_NO;
                    TxtCommission.Text  = LITERAL_YES;
                    TxtBenefits.Text    = LITERAL_YES;
                    TxtEduBenefits.Text = LITERAL_YES;

                    //Change comp types
                    LblComp1.Text    = LITERAL_SAL_RATE;
                    LblComp2.Text    = LITERAL_SRY_RATE;
                    LblComp2.Visible = true;
                    LblComp2.Text    = LITERAL_SRY_RATE;
                    TxtComp2.Visible = true;
                    LblComp3.Visible = true;
                    LblComp3.Text    = LITERAL_SALES;
                    TxtComp3.Visible = true;
                } // end if
                if (CBxType.Text.Equals(LITERAL_CONTRACT))
                {
                    //Change eligible benefits
                    TxtOvertime.Text    = LITERAL_NO;
                    TxtCommission.Text  = LITERAL_NO;
                    TxtBenefits.Text    = LITERAL_NO;
                    TxtEduBenefits.Text = LITERAL_NO;

                    //Change comp types
                    LblComp1.Text    = LITERAL_CON_RATE;
                    LblComp2.Visible = true;
                    LblComp2.Text    = LITERAL_AGENCY;
                    TxtComp2.Visible = true;
                    LblComp3.Visible = false;
                    TxtComp3.Visible = false;
                } // end if

                //Show request approval btn based on eduBfts eligibility & prior approval
                //If the emp now has education benefits (whether value has changed or not)
                if (TxtEduBenefits.Text.Equals(LITERAL_YES))
                {
                    //If the current emp already obtained eduBft approval
                    if (CurrEmp.EducationBenefitsApproved)
                    {
                        BtnEmpBenefits.Visible = true;
                    }    // end if
                    else // emp still needs approval
                    {
                        //Show approval request btn
                        BtnRequestApproval.Visible = true;
                    } // end else
                }     // end if
            }         // end if - DialogResult
        }             // end method CBxType_SelectionChangeCommitted()
Esempio n. 11
0
        /***************************************
        *
        *  This is where the EMPLOYEE DATA METHODS are.
        *
        ***************************************/

        /// <summary>
        /// This will check the shared values for all employee fields
        /// </summary>
        /// <param name="creatingEmployee"> This is the employee that needs to be saved.</param>
        /// <returns></returns>
        private bool CheckBaseValues(Employee creatingEmployee)
        {
            uint tempUint = 0;

            if (uint.TryParse(TxtEmpID.Text, out tempUint))
            {
                creatingEmployee.EmpID = tempUint;
            }
            else
            {
                LblStatus.Text = errorMessageUint;
                TxtEmpID.Focus();
                return(false);
            }

            if (TxtLastName.Text == "")
            {
                LblStatus.Text = "Last name cannot be empty.";
                TxtLastName.Focus();
                return(false);
            }

            if (TxtFirstName.Text == "")
            {
                LblStatus.Text = "First name cannot be empty.";
                TxtFirstName.Focus();
                return(false);
            }

            if (TxtMaritalStatus.Text == "")
            {
                LblStatus.Text = "Marital Status cannont be empty.";
                TxtMaritalStatus.Focus();
                return(false);
            }

            if (TxtDepartment.Text == "")
            {
                LblStatus.Text = "Department cannont be empty.";
                TxtDepartment.Focus();
                return(false);
            }

            if (TxtTitle.Text == "")
            {
                LblStatus.Text = "Title cannot be emtpy.";
                TxtTitle.Focus();
                return(false);
            }

            if (TxtStartDate.Text == "")
            {
                LblStatus.Text = "Start Date cannot be empty.";
                TxtStartDate.Focus();
                return(false);
            }

            /*
             * //Middle Name Not required.
             * if (TxtMiddleName.Text == "")
             * {
             *  LblStatus.Text = "Middle name cannot be empty.";
             *  TxtMiddleName.Focus();
             *  return false;
             * }
             */

            creatingEmployee.EmpType       = CbxEmployeeType.Text;
            creatingEmployee.FirstName     = TxtFirstName.Text;
            creatingEmployee.LastName      = TxtLastName.Text;
            creatingEmployee.MiddleName    = TxtMiddleName.Text;
            creatingEmployee.MaritalStatus = TxtMaritalStatus.Text;
            creatingEmployee.Department    = TxtDepartment.Text;
            creatingEmployee.Title         = TxtTitle.Text;
            creatingEmployee.StartDate     = TxtStartDate.Text;

            if (CkbBenefits.Checked)
            {
                creatingEmployee.Benefits = true;
            }
            else
            {
                creatingEmployee.Benefits = false;
            }

            if (CkbActiveEmployee.Checked)
            {
                creatingEmployee.ActiveEmployee = true;
            }
            else
            {
                creatingEmployee.ActiveEmployee = false;
            }
            return(true);
        }