Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         //ddlSelDocBoy.Items.Insert(0, new ListItem("--Select--", "-1"));
         if ((HttpContext.Current.Session["LoginId"]) == null)
         {
             Response.Redirect("~/Login.aspx");
         }
         if (!Page.IsPostBack)
         {
             lblPrjId.Text = Session["ProjectID"].ToString();
             txtDate.Text = DateTime.Now.Date.ToShortDateString();
             BLDocumentBoy blObjDocB = new BLDocumentBoy();
             SqlDataReader dr = blObjDocB.getDocumentBoy1();
             ddlSelDocBoy.Items.Clear();
             ddlSelDocBoy.Items.Insert(0, new ListItem("--Select--", "-1"));
             if (dr.HasRows)
             {
                 while (dr.Read())
                 {
                     string strcode = dr.GetString(1);
                     string strname = dr.GetString(2);
                     string strCodeName = strcode + " - " + strname;
                     ddlSelDocBoy.Items.Add(strCodeName);
                 }
             }
             else
             {
                 lblCatchError.Text = "";
             }
             dr.Close();
             fillgridDocBoyHistory();
             fillgridDocBoyHistoryDetails();
         }
         else
         {
             lblresult.Text = "";
             lblresult1.Text = "";
             lblCatchError.Text = "";
             lblErrorMsg.Text = "";
         }
     }
     catch (Exception ex)
     {
         lblCatchError.Text = ex.Message.ToString();
     }
 }
Exemplo n.º 2
0
        protected void GdVwViewDocumentBoy_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                BLDocumentBoy blc = new BLDocumentBoy();
                if (e.CommandName == "Editdocboy")
                {
                    GridViewRow gvr = (GridViewRow)((Control)e.CommandSource).NamingContainer;
                    int rowIndex = gvr.RowIndex;
                    int DocBoyId = Convert.ToInt32(GdVwViewDocumentBoy.Rows[rowIndex].Cells[1].Text);
                    Session["DocBoyId"] = DocBoyId;
                    SqlDataReader dr2 = blc.getDocBoyDetailsForUpdate1(DocBoyId);
                    if (dr2.HasRows == true)
                    {
                        while (dr2.Read())
                        {
                            txtCodeDocBoy.Enabled = false;
                            txtNameDocBoy.Enabled = false;
                            btnClearDocBoy.Enabled = false;
                            txtNameDocBoy.Text = dr2.GetString(1);
                            txtMobileDocBoy.Text = dr2.GetString(2);
                            txtCodeDocBoy.Text = dr2.GetString(4);
                            if (dr2["MailID"] == DBNull.Value)
                            {
                                txtMailIDDocBoy.Text = "";
                            }
                            else
                            {
                                txtMailIDDocBoy.Text = dr2.GetString(6);
                            }
                            bool isdel = dr2.GetBoolean(3);
                            if (isdel == true)
                                rbYesIsDelDocBoy.Checked = true;
                            else
                                rbNoIsDelDocBoy.Checked = true;
                            int approve = dr2.GetInt32(5);
                            if (approve == 1)
                                ChkBxApprovDocBoy.Checked = true;
                            else
                                ChkBxApprovDocBoy.Checked = false;
                            if (txtMobileDocBoy.Text == "-")
                            {
                                txtMobileDocBoy.Text = "";
                            }
                        }
                        dr2.Close();
                    }

                }
            }
            catch (Exception ex)
            {
                lblCatchError.Text = ex.Message.ToString();
            }
        }
Exemplo n.º 3
0
 protected void ddlDocBoy_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         BLDocumentBoy bldb = new BLDocumentBoy();
         string strName = Convert.ToString(ddlDocBoy.SelectedItem.Text);
         SqlDataReader dr = bldb.getDocBoyCode1(strName);
         if (dr.HasRows == true)
         {
             while (dr.Read())
                 txtCode1.Text = dr.GetString(1);
             dr.Close();
         }
         if (ddlDocBoy.SelectedItem.Text == "--Select--")
         {
             txtCode1.Text = "";
         }
         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 = "getDocBoyCode";
         param = new SqlParameter("@Name", ddlDocBoy.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)
         {
             GdVwViewDocumentBoy.DataSource = ds.Tables[0];
             GdVwViewDocumentBoy.DataBind();
         }
         else
         {
             lblErrorMsg.Text = "Records not available";
             GdVwViewDocumentBoy.DataSource = null;
             GdVwViewDocumentBoy.DataBind();
         }
         con.Close();
     }
     catch (Exception ex)
     {
         lblCatchError.Text = ex.Message.ToString();
     }
 }
Exemplo n.º 4
0
 protected void ddlApprovDocBoy_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (ddlApprovDocBoy.SelectedItem.Text == "--Select--")
         {
             GdVwViewDocumentBoy.DataSource = null;
             GdVwViewDocumentBoy.DataBind();
         }
         else
         {
             string strName = ddlDocBoy.SelectedItem.Text;
             int intApprove = int.Parse(ddlApprovDocBoy.SelectedItem.Value);
             if (ddlDocBoy.SelectedItem.Text == "--Select--" && ddlApprovDocBoy.SelectedItem.Text != "--Select--")
             {
                 BLDocumentBoy blpr = new BLDocumentBoy();
                 SqlDataReader dr = blpr.gridFillApproveDocumentBoy1(intApprove);
                 DataTable dt = new DataTable();
                 if (dr.HasRows == true)
                 {
                     dt.Load(dr);
                     GdVwViewDocumentBoy.DataSource = dt;
                     GdVwViewDocumentBoy.DataBind();
                 }
                 else
                 {
                     lblErrorMsg.Text = "Records not Available";
                     GdVwViewDocumentBoy.DataSource = dt;
                     GdVwViewDocumentBoy.DataBind();
                 }
                 dr.Close();
             }
             if (ddlDocBoy.SelectedItem.Text != "--Select--" && ddlApprovDocBoy.SelectedItem.Text != "--Select--")
             {
                 BLDocumentBoy blpr = new BLDocumentBoy();
                 SqlDataReader dr = blpr.gridFillApproveDocumentBoyName1(strName, intApprove);
                 DataTable dt = new DataTable();
                 if (dr.HasRows == true)
                 {
                     dt.Load(dr);
                     GdVwViewDocumentBoy.DataSource = dt;
                     GdVwViewDocumentBoy.DataBind();
                 }
                 else
                 {
                     lblErrorMsg.Text = "Records not Available";
                     GdVwViewDocumentBoy.DataSource = dt;
                     GdVwViewDocumentBoy.DataBind();
                 }
                 dr.Close();
             }
         }
     }
     catch (Exception ex)
     {
         lblCatchError.Text = ex.Message.ToString();
     }
 }
Exemplo n.º 5
0
 protected void ChkbxShowDeletedDocBoy_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         string strName = ddlDocBoy.SelectedItem.Text;
         // int intApprove = int.Parse(ddlApprovDocBoy.SelectedItem.Value);
         int intIsDeleted;
         if (ChkbxShowDeletedDocBoy.Checked == true)
             intIsDeleted = 1;
         else
             intIsDeleted = 0;
         if (ddlDocBoy.SelectedItem.Text == "--Select--" && ddlApprovDocBoy.SelectedItem.Text == "--Select--" && (ChkbxShowDeletedDocBoy.Checked == true || ChkbxShowDeletedDocBoy.Checked == false))
         {
             BLDocumentBoy blpr = new BLDocumentBoy();
             SqlDataReader dr = blpr.isDelDocBoyChecked1(intIsDeleted);
             DataTable dt = new DataTable();
             if (dr.HasRows == true)
             {
                 dt.Load(dr);
                 GdVwViewDocumentBoy.DataSource = dt;
                 GdVwViewDocumentBoy.DataBind();
             }
             else
             {
                 lblErrorMsg.Text = "Records not Available";
                 GdVwViewDocumentBoy.DataSource = null;
                 GdVwViewDocumentBoy.DataBind();
             }
             dr.Close();
         }
         if (ddlDocBoy.SelectedItem.Text != "--Select--" && ddlApprovDocBoy.SelectedItem.Text == "--Select--" && (ChkbxShowDeletedDocBoy.Checked == true || ChkbxShowDeletedDocBoy.Checked == false))
         {
             BLDocumentBoy blpr = new BLDocumentBoy();
             SqlDataReader dr = blpr.isDelDocBoyNameChecked1(strName, intIsDeleted);
             DataTable dt = new DataTable();
             if (dr.HasRows == true)
             {
                 dt.Load(dr);
                 GdVwViewDocumentBoy.DataSource = dt;
                 GdVwViewDocumentBoy.DataBind();
             }
             else
             {
                 lblErrorMsg.Text = "Records not Available";
                 GdVwViewDocumentBoy.DataSource = null;
                 GdVwViewDocumentBoy.DataBind();
             }
             dr.Close();
         }
         if (ddlDocBoy.SelectedItem.Text != "--Select--" && ddlApprovDocBoy.SelectedItem.Text != "--Select--" && (ChkbxShowDeletedDocBoy.Checked == true || ChkbxShowDeletedDocBoy.Checked == false))
         {
             int intApprove = int.Parse(ddlApprovDocBoy.SelectedItem.Value);
             BLDocumentBoy blpr = new BLDocumentBoy();
             SqlDataReader dr = blpr.isDelDocBoyNameAppChecked1(strName, intApprove, intIsDeleted);
             DataTable dt = new DataTable();
             if (dr.HasRows == true)
             {
                 dt.Load(dr);
                 GdVwViewDocumentBoy.DataSource = dt;
                 GdVwViewDocumentBoy.DataBind();
             }
             else
             {
                 lblErrorMsg.Text = "Records not Available";
                 GdVwViewDocumentBoy.DataSource = null;
                 GdVwViewDocumentBoy.DataBind();
             }
             dr.Close();
         }
     }
     catch (Exception ex)
     {
         lblCatchError.Text = ex.Message.ToString();
     }
 }
Exemplo n.º 6
0
        protected void btnSaveDocBoy_Click(object sender, EventArgs e)
        {
            try
            {
                BLDocumentBoy bldb = new BLDocumentBoy();
                SqlDataReader dr = bldb.getDocBoyDetailsForUpdate1(intDocumentBoyID);
                setparameters();
                if (Session["DocBoyId"] != null)
                {
                    setparameters();
                    intDocumentBoyID = int.Parse(Session["DocBoyId"].ToString()); //int.Parse(Request.QueryString["DocBoyId"]);
                    bldb.updateDocumentBoy1(intDocumentBoyID, strMobile, intIsDeleted, intApprove, strMailID);
                    fillgrid();
                    lblResult.Visible = true;
                    lblResult.ForeColor = System.Drawing.Color.Green;
                    lblResult.Text = "Document Boys Details are Updated Successfully";
                    txtNameDocBoy.Enabled = true;
                    btnClearDocBoy.Enabled = true;
                    fillgrid();
                    Session["DocBoyId"] = null;
                    getMaxCode();
                }
                else
                {
                    string msg = bldb.saveDocumentBoy1(strName, strMobile, intIsDeleted, strCode, intApprove, strMailID); //mail id added
                    fillgrid();
                    if (msg == "1")
                    {
                        lblResult.Visible = true;
                        lblResult.ForeColor = System.Drawing.Color.Green;
                        lblResult.Text = "Document Boy Details Details are Added Successfully";
                        fillDDLDocBoy();
                    }
                    else
                    {
                        lblResult.Visible = true;
                        lblResult.ForeColor = System.Drawing.Color.Red;
                        lblResult.Text = "Document Boy Details Details are already Exists";
                    }

                    fillgrid();
                    Session["DocBoyId"] = null;
                    getMaxCode();
                }
                ClearFields();
            }
            catch (Exception ex)
            {
                lblCatchError.Text = ex.Message.ToString();
            }
        }