Exemplo n.º 1
0
    //report purchase return
    protected void btnReport3_Click(object sender, EventArgs e)
    {
        try
        {
            DateTime startDate, endDate;
            DataSet  ds = new DataSet();

            string intTrans = "";
            string salesRet = "";
            string delNote  = "";

            string condi = "";

            intTrans = "NO";
            salesRet = "NO";
            delNote  = "NO";
            string Branch = DropDownList2.SelectedValue;
            if (optionrate.SelectedItem.Text == "5%")
            {
                condi = " And tblPurchaseItems.vat = 5";
            }
            else if (optionrate.SelectedItem.Text == "14.5%")
            {
                condi = " And tblPurchaseItems.vat = 14.5";
            }
            if (optionrate.SelectedItem.Text == "All")
            {
                condi = "";
            }

            startDate = Convert.ToDateTime(txtStartDate.Text.Trim());
            endDate   = Convert.ToDateTime(txtEndDate.Text.Trim());

            Response.Write("<script language='javascript'> window.open('ReportPurchaseReturnSaleTax1.aspx?Branch=" + Branch + "&condi=" + Server.UrlEncode(condi) + "&startdate=" + startDate + "&enddate=" + endDate + "' , 'window','height=700,width=1000,left=172,top=10,toolbar=yes,scrollbars=yes,resizable=yes');</script>");
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!Page.IsPostBack)
            {
                if (!Page.User.IsInRole("TMEREPORT"))
                {
                    RowTimeSheet.Visible = false;
                }

                if (!Page.User.IsInRole("WKRRPT"))
                {
                    RowWrokManagement.Visible = false;
                }
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Exemplo n.º 3
0
 protected void GrdViewPurchase_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         int TempPurchaseID = (Int32)GrdViewPurchase.SelectedDataKey.Value;
         if (Request.Cookies["Company"] != null)
         {
             sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString();
         }
         else
         {
             Response.Redirect("~/frm_Login.aspx");
         }
         BusinessLogic bl = new BusinessLogic(sDataSource);
         bl.RestorePurhase(TempPurchaseID);
         BindPurchase("0");
     }
     catch (Exception ex)
     {
         TroyLiteExceptionManager.HandleException(ex);
     }
 }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString();

            if (!Page.IsPostBack)
            {
                string connStr = string.Empty;

                if (Request.Cookies["Company"] != null)
                {
                    connStr = System.Configuration.ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString();
                }
                else
                {
                    Response.Redirect("~/Login.aspx");
                }

                string dbfileName = connStr.Remove(0, connStr.LastIndexOf(@"App_Data\") + 9);
                dbfileName = dbfileName.Remove(dbfileName.LastIndexOf(";Persist Security Info"));
                BusinessLogic objChk = new BusinessLogic();

                loadUserName();
                // BranchEnable_Disable();
                connection = Request.Cookies["Company"].Value;
                usernam    = Request.Cookies["LoggedUserName"].Value;

                if (objChk.CheckForOffline(Server.MapPath("Offline\\" + dbfileName + ".offline")))
                {
                    lnkBtnSave.Visible = false;
                }
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Exemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!Page.IsPostBack)
            {
                string connStr = string.Empty;


                GrdViewCust.PageSize = 8;

                //BindGrid();

                if (Request.Cookies["Company"] != null)
                {
                    connStr = System.Configuration.ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString();
                }
                else
                {
                    Response.Redirect("~/Login.aspx");
                }

                string dbfileName = connStr.Remove(0, connStr.LastIndexOf(@"App_Data\") + 9);
                dbfileName = dbfileName.Remove(dbfileName.LastIndexOf(";Persist Security Info"));
                BusinessLogic objChk = new BusinessLogic();

                if (objChk.CheckForOffline(Server.MapPath("Offline\\" + dbfileName + ".offline")))
                {
                    lnkBtnAdd.Visible = false;
                    GrdViewCust.Columns[2].Visible = false;
                    GrdViewCust.Columns[3].Visible = false;
                }
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Exemplo n.º 6
0
 protected void txtinipay_TextChanged(object sender, EventArgs e)
 {
     try
     {
         if (Convert.ToString(txtinipay.Text).Length > 0)
         {
             if (Convert.ToString(txtpuramt.Text).Length > 0)
             {
                 Txtlnamt.Text = Convert.ToString(Convert.ToDouble(txtpuramt.Text) - Convert.ToDouble(txtinipay.Text));
             }
             else
             {
                 Txtlnamt.Text = Convert.ToString(txtinipay.Text);
             }
             UpdatePanel4.Update();
         }
     }
     catch (Exception ex)
     {
         TroyLiteExceptionManager.HandleException(ex);
     }
 }
Exemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString();
            if (!IsPostBack)
            {
                txtStartDate.Text = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).ToShortDateString();

                DateTime indianStd = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.Now, "India Standard Time");
                string   dtaa      = Convert.ToDateTime(indianStd).ToString("dd/MM/yyyy");
                txtEndDate.Text = dtaa;

                //txtEndDate.Text = DateTime.Now.ToShortDateString();
            }
            // GeneratePL();
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Exemplo n.º 8
0
    protected void chkPayToAdd_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            RadioButtonList chk = (RadioButtonList)sender;

            if (chk.SelectedItem.Text == "Cheque")
            {
                Panel test = (Panel)frmViewAdd.FindControl("PanelBankAdd");
                test.Visible = true;
            }
            else
            {
                Panel test = (Panel)frmViewAdd.FindControl("PanelBankAdd");
                test.Visible = false;
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Exemplo n.º 9
0
    protected void opnbank_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            RadioButtonList chk = (RadioButtonList)sender;

            if (chk.SelectedItem.Text == "Bank")
            {
                ddlbank.Enabled     = true;
                ddlCustomer.Enabled = false;
            }
            else
            {
                ddlbank.Enabled     = false;
                ddlCustomer.Enabled = true;
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Exemplo n.º 10
0
 protected void gvLedger_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     try
     {
         if (e.Row.RowType == DataControlRowType.DataRow)
         {
             dDebit  = dDebit + Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "Debit"));
             dCredit = dCredit + Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "Credit"));
         }
         else if (e.Row.RowType == DataControlRowType.Footer)
         {
             lblSumDebit.Text  = dDebit.ToString("N2");
             lblSumCredit.Text = dCredit.ToString("N2");
             //e.Row.Cells[2].Text = dDebit.ToString("N2");
             //e.Row.Cells[3].Text = dCredit.ToString("N2");
         }
     }
     catch (Exception ex)
     {
         TroyLiteExceptionManager.HandleException(ex);
     }
 }
Exemplo n.º 11
0
    //protected void BtnEdit_Click(object sender, EventArgs e)
    //{
    //txtDesc.Visible = true;
    //BtnSave.Visible = true;

    //}

    protected void Btndelete_Click(object sender, EventArgs e)
    {
        try
        {
            BusinessLogic bl     = new BusinessLogic(sDataSource);
            DataSet       ds1    = new DataSet();
            string        qnamed = "";
            qnamed = ddlqueries.SelectedItem.Value;
            if (ddlqueries.SelectedValue != "0")
            {
                qnamed = ddlqueries.SelectedItem.Value;
            }
            bl.DeleteDataForSQL(sDataSource, qnamed);
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('SQL Report Deleted')", true);
            return;
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
            return;
        }
    }
    protected void manageLeaveSaveBtn_Click(object sender, EventArgs e)
    {
        try
        {
            int RoleId = Convert.ToInt32(txtManageLeaveRoleID.Value);

            DataTable dt = new DataTable();

            dt.Columns.Add("LeaveType_ID", typeof(int));
            dt.Columns.Add("Role_ID", typeof(int));
            dt.Columns.Add("EffectiveDate", typeof(DateTime));
            dt.Columns.Add("AllowedCount", typeof(int));

            for (int i = 0; i < ManageLeaveGridView.Rows.Count; i++)
            {
                TextBox LeaveEffDate = ManageLeaveGridView.Rows[i].FindControl("txtLeaveEffDate") as TextBox;

                TextBox LeaveCount = ManageLeaveGridView.Rows[i].FindControl("txtLeaveCountAdd") as TextBox;

                Label LeaveTypeID = ManageLeaveGridView.Rows[i].FindControl("txtLeaveTypeID") as Label;

                dt.Rows.Add(LeaveTypeID.Text, RoleId, LeaveEffDate.Text, LeaveCount.Text);
            }

            BusinessLogic bl = new BusinessLogic(sDataSource);

            bl.InsertEmployeeRoleLeave(dt, RoleId);

            StringBuilder scriptMsg = new StringBuilder();
            scriptMsg.Append("alert('Employee Role Leave Saved Successfully.');");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), scriptMsg.ToString(), true);
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);

            ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert(Failed :" + ex.Message.ToString() + "');", true);
        }
    }
Exemplo n.º 13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            objBL       = new BusinessLogic(ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString());
            sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString();

            if (!Page.IsPostBack)
            {
                DateTime dtCurrent = DateTime.Now;
                DateTime dtNew     = new DateTime(dtCurrent.Year, dtCurrent.Month, 1);
                txtSrtDate.Text = string.Format("{0:dd/MM/yyyy}", dtNew);

                //txtSrtDate.Text = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).ToShortDateString();
                txtEdDate.Text = DateTime.Now.ToShortDateString();
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Exemplo n.º 14
0
    protected void ddSMSTemplate_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            BusinessLogic bl = new BusinessLogic(sDataSource);
            DataSet       ds = new DataSet();
            ds = bl.GetSMSText(sDataSource, ddSMSTemplate.SelectedValue);

            if (ds != null)
            {
                txtMessage.Text = ds.Tables[0].Rows[0][1].ToString();
            }
            else
            {
                txtMessage.Text = "";
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Exemplo n.º 15
0
    //protected void GrdViewSales_PageIndexChanging(object sender, GridViewPageEventArgs e)
    //{
    //    GrdViewItems.PageIndex = e.NewPageIndex;
    //    GrdViewItems.DataBind();
    //}

    protected void GrdViewItems_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        try
        {
            double      arrQty = 0;
            double      accQty = 0;
            GridViewRow row    = e.Row;
            accQty = Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "Stock"));
            arrQty = Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "ArrStock"));
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                if (arrQty == accQty)
                {
                    row.Visible = false;
                }
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Exemplo n.º 16
0
    protected void GrdViewLeadContact_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            DataSet     ds  = new DataSet();
            GridViewRow row = GrdViewLeadContact.SelectedRow;

            hdCurrentRow.Value = Convert.ToString(row.DataItemIndex);

            txtContactedDate.Text  = row.Cells[1].Text;
            txtContactSummary.Text = row.Cells[2].Text;
            if (row.Cells[3].Text == "NO")
            {
                ComboBox2.SelectedValue = "1";
                rowcall.Visible         = false;
            }
            else
            {
                ComboBox2.SelectedValue = "2";
                rowcall.Visible         = true;
            }

            if (row.Cells[4].Text == "&nbsp;")
            {
                txtcallback.Text = "";
            }
            else
            {
                txtcallback.Text = row.Cells[4].Text;
            }
            cmdSaveContact.Visible   = false;
            cmdUpdateContact.Visible = true;
            ModalPopupContact.Show();
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Exemplo n.º 17
0
    protected void GrdSMSText_DataBound(object sender, EventArgs e)
    {
        try
        {
            GrdSMSText.Rows[0].Visible = false;

            if (GrdSMSText.Rows.Count == 1 && !GrdSMSText.FooterRow.Visible)
            {
                GrdSMSText.Columns[0].HeaderText = "No Text found.";
                GrdSMSText.Columns[1].HeaderText = "";
            }
            else
            {
                GrdSMSText.Columns[0].HeaderText = "Type";
                GrdSMSText.Columns[1].HeaderText = "SMS Text";
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Exemplo n.º 18
0
    protected void btnCalculateTotalLeaveDays_Click(object sender, EventArgs e)
    {
        try
        {
            BusinessLogic bl = new BusinessLogic(sDataSource);
            txtTotalLeaveDays.Text = string.Empty;
            if (!string.IsNullOrEmpty(txtStartDate.Text) && !string.IsNullOrEmpty(txtEndDate.Text))
            {
                DateTime StartDate        = DateTime.Parse(txtStartDate.Text.Trim());
                string   StartDateSession = ddlStartDateSession.SelectedValue.Trim();
                DateTime EndDate          = DateTime.Parse(txtEndDate.Text.Trim());
                string   EndDateSession   = ddlEndDateSession.SelectedValue.Trim();

                txtTotalLeaveDays.Text = bl.CalculateTotalLeaveDays(StartDate, StartDateSession, EndDate, EndDateSession).ToString();
            }
            ModalPopupExtender1.Show();
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Exemplo n.º 19
0
 protected void gvSalesReturn_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     try
     {
         //string sDataSource =  Server.MapPath("App_Data\\Store0910.mdb");
         if (e.Row.RowType == DataControlRowType.DataRow)
         {
             GridView gv            = e.Row.FindControl("gvProductsPurchase") as GridView;
             Label    lblPurchaseID = e.Row.FindControl("lblBillno") as Label;
             Label    lblPaymode    = e.Row.FindControl("lblPaymode") as Label;
             if (lblPaymode.Text == "1")
             {
                 lblPaymode.Text = "Cash";
             }
             else if (lblPaymode.Text == "2")
             {
                 lblPaymode.Text = "Bank";
             }
             else
             {
                 lblPaymode.Text = "Credit";
             }
             int billno = Convert.ToInt32(lblPurchaseID.Text);
             ReportsBL.ReportClass rptProduct = new ReportsBL.ReportClass();
             DataSet ds = rptProduct.getProductsPurchase(billno, sDataSource);
             if (ds.Tables[0].Rows.Count > 0)
             {
                 gv.DataSource = ds;
                 gv.DataBind();
             }
             //SumCashSales = SumCashSales + Convert.ToDouble(lblTotalAmt.Text);
             //lblGrandCashSales.Text = "Rs. " + SumCashSales.ToString("f2");
         }
     }
     catch (Exception ex)
     {
         TroyLiteExceptionManager.HandleException(ex);
     }
 }
Exemplo n.º 20
0
    protected void GrdWME_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString();

            // int Task_Id = Convert.ToInt32(GrdWME.Rows[e.RowIndex].Cells[0].Text);

            int Task_Id = Convert.ToInt32(GrdWME.DataKeys[e.RowIndex].Value.ToString());

            BusinessLogic bl = new BusinessLogic(sDataSource);
            bl.DeleteTaskDetails(Task_Id);
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Task Entry Deleted Successfully.');", true);
            BindWME("", "");
            btnUpdate.Enabled = false;
            btnSave.Enabled   = true;
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Exemplo n.º 21
0
 /*March 17*/
 protected void btnReport_Click(object sender, EventArgs e)
 {
     try
     {
         if (Page.IsValid)
         {
             /* March17 */
             DateTime startDate, endDate;
             startDate = Convert.ToDateTime(txtStartDate.Text);
             endDate   = Convert.ToDateTime(txtEndDate.Text);
             /* March17 */
             GeneratePL();
             divPrint.Visible = true;
             divmain.Visible  = true;
             div1.Visible     = false;
         }
     }
     catch (Exception ex)
     {
         TroyLiteExceptionManager.HandleException(ex);
     }
 }
Exemplo n.º 22
0
    protected void btngriddata_Click(object sender, EventArgs e)
    {
        try
        {
            DateTime startDate, endDate;
            startDate = Convert.ToDateTime(txtSrtDate.Text);
            endDate   = Convert.ToDateTime(txtEdDate.Text);
            string itemcode;
            itemcode = "";

            DataSet ds = new DataSet();
            ds = objBL.getstockstatement(sDataSource, startDate, endDate, itemcode);

            gvLedger.DataSource = ds;
            gvLedger.DataBind();
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
            return;
        }
    }
Exemplo n.º 23
0
    protected void btnMode_Click(object sender, EventArgs e)
    {
        string flag   = "0";
        string DBname = string.Empty;

        sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString();
        DBname      = GetCurrentDBName(sDataSource); //ConfigurationSettings.AppSettings["DBName"].ToString();
        try
        {
            if (drpYear.SelectedItem.Text != "Current Data")
            {
                flag = "1";
                Session["CurrentYear"] = drpYear.SelectedItem.Text;
                string filename = string.Empty;
                filename = drpYear.SelectedItem.Value;
                File.Move(Server.MapPath("App_Data\\" + DBname + ".mdb"), Server.MapPath("App_Data\\" + DBname + "_curr.mdb"));
                File.Copy(Server.MapPath("OldYear\\" + filename), Server.MapPath("App_Data\\" + DBname + ".mdb"));
                //  File.Move(Server.MapPath("App_Data\\jandj_1.mdb"), Server.MapPath("App_Data\\jandj.mdb"));
            }
            else
            {
                if (File.Exists(Server.MapPath("App_Data\\" + DBname + "_curr.mdb")))
                {
                    Session["CurrentYear"] = "Current Year";
                    if (File.Exists(Server.MapPath("App_Data\\" + DBname + ".mdb")))
                    {
                        File.Delete(Server.MapPath("App_Data\\" + DBname + ".mdb"));
                    }
                    File.Move(Server.MapPath("App_Data\\" + DBname + "_curr.mdb"), Server.MapPath("App_Data\\" + DBname + ".mdb"));
                    File.Delete(Server.MapPath("App_Data\\" + DBname + "_curr.mdb"));
                }
            }
            lblMsg.Text = Session["CurrentYear"].ToString() + " Data is Set";
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Exemplo n.º 24
0
    protected void frmViewAdd_ItemUpdated(object sender, FormViewUpdatedEventArgs e)
    {
        try
        {
            if (e.Exception == null)
            {
                lnkBtnAdd.Visible  = true;
                frmViewAdd.Visible = false;
                System.Threading.Thread.Sleep(1000);
                GrdViewSerEntry.DataBind();
                //MyAccordion.Visible = true;
                GrdViewSerEntry.Visible = true;
                ModalPopupExtender2.Hide();
            }
            else
            {
                e.KeepInEditMode = true;

                if (e.Exception.InnerException != null)
                {
                    StringBuilder script = new StringBuilder();
                    //script.Append("alert('You are not allowed to Update this record. Please contact Supervisor.');");
                    script.Append("You are not allowed to Update this record. Please contact Supervisor.");

                    if (e.Exception.InnerException.Message.IndexOf("Invalid Date") == -1)
                    {
                        ((Label)this.frmViewAdd.FindControl("lblError")).Text = script.ToString();
                    }
                    //ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Exception Occured : " + e.Exception.InnerException.Message + "');", true);

                    e.ExceptionHandled = true;
                }
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Exemplo n.º 25
0
    protected void ComboBox2_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            string debtorID = ddledger.SelectedValue;

            //ReportsBL.ReportClass rptStock = new ReportsBL.ReportClass();
            //DataSet ds = rptStock.getCategory(sDataSource);
            //gvCategory.DataSource = ds;
            //gvCategory.DataBind();

            string connStr = string.Empty;

            if (Request.Cookies["Company"] != null)
            {
                connStr = System.Configuration.ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString();
            }
            else
            {
                Response.Redirect("~/Login.aspx");
            }

            BusinessLogic bl         = new BusinessLogic();
            var           customerID = ddledger.SelectedValue.Trim();

            var dsSales = bl.ListCreditSales(connStr.Trim(), customerID);

            rowdetails.Visible      = true;
            GrdViewSales.DataSource = dsSales;
            GrdViewSales.DataBind();

            //ShowPendingBills();
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Exemplo n.º 26
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             hdFilename.Value = "Reports//" + System.Guid.NewGuid().ToString() + ConfigurationSettings.AppSettings["LedgerReportFileName"].ToString();
         }
         int iGroupID = 0;
         if (Request["GroupName"] != null)
         {
             lGroupName.Text = Request["GroupName"].ToString();
         }
         if (Request["GroupID"] != null)
         {
             iGroupID = Convert.ToInt32(Request["GroupID"]);
             DataSet ds = new DataSet();
             if (ViewState["ds"] == null)
             {
                 ds = showTrialBalance(iGroupID);
                 ViewState["ds"]           = ds;
                 gvTrailBalance.DataSource = ds;
                 gvTrailBalance.DataBind();
             }
             else
             {
                 gvTrailBalance.DataSource = (DataSet)ViewState["ds"];
                 gvTrailBalance.DataBind();
             }
             string sXmlPath     = Server.MapPath(hdFilename.Value);
             string sXmlNodeName = "LedgerAccount";
         }
     }
     catch (Exception ex)
     {
         TroyLiteExceptionManager.HandleException(ex);
     }
 }
Exemplo n.º 27
0
    protected void BtnGenerateReport_Click(object sender, EventArgs e)
    {
        try
        {
            string qry = txtQuery.Text;

            string[] itemAr    = txtQuery.Text.Split(' ');
            string   firstword = Convert.ToString(itemAr[0]).Trim();

            //if ((firstword != "select") && (firstword != "Select") && (firstword != "SELECT"))
            //{
            //    ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Query should start with Select')", true);
            //    return;
            //}

            //BusinessLogic bl = new BusinessLogic(sDataSource);
            //DataSet ds = bl.GetDataForSQL(sDataSource, txtQuery.Text);

            //try
            //{
            //    ExportToExcel(ds);
            //}
            //catch (Exception ex)
            //{
            //    ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('"+ ex.Message+"');", true);
            //}

            BusinessLogic bl = new BusinessLogic(sDataSource);

            string sQl = string.Format(txtQuery.Text);

            bl.RunQuerySQL(sDataSource, sQl);
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Exemplo n.º 28
0
    protected void GrdView_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        try
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString();
                BusinessLogic bl = new BusinessLogic(sDataSource);

                if (bl.CheckTaskUpdateUsed(int.Parse(((HiddenField)e.Row.FindControl("TaskID")).Value)))
                {
                    ((ImageButton)e.Row.FindControl("lnkB")).Visible            = false;
                    ((ImageButton)e.Row.FindControl("lnkBDisabled")).Visible    = true;
                    ((ImageButton)e.Row.FindControl("btnEdit")).Visible         = false;
                    ((ImageButton)e.Row.FindControl("btnEditDisabled")).Visible = true;
                }
                string connection = Request.Cookies["Company"].Value;
                string usernam    = Request.Cookies["LoggedUserName"].Value;

                if (bl.CheckUserHaveEdit(usernam, "TCreate"))
                {
                    ((ImageButton)e.Row.FindControl("btnEdit")).Visible         = false;
                    ((ImageButton)e.Row.FindControl("btnEditDisabled")).Visible = true;
                }

                if (bl.CheckUserHaveDelete(usernam, "TCreate"))
                {
                    ((ImageButton)e.Row.FindControl("lnkB")).Visible         = false;
                    ((ImageButton)e.Row.FindControl("lnkBDisabled")).Visible = true;
                }
            }
        }

        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Exemplo n.º 29
0
    protected void GrdViewJournal_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            int TransNo = (int)GrdViewJournal.DataKeys[e.RowIndex].Value;

            string sDataSource = string.Empty;

            if (Request.Cookies["Company"] != null)
            {
                sDataSource = Request.Cookies["Company"].Value;
            }
            else
            {
                Response.Redirect("~/frm_Login.aspx");
            }
            string        connection = Request.Cookies["Company"].Value;
            BusinessLogic bl1        = new BusinessLogic();
            string        recondate  = GrdViewJournal.Rows[e.RowIndex].Cells[2].Text;;
            if (!bl1.IsValidDate(connection, Convert.ToDateTime(recondate)))
            {
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Date is invalid')", true);
                //frmViewAdd.Visible = true;
                //frmViewAdd.ChangeMode(FormViewMode.ReadOnly);
                return;
            }

            string Username = Request.Cookies["LoggedUserName"].Value;

            BusinessLogic bl = new BusinessLogic(sDataSource);
            bl.DeleteJournal(TransNo, sDataSource, Username);
            BindGrid();
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Exemplo n.º 30
0
 protected void btnApplyLeave_Click(object sender, EventArgs e)
 {
     try
     {
         if (ViewState["PopupMode"] != null && ViewState["PopupMode"].ToString() == "NEW")
         {
             if (InsertLeave())
             {
                 ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Your leave request has been submitted successfully');", true);
                 ClearPopupData();
                 BindLeaveSummaryGrid();
                 UpdatePanelMain.Update();
             }
             else
             {
                 ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Your leave request not saved. Please contact Administrator.');", true);
             }
         }
         else if (ViewState["PopupMode"] != null && ViewState["PopupMode"].ToString() == "UPDATE")
         {
             if (UpdateLeave())
             {
                 ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Your leave request has been updated successfully');", true);
                 ClearPopupData();
                 BindLeaveSummaryGrid();
                 UpdatePanelMain.Update();
             }
             else
             {
                 ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Your leave request not saved. Please contact Administrator.');", true);
             }
         }
     }
     catch (Exception ex)
     {
         TroyLiteExceptionManager.HandleException(ex);
     }
 }