Esempio n. 1
0
        protected void btnSaveAddEmp_Click(object sender, EventArgs e)
        {
            BLEmployee bldb = new BLEmployee();
            setparameters();
            if (Request.QueryString["EmpId"] != null)
            {
                intEmployeeID = int.Parse(Request.QueryString["EmpId"]);
               bldb.updateEmployee1(intEmployeeID, strAddress1, strAddress2, strAddress3, strPAN, strBankName, strBankAddress, strAccountNo, strBranch, strDesignation, intIsDeleted, strMobile, strTelephone, strEmailID, intApprove);
                lblResult.Visible = true;
                lblResult.Text = "Employee Details are Updated Successfully";
                txtEmpNm.Enabled = true;
                txtEmpCode.Enabled = true;
                setEmpCode();
                btnClearAddEmp.Enabled = true;

              }
            else
            {
                string msg = bldb.saveEmployee1(strEmployeeName, strEmployeeCode, strAddress1, strAddress2, strAddress3, strPAN, strBankName, strBankAddress, strAccountNo, strBranch, strDesignation, intIsDeleted, strMobile, strTelephone, strEmailID, intApprove);
                if (msg == "1")
                {
                    lblResult.Visible = true;
                    lblResult.ForeColor = System.Drawing.Color.Green;
                    lblResult.Text = "Employee Details are Added Successfully";
                }
                else
                {
                    lblResult.Visible = true;
                    lblResult.ForeColor = System.Drawing.Color.Red;
                    lblResult.Text = "Employee Details are already Exists.";
                }
                setEmpCode();
             }

            ClearFields();
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if ((HttpContext.Current.Session["LoginId"]) == null)
                {
                    Response.Redirect("~/Login.aspx");
                }
                if (!Page.IsPostBack)
                {
                    lblResult.Text = "";
                    SqlConnection con = new SqlConnection(connstr);
                    con.Open();
                    setEmpCode();
                    if (Request.QueryString["EmpId"] != null)
                    {
                        lblEmpId.Text = Request.QueryString["EmpId"].ToString();
                        int intEmployeeID = int.Parse(lblEmpId.Text);
                        BLEmployee blc = new BLEmployee();
                        SqlDataReader dr2 = blc.getEmpDetailsForUpdate1(intEmployeeID);
                        if (dr2.HasRows)
                        {
                            while (dr2.Read())
                            {
                                txtEmpNm.Enabled = false;
                                txtEmpCode.Enabled = false;
                                btnClearAddEmp.Enabled = false;
                                txtEmpNm.Text = dr2.GetString(1);
                                txtEmpCode.Text = dr2.GetString(2);
                                txtAddressL1.Text = dr2.GetString(3);
                                txtAddressL2.Text = dr2.GetString(4);
                                txtAddressL3.Text = dr2.GetString(5);
                                txtPanNo.Text = dr2.GetString(6);
                                txtBnkNm.Text = dr2.GetString(7);
                                txtBnkAddress.Text = dr2.GetString(8);
                                txtAccNo.Text = dr2.GetString(9);
                                txtBranch.Text = dr2.GetString(10);
                                txtDesig.Text = dr2.GetString(11);
                                txtMobEmp.Text = dr2.GetString(13);
                                txtTelephn.Text = dr2.GetString(14);
                                txtEmail.Text = dr2.GetString(15);

                                bool isdel = dr2.GetBoolean(12);
                                if (isdel == true)
                                    rbYes.Checked = true;
                                else
                                    rbNo.Checked = true;
                                int approve = dr2.GetInt32(16);
                                if (approve == 1)
                                    chkBxApprove.Checked = true;
                                else
                                    chkBxApprove.Checked = false;
                                if (txtMobEmp.Text == "-")
                                {
                                    txtMobEmp.Text = "";
                                }
                                if (txtTelephn.Text == "-")
                                {
                                    txtTelephn.Text = "";
                                }
                                if (txtEmail.Text == "-")
                                {
                                    txtEmail.Text = "";
                                }
                            }

                        }
                        dr2.Close();
                    }
                }
                else
                {
                    lblCatchError.Text = "";
                    lblResult.Text = "";
                }

            }
            catch (Exception ex)
            {
                lblCatchError.Text = ex.Message.ToString();
            }
        }
Esempio n. 3
0
 protected void ChkbxShowDeletedEmp_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         string strEmployeeName = ddlEmpNameVwEmp.SelectedItem.Text;
         int intIsDeleted;
         if (ChkbxShowDeletedEmp.Checked == true)
             intIsDeleted = 1;
         else
             intIsDeleted = 0;
         if (ddlEmpNameVwEmp.SelectedItem.Text == "--Select--" && ddlApproveEmp.SelectedItem.Text == "--Select--" && (ChkbxShowDeletedEmp.Checked == true || ChkbxShowDeletedEmp.Checked == false))
         {
             BLEmployee blpr = new BLEmployee();
             SqlDataReader dr = blpr.isDelEmpChecked1(intIsDeleted);
             DataTable dt = new DataTable();
             if (dr.HasRows == true)
             {
                 dt.Load(dr);
                 GdVwViewEmp.DataSource = dt;
                 GdVwViewEmp.DataBind();
             }
             else
             {
                 lblErrorMsg.Text = "Records not Available";
                 GdVwViewEmp.DataSource = null;
                 GdVwViewEmp.DataBind();
             }
             dr.Close();
         }
         if (ddlEmpNameVwEmp.SelectedItem.Text != "--Select--" && ddlApproveEmp.SelectedItem.Text == "--Select--" && (ChkbxShowDeletedEmp.Checked == true || ChkbxShowDeletedEmp.Checked == false))
         {
             BLEmployee blpr = new BLEmployee();
             SqlDataReader dr = blpr.isDelEmpNameChecked1(strEmployeeName, intIsDeleted);
             DataTable dt = new DataTable();
             if (dr.HasRows == true)
             {
                 dt.Load(dr);
                 GdVwViewEmp.DataSource = dt;
                 GdVwViewEmp.DataBind();
             }
             else
             {
                 lblErrorMsg.Text = "Records not Available";
                 GdVwViewEmp.DataSource = null;
                 GdVwViewEmp.DataBind();
             }
             dr.Close();
         }
         if (ddlEmpNameVwEmp.SelectedItem.Text != "--Select--" && ddlApproveEmp.SelectedItem.Text != "--Select--" && (ChkbxShowDeletedEmp.Checked == true || ChkbxShowDeletedEmp.Checked == false))
         {
             int intApprove = int.Parse(ddlApproveEmp.SelectedItem.Value);
             BLEmployee blpr = new BLEmployee();
             SqlDataReader dr = blpr.isDelEmpNameAppChecked1(strEmployeeName, intApprove, intIsDeleted);
             DataTable dt = new DataTable();
             if (dr.HasRows == true)
             {
                 dt.Load(dr);
                 GdVwViewEmp.DataSource = dt;
                 GdVwViewEmp.DataBind();
             }
             else
             {
                 lblErrorMsg.Text = "Records not Available";
                 GdVwViewEmp.DataSource = null;
                 GdVwViewEmp.DataBind();
             }
             dr.Close();
         }
     }
     catch (Exception ex)
     {
         lblCatchError.Text = ex.Message.ToString();
     }
 }
Esempio n. 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if ((HttpContext.Current.Session["LoginId"]) == null)
         {
             Response.Redirect("~/Login.aspx");
         }
         if (!Page.IsPostBack)
         {
             BLEmployee blsr = new BLEmployee();
             SqlDataReader dr = blsr.getEmployeeName1();
             ddlEmpNameVwEmp.Items.Clear();
             ddlEmpNameVwEmp.Items.Add("--Select--");
             if (dr.HasRows == true)
             {
                 while (dr.Read())
                     ddlEmpNameVwEmp.Items.Add(dr.GetString(0));
             }
             else
             {
                 lblErrorMsg.Text = "Records not available";
                 fillgrid();
             }
             dr.Close();
             fillgrid();
         }
         else
         {
             lblCatchError.Text = "";
             lblErrorMsg.Text = "";
         }
     }
     catch (Exception ex)
     {
         lblCatchError.Text = ex.Message.ToString();
     }
 }
Esempio n. 5
0
        protected void ddlEmpNameVwEmp_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                BLEmployee blaee = new BLEmployee();
                string strEmployeeName = Convert.ToString(ddlEmpNameVwEmp.SelectedItem.Text);
                SqlDataReader dr = blaee.getEmployeeCode1(strEmployeeName);
                //ddlEmpNameVwEmp.Items.Clear();
                while (dr.Read())
                    txtEmpCodeVwEmp.Text = dr.GetString(0);

                SqlConnection con = new SqlConnection(connstr);
                SqlCommand cmd = new SqlCommand();
                SqlParameter param;
                DataSet ds = new DataSet();
                con.Open();
                cmd.Connection = con;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "getEmpNameEmployee";
                param = new SqlParameter("@EmployeeName", ddlEmpNameVwEmp.SelectedItem.Text);
                param.Direction = ParameterDirection.Input;
                param.DbType = DbType.String;
                cmd.Parameters.Add(param);
                da = new SqlDataAdapter(cmd);
                da.Fill(ds);
                if (ds.Tables[0].Rows.Count != 0)
                {
                    GdVwViewEmp.DataSource = ds.Tables[0];
                    GdVwViewEmp.DataBind();
                }
                else
                {
                    lblErrorMsg.Text = "Records not available";
                    GdVwViewEmp.DataSource = null;
                    GdVwViewEmp.DataBind();
                }
                con.Close();
                if (ddlEmpNameVwEmp.SelectedItem.Text == "--Select--")
                {
                    txtEmpCodeVwEmp.Text = "";
                }
                con.Close();
            }
            catch (Exception ex)
            {
                lblCatchError.Text = ex.Message.ToString();
            }
        }
Esempio n. 6
0
 protected void ddlApproveEmp_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ddlApproveEmp.SelectedItem.Text == "--Select--")
     {
         GdVwViewEmp.DataSource = null;
         GdVwViewEmp.DataBind();
     }
     else
     {
         string strEmployeeName = ddlEmpNameVwEmp.SelectedItem.Text;
         int intApprove = int.Parse(ddlApproveEmp.SelectedItem.Value);
         if (ddlEmpNameVwEmp.SelectedItem.Text == "--Select--" && ddlApproveEmp.SelectedItem.Text != "--Select--")
         {
             txtEmpCodeVwEmp.Text = null;
             BLEmployee blpr = new BLEmployee();
             SqlDataReader dr = blpr.gridFillApproveEmp1(intApprove);
             DataTable dt = new DataTable();
             if (dr.HasRows == true)
             {
                 dt.Load(dr);
                 GdVwViewEmp.DataSource = dt;
                 GdVwViewEmp.DataBind();
             }
             else
             {
                 lblErrorMsg.Text = "Records not Available";
                 GdVwViewEmp.DataSource = null;
                 GdVwViewEmp.DataBind();
             }
             dr.Close();
         }
         if (ddlEmpNameVwEmp.SelectedItem.Text != "--Select--" && ddlApproveEmp.SelectedItem.Text != "--Select--")
         {
             BLEmployee blpr = new BLEmployee();
             SqlDataReader dr = blpr.gridFillApproveEmpName1(strEmployeeName, intApprove);
             DataTable dt = new DataTable();
             if (dr.HasRows == true)
             {
                 dt.Load(dr);
                 GdVwViewEmp.DataSource = dt;
                 GdVwViewEmp.DataBind();
             }
             else
             {
                 lblErrorMsg.Text = "Records not Available";
                 GdVwViewEmp.DataSource = null;
                 GdVwViewEmp.DataBind();
             }
             dr.Close();
         }
     }
 }