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
 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. 9
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);
        }