Example #1
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();
            }
        }
Example #2
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();
            }
        }