예제 #1
0
    public void loadfinancial(int ID)
    {
        LoanDSTableAdapters.FinancialsTableAdapter financial = new LoanDSTableAdapters.FinancialsTableAdapter();
        LoanDS.FinancialsDataTable tblfinancial = financial.GetFinancials(MySessionManager.AppID, MySessionManager.ClientID);

        if (tblfinancial.Rows.Count > 0)
        {
            try
            {
                if (Convert.ToInt32(tblfinancial[0].datYear) > 0)
                {
                    ddlYear.SelectedValue = tblfinancial[0].datYear.ToString();
                }
                if (Convert.ToInt32(tblfinancial[0].datMonth.Length) > 0)
                {
                    ddMonth.SelectedValue = tblfinancial[0].datMonth.ToString();
                }
            }
            catch (Exception ex) { }
            txtAdminCost.Text   = tblfinancial[0].datAdminCost.ToString();
            txtCostOfSales.Text = tblfinancial[0].datCostOfSales.ToString();
            txtGrossProfit.Text = tblfinancial[0].datGrossOfProfit.ToString();
            txtNetProfit.Text   = tblfinancial[0].datNetProfit.ToString();
            txtSales.Text       = tblfinancial[0].datSales.ToString();
            this.editskip.Value = "2";
        }
    }
예제 #2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         LoanDSTableAdapters.FinancialsTableAdapter financials = new LoanDSTableAdapters.FinancialsTableAdapter();
         if (!(type == "update"))
         {
             financials.InsertFinancials(MySessionManager.ClientID,
                                         MySessionManager.AppID,
                                         ddMonth.Text,
                                         ddlYear.Text,
                                         txtSales.Text,
                                         txtCostOfSales.Text,
                                         txtGrossProfit.Text,
                                         txtAdminCost.Text,
                                         txtNetProfit.Text,
                                         MySessionManager.CurrentUser.UserID);
         }
         else if (type == "update")
         {
             financials.UpdateFinancials(ddMonth.Text,
                                         ddlYear.Text,
                                         txtSales.Text,
                                         txtCostOfSales.Text,
                                         txtGrossProfit.Text,
                                         txtAdminCost.Text,
                                         txtNetProfit.Text,
                                         MySessionManager.CurrentUser.UserID,
                                         id);
         }
         Utility util = new Utility();
         Page.Response.Redirect(util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "fiedit"));
     }
 }
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         LoanDSTableAdapters.FinancialsTableAdapter financials = new LoanDSTableAdapters.FinancialsTableAdapter();
         if (!(type == "update"))
         {
             financials.InsertFinancials(MySessionManager.ClientID,
                                         MySessionManager.AppID,
                                         ddMonth.Text,
                                         ddlYear.Text,
                                         txtSales.Text,
                                         txtCostOfSales.Text,
                                         txtGrossProfit.Text,
                                         txtAdminCost.Text,
                                         txtNetProfit.Text,
                                         MySessionManager.CurrentUser.UserID);
         }
         else if (type == "update")
         {
             financials.UpdateFinancials(ddMonth.Text,
                                         ddlYear.Text,
                                         txtSales.Text,
                                         txtCostOfSales.Text,
                                         txtGrossProfit.Text,
                                         txtAdminCost.Text,
                                         txtNetProfit.Text,
                                         MySessionManager.CurrentUser.UserID,
                                         id);
         }
         Utility util = new Utility();
         Page.Response.Redirect(util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "fiedit"));
     }
 }
    public void loadfinancial(int ID)
    {
        LoanDSTableAdapters.FinancialsTableAdapter financial = new LoanDSTableAdapters.FinancialsTableAdapter();
        LoanDS.FinancialsDataTable tblfinancial = financial.GetFinancials(MySessionManager.AppID, MySessionManager.ClientID);

            if (tblfinancial.Rows.Count > 0)
            {
                try
                {
                  if(Convert.ToInt32(tblfinancial[0].datYear)>0)  ddlYear.SelectedValue = tblfinancial[0].datYear.ToString();
                  if (Convert.ToInt32(tblfinancial[0].datMonth.Length)>0) { ddMonth.SelectedValue = tblfinancial[0].datMonth.ToString(); }
                }
                catch (Exception ex) { }    
                txtAdminCost.Text = tblfinancial[0].datAdminCost.ToString();
                txtCostOfSales.Text = tblfinancial[0].datCostOfSales.ToString();
                txtGrossProfit.Text = tblfinancial[0].datGrossOfProfit.ToString();
                txtNetProfit.Text = tblfinancial[0].datNetProfit.ToString();
                txtSales.Text = tblfinancial[0].datSales.ToString();
                this.editskip.Value = "2";
            }
   
        }