예제 #1
0
 protected void btnCancelDamangedLeaf_Click(object sender, EventArgs e)
 {
     try
     {
         divDamangedLeaf.Visible = false;
         ModalPopupAddDamaged.Hide();
     }
     catch (Exception ex)
     {
         TroyLiteExceptionManager.HandleException(ex);
     }
 }
예제 #2
0
    protected void SaveDamangedLeafButton_Click(object sender, EventArgs e)
    {
        string connection = Request.Cookies["Company"].Value;
        string UserID     = Request.Cookies["LoggedUserName"].Value;

        sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString();
        int BookId       = int.Parse(hdBookID.Value);
        int bookStart    = 0;
        int bookEnd      = 0;
        int damangedLeaf = int.Parse(txtDamagedLeaf.Text);

        BusinessLogic bl = new BusinessLogic(sDataSource);

        DataSet ds = bl.GetManualSaleBookInfoForId(sDataSource, BookId);

        bookStart = int.Parse(ds.Tables[0].Rows[0]["BookFrom"].ToString());
        bookEnd   = int.Parse(ds.Tables[0].Rows[0]["BookTo"].ToString());

        if (damangedLeaf >= bookStart && damangedLeaf <= bookEnd)
        {
            if (!bl.IsDamangedLeafAlreadyEntered(sDataSource, BookId, damangedLeaf))
            {
                bl.InsertManualSalesLeaf(sDataSource, BookId, damangedLeaf, txtComments.Text, UserID);

                divDamangedLeaf.Visible = false;
                txtDamagedLeaf.Text     = string.Empty;
                txtComments.Text        = string.Empty;
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Leaf Details Saved Successfully.');", true);
            }
            else
            {
                divDamangedLeaf.Visible = false;
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Leaf Details already added for this book.');", true);
            }
        }
        else
        {
            divDamangedLeaf.Visible = true;
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Incorrect Leaf Details, please check the leaf no and try again.');", true);
            ModalPopupAddDamaged.Show();
        }
    }
예제 #3
0
    protected void GrdViewManualBook_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (((System.Web.UI.WebControls.Image)(e.CommandSource as ImageButton)).ID == "btnShowUnusedLeafs")
        {
            GridViewRow row      = (GridViewRow)((Control)e.CommandSource).NamingContainer;
            int         rowIndex = row.RowIndex;

            int BookId = Convert.ToInt32(GrdViewManualBook.DataKeys[rowIndex].Value.ToString());

            sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString();
            BusinessLogic bl = new BusinessLogic(sDataSource);

            DataSet ds = bl.ListManualSalesBookInfo(sDataSource, BookId);
            gridViewUnUsedLeafs.DataSource = ds;
            gridViewUnUsedLeafs.DataBind();

            ModalPopupUnused.Show();
        }
        else if (((System.Web.UI.WebControls.Image)(e.CommandSource as ImageButton)).ID == "btnAddDamagedLeaf")
        {
            //frmViewAdd.Visible = true;
            //frmViewAdd.ChangeMode(FormViewMode.Edit);
            //GrdViewBranches.Columns[8].Visible = false;
            //lnkBtnAdd.Visible = false;
            divDamangedLeaf.Visible = true;
            ModalPopupAddDamaged.Show();
            //ModalPopupExtender1.Hide();
            GridViewRow row      = (GridViewRow)((Control)e.CommandSource).NamingContainer;
            int         rowIndex = row.RowIndex;

            hdBookID.Value = GrdViewManualBook.DataKeys[rowIndex].Value.ToString();
            //if (frmViewAdd.CurrentMode == FormViewMode.Edit)
            //    Accordion1.SelectedIndex = 1;
        }
        else if (((System.Web.UI.WebControls.Image)(e.CommandSource as ImageButton)).ID == "btnEdit")
        {
            GridViewRow row = GrdViewManualBook.SelectedRow;

            try
            {
                int BookId = Convert.ToInt32(GrdViewManualBook.SelectedDataKey.Value);

                sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString();
                BusinessLogic bl = new BusinessLogic(sDataSource);

                DataSet ds = bl.GetManualSaleBookInfoForId(sDataSource, BookId);

                if (ds != null)
                {
                    hdVisitID.Value = Convert.ToString(BookId);

                    txtBookNameAdd.Text = ds.Tables[0].Rows[0]["BookName"].ToString();
                    txtFromNoAdd.Text   = ds.Tables[0].Rows[0]["BookFrom"].ToString();
                    txtBookToAdd.Text   = ds.Tables[0].Rows[0]["BookTo"].ToString();

                    UpdateButton.Visible = true;
                    SaveButton.Visible   = false;
                    CancelButton.Visible = true;
                    lnkBtnAdd.Visible    = false;
                    //MyAccordion.Visible = false;

                    GrdViewManualBook.Visible = false;
                    pnlVisitDetails.Visible   = true;

                    ModalPopupExtender1.Show();
                }
            }
            catch (Exception ex)
            {
                TroyLiteExceptionManager.HandleException(ex);
            }
        }
    }