Example #1
0
 /// <summary>
 /// Function to insert particular values to ExchangeRate Table
 /// </summary>
 /// <param name="exchangerateinfo"></param>
 public void ExchangeRateAddParticularFields(ExchangeRateInfo exchangerateinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("ExchangeRateAddParticularFields", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@currencyId", SqlDbType.Decimal);
         sprmparam.Value = exchangerateinfo.CurrencyId;
         sprmparam       = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
         sprmparam.Value = exchangerateinfo.Date;
         sprmparam       = sccmd.Parameters.Add("@rate", SqlDbType.Decimal);
         sprmparam.Value = exchangerateinfo.Rate;
         sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = exchangerateinfo.Narration;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = exchangerateinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = exchangerateinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
Example #2
0
 /// <summary>
 /// Function to save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
         ExchangeRateSP   spExchangeRate   = new ExchangeRateSP();
         infoExchangeRate.CurrencyId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         infoExchangeRate.Date       = Convert.ToDateTime(dtpDate.Text.Trim().ToString());
         infoExchangeRate.Rate       = Convert.ToDecimal(txtExchangeRate.Text.Trim().ToString());
         infoExchangeRate.Narration  = txtNarration.Text.Trim();
         infoExchangeRate.Extra1     = string.Empty;
         infoExchangeRate.Extra2     = string.Empty;
         if (spExchangeRate.ExchangeRateCheckExistence(Convert.ToDateTime(txtDate.Text.Trim().ToString()), Convert.ToDecimal(cmbCurrency.SelectedValue.ToString()), 0) == false)
         {
             if (ExchangeRateCheck())
             {
                 spExchangeRate.ExchangeRateAddParticularFields(infoExchangeRate);
                 Messages.SavedMessage();
                 Clear();
             }
         }
         else
         {
             Messages.ReferenceExistsMessageForUpdate();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "ER2:" + ex.Message;
     }
 }
Example #3
0
 /// <summary>
 /// Function to edit
 /// </summary>
 public void Editfunction()
 {
     try
     {
         ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
         ExchangeRateSP   spExchangeRate   = new ExchangeRateSP();
         infoExchangeRate.CurrencyId     = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         infoExchangeRate.Date           = Convert.ToDateTime(dtpDate.Text.Trim().ToString());
         infoExchangeRate.Rate           = Convert.ToDecimal(txtExchangeRate.Text.Trim().ToString());
         infoExchangeRate.Narration      = txtNarration.Text.Trim();
         infoExchangeRate.Extra1         = String.Empty;
         infoExchangeRate.Extra2         = String.Empty;
         infoExchangeRate.ExchangeRateId = decId;
         if (spExchangeRate.ExchangeRateCheckExistence(Convert.ToDateTime(txtDate.Text.Trim().ToString()), Convert.ToDecimal(cmbCurrency.SelectedValue.ToString()), decExchangeRateId) == false)
         {
             if (ExchangeRateCheck())
             {
                 spExchangeRate.ExchangeRateEdit(infoExchangeRate);
                 Messages.UpdatedMessage();
                 SearchClear();
                 Clear();
             }
         }
         else
         {
             Messages.InformationMessage("Already exists");
             cmbCurrency.Focus();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "ER3:" + ex.Message;
     }
 }
Example #4
0
 /// <summary>
 /// Function to save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
         ExchangeRateSP spExchangeRate = new ExchangeRateSP();
         infoExchangeRate.CurrencyId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         infoExchangeRate.Date = Convert.ToDateTime(dtpDate.Text.Trim().ToString());
         infoExchangeRate.Rate = Convert.ToDecimal(txtExchangeRate.Text.Trim().ToString());
         infoExchangeRate.Narration = txtNarration.Text.Trim();
         infoExchangeRate.Extra1 = string.Empty;
         infoExchangeRate.Extra2 = string.Empty;
         if (spExchangeRate.ExchangeRateCheckExistence(Convert.ToDateTime(txtDate.Text.Trim().ToString()), Convert.ToDecimal(cmbCurrency.SelectedValue.ToString()), 0) == false)
         {
             if (ExchangeRateCheck())
             {
                 spExchangeRate.ExchangeRateAddParticularFields(infoExchangeRate);
                 Messages.SavedMessage();
                 Clear();
             }
         }
         else
         {
             Messages.ReferenceExistsMessageForUpdate();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("ER2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
         ExchangeRateBll  BllExchangeRate  = new ExchangeRateBll();
         infoExchangeRate.CurrencyId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         infoExchangeRate.Date       = Convert.ToDateTime(dtpDate.Text.Trim().ToString());
         infoExchangeRate.Rate       = Convert.ToDecimal(txtExchangeRate.Text.Trim().ToString());
         infoExchangeRate.Narration  = txtNarration.Text.Trim();
         infoExchangeRate.Extra1     = string.Empty;
         infoExchangeRate.Extra2     = string.Empty;
         if (BllExchangeRate.ExchangeRateCheckExistence(Convert.ToDateTime(txtDate.Text.Trim().ToString()), Convert.ToDecimal(cmbCurrency.SelectedValue.ToString()), 0) == false)
         {
             if (ExchangeRateCheck())
             {
                 BllExchangeRate.ExchangeRateAddParticularFields(infoExchangeRate);
                 Messages.SavedMessage();
                 Clear();
             }
         }
         else
         {
             Messages.ReferenceExistsMessageForUpdate();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("ER2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to edit
 /// </summary>
 public void Editfunction()
 {
     try
     {
         ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
         ExchangeRateBll  BllExchangeRate  = new ExchangeRateBll();
         infoExchangeRate.CurrencyId     = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         infoExchangeRate.Date           = Convert.ToDateTime(dtpDate.Text.Trim().ToString());
         infoExchangeRate.Rate           = Convert.ToDecimal(txtExchangeRate.Text.Trim().ToString());
         infoExchangeRate.Narration      = txtNarration.Text.Trim();
         infoExchangeRate.Extra1         = String.Empty;
         infoExchangeRate.Extra2         = String.Empty;
         infoExchangeRate.ExchangeRateId = decId;
         if (BllExchangeRate.ExchangeRateCheckExistence(Convert.ToDateTime(txtDate.Text.Trim().ToString()), Convert.ToDecimal(cmbCurrency.SelectedValue.ToString()), decExchangeRateId) == false)
         {
             if (ExchangeRateCheck())
             {
                 BllExchangeRate.ExchangeRateEdit(infoExchangeRate);
                 Messages.UpdatedMessage();
                 SearchClear();
                 Clear();
             }
         }
         else
         {
             Messages.InformationMessage("Already exists");
             cmbCurrency.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("ER3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Example #7
0
 /// <summary>
 /// Function to fill controls for update
 /// </summary>
 public void FillControls()
 {
     try
     {
         ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
         ExchangeRateSP   spExchangeRate   = new ExchangeRateSP();
         infoExchangeRate = spExchangeRate.ExchangeRateView(decId);
         int inNoOfDecimalPlaces = spExchangeRate.NoOfDecimalNumberViewByExchangeRateId(decId);
         cmbCurrency.SelectedValue = infoExchangeRate.CurrencyId.ToString();
         dtpDate.Text         = infoExchangeRate.Date.ToString();
         txtExchangeRate.Text = Math.Round(Convert.ToDecimal(infoExchangeRate.Rate.ToString()), inNoOfDecimalPlaces).ToString();
         txtNarration.Text    = infoExchangeRate.Narration;
         decExchangeRateId    = infoExchangeRate.ExchangeRateId;
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "ER13:" + ex.Message;
     }
 }
 /// <summary>
 /// Function to fill controls for update
 /// </summary>
 public void FillControls()
 {
     try
     {
         ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
         ExchangeRateBll  BllExchangeRate  = new ExchangeRateBll();
         infoExchangeRate = BllExchangeRate.ExchangeRateView(decId);
         int inNoOfDecimalPlaces = BllExchangeRate.NoOfDecimalNumberViewByExchangeRateId(decId);
         cmbCurrency.SelectedValue = infoExchangeRate.CurrencyId.ToString();
         dtpDate.Text         = infoExchangeRate.Date.ToString();
         txtExchangeRate.Text = Math.Round(Convert.ToDecimal(infoExchangeRate.Rate.ToString()), inNoOfDecimalPlaces).ToString();
         txtNarration.Text    = infoExchangeRate.Narration;
         decExchangeRateId    = infoExchangeRate.ExchangeRateId;
     }
     catch (Exception ex)
     {
         MessageBox.Show("ER13:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Example #9
0
        /// <summary>
        /// Function to get particular values from ExchangeRate Table based on the parameter
        /// </summary>
        /// <param name="exchangeRateId"></param>
        /// <returns></returns>
        public ExchangeRateInfo ExchangeRateView(decimal exchangeRateId)
        {
            ExchangeRateInfo exchangerateinfo = new ExchangeRateInfo();
            SqlDataReader    sdrreader        = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("ExchangeRateView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@exchangeRateId", SqlDbType.Decimal);
                sprmparam.Value = exchangeRateId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    exchangerateinfo.ExchangeRateId = decimal.Parse(sdrreader[0].ToString());
                    exchangerateinfo.CurrencyId     = decimal.Parse(sdrreader[1].ToString());
                    exchangerateinfo.Date           = DateTime.Parse(sdrreader[2].ToString());
                    exchangerateinfo.Rate           = decimal.Parse(sdrreader[3].ToString());
                    exchangerateinfo.Narration      = sdrreader[4].ToString();
                    exchangerateinfo.ExtraDate      = DateTime.Parse(sdrreader[5].ToString());
                    exchangerateinfo.Extra1         = sdrreader[6].ToString();
                    exchangerateinfo.Extra2         = sdrreader[7].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(exchangerateinfo);
        }
Example #10
0
 /// <summary>
 /// Function to Update values in ExchangeRate Table
 /// </summary>
 /// <param name="exchangerateinfo"></param>
 public void ExchangeRateEdit(ExchangeRateInfo exchangerateinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("ExchangeRateEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@exchangeRateId", SqlDbType.Decimal);
         sprmparam.Value = exchangerateinfo.ExchangeRateId;
         sprmparam = sccmd.Parameters.Add("@currencyId", SqlDbType.Decimal);
         sprmparam.Value = exchangerateinfo.CurrencyId;
         sprmparam = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
         sprmparam.Value = exchangerateinfo.Date;
         sprmparam = sccmd.Parameters.Add("@rate", SqlDbType.Decimal);
         sprmparam.Value = exchangerateinfo.Rate;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = exchangerateinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = exchangerateinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = exchangerateinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
Example #11
0
 /// <summary>
 /// Function for Save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         CompanyInfo infoCompany = new CompanyInfo();
         CompanySP spCompany = new CompanySP();
         CompanyPathInfo infoCompanyPath = new CompanyPathInfo();
         CompanyPathSP spCompanyPath = new CompanyPathSP();
         UserInfo infoUser = new UserInfo();
         UserSP spUser = new UserSP();
         ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
         ExchangeRateSP spExchangeRate = new ExchangeRateSP();
         infoCompany.CompanyName = txtCompanyName.Text.Trim();
         infoCompany.MailingName = txtMailingName.Text.Trim();
         infoCompany.Address = txtAddress.Text.Trim();
         infoCompany.Phone = txtPhoneNo.Text.Trim();
         infoCompany.Mobile = txtMobile.Text.Trim();
         infoCompany.EmailId = txtEmail.Text.Trim();
         infoCompany.Web = txtWeb.Text.Trim();
         infoCompany.Country = txtCountry.Text.Trim();
         infoCompany.State = txtState.Text.Trim();
         infoCompany.Pin = txtPincode.Text.Trim();
         infoCompany.CurrencyId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         decCurrencyIdForStatus = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         infoCompany.FinancialYearFrom = Convert.ToDateTime(txtFinancialYearFrom.Text.Trim().ToString());
         infoCompany.BooksBeginingFrom = Convert.ToDateTime(txtBooksBegining.Text.Trim().ToString());
         infoCompany.Tin = txtTinNo.Text.Trim();
         infoCompany.Cst = txtCstNo.Text.Trim();
         infoCompany.Pan = txtPanNo.Text.Trim();
         infoCompany.CurrentDate = DateTime.Now;
         infoCompany.Logo = logo;
         infoCompany.Extra1 = string.Empty;
         infoCompany.Extra2 = string.Empty;
         infoCompanyPath.CompanyName = txtCompanyName.Text.Trim();
         infoCompanyPath.IsDefault = cbxSetAsDefault.Checked;
         infoCompanyPath.Extra1 = string.Empty;
         infoCompanyPath.Extra2 = string.Empty;
         infoUser.UserName = txtAdminUserName.Text.Trim();
         infoUser.Password = txtPassword.Text.Trim();
         infoUser.Active = true;
         infoUser.Extra1 = string.Empty;
         infoUser.Extra2 = string.Empty;
         infoUser.Narration = string.Empty;
         infoUser.RoleId = 1;
         if (spCompany.CompanyCheckExistence(txtCompanyName.Text.Trim().ToString(), 0) == false)
         {
             decimal decCompanyId = spCompany.CompanyAddParticularFeilds(infoCompany);
             PublicVariables._decCurrentCompanyId = decCompanyId;
             infoCompanyPath.CompanyPath = Application.StartupPath + "\\Data\\" + PublicVariables._decCurrentCompanyId;
             spCompanyPath.CompanyPathAdd(infoCompanyPath);
             if (formMDI.demoProject || CreateCompany())
             {
                 if (!formMDI.demoProject)
                 {
                     infoCompanyPath.CompanyPath = strPath;
                 }
                 else
                 {
                     infoCompanyPath.CompanyPath = Application.StartupPath + "\\Data";
                     PublicVariables._decCurrentCompanyId = 0;
                 }
                 CompanyInfo infoNewCompany = new CompanyInfo();
                 CompanySP spNewCompany = new CompanySP();
                 CompanyPathInfo infoNewCompanyPath = new CompanyPathInfo();
                 CompanyPathSP spNewCompanyPath = new CompanyPathSP();
                 UserInfo infoNewUser = new UserInfo();
                 UserSP spNewUser = new UserSP();
                 ExchangeRateInfo infoNewExchangeRate = new ExchangeRateInfo();
                 ExchangeRateSP spNewExchangeRate = new ExchangeRateSP();
                 infoNewCompany = infoCompany;
                 infoNewCompanyPath = infoCompanyPath;
                 infoNewUser = infoUser;
                 decCompanyId = spNewCompany.CompanyAddParticularFeilds(infoNewCompany);
                 spNewUser.UserAdd(infoNewUser);
                 spNewCompanyPath.CompanyPathAdd(infoNewCompanyPath);
                 Messages.SavedMessage();
                 formMDI.MDIObj.MenuStripEnabling();
                 //  To set default currencyId.............//
                 infoNewExchangeRate.CurrencyId = infoNewCompany.CurrencyId;
                 infoNewExchangeRate.Rate = 1;
                 infoNewExchangeRate.Narration = string.Empty;
                 infoNewExchangeRate.Extra1 = string.Empty;
                 infoNewExchangeRate.Extra2 = string.Empty;
                 infoNewExchangeRate.ExtraDate = System.DateTime.Now;
                 infoNewExchangeRate.Date = System.DateTime.Now;
                 spNewExchangeRate.ExchangeRateAdd(infoNewExchangeRate);
                 CurrencySP spCurrency = new CurrencySP();
                 spCurrency.DefaultCurrencySet(decCurrencyIdForStatus);
                 AfterCompanyCreation();
                 Clear();
                 this.Close();
             }
             else
             {
                 Messages.InformationMessage("Company creation failed");
             }
         }
         else
         {
             Messages.InformationMessage("Companyname already exist");
             txtCompanyName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("CR1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Example #12
0
 /// <summary>
 /// Function for Edit
 /// </summary>
 public void EditFunction()
 {
     try
     {
         CompanyInfo infoCompany = new CompanyInfo();
         CompanySP spCompany = new CompanySP();
         CompanyPathInfo infoCompanyPath = new CompanyPathInfo();
         CompanyPathSP spCompanyPath = new CompanyPathSP();
         UserInfo infoUser = new UserInfo();
         UserSP spUser = new UserSP();
         infoCompany.CompanyName = txtCompanyName.Text.Trim();
         infoCompany.MailingName = txtMailingName.Text.Trim();
         infoCompany.Address = txtAddress.Text.Trim();
         infoCompany.Phone = txtPhoneNo.Text.Trim();
         infoCompany.Mobile = txtMobile.Text.Trim();
         infoCompany.EmailId = txtEmail.Text.Trim();
         infoCompany.Web = txtWeb.Text.Trim();
         infoCompany.Country = txtCountry.Text.Trim();
         infoCompany.State = txtState.Text.Trim();
         infoCompany.Pin = txtPincode.Text.Trim();
         infoCompany.CurrencyId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         infoCompany.FinancialYearFrom = Convert.ToDateTime(txtFinancialYearFrom.Text.Trim().ToString());
         infoCompany.BooksBeginingFrom = Convert.ToDateTime(txtBooksBegining.Text.Trim().ToString());
         infoCompany.Tin = txtTinNo.Text.Trim();
         infoCompany.Cst = txtCstNo.Text.Trim();
         infoCompany.Pan = txtPanNo.Text.Trim();
         infoCompany.CurrentDate = DateTime.Now;
         infoCompany.Logo = logo;
         infoCompany.Extra1 = string.Empty;
         infoCompany.Extra2 = string.Empty;
         infoCompanyPath.CompanyName = txtCompanyName.Text.Trim();
         infoCompanyPath.IsDefault = cbxSetAsDefault.Checked;
         strPath = Application.StartupPath + "\\Data\\" + PublicVariables._decCurrentCompanyId;
         infoCompanyPath.CompanyPath = strPath;
         infoCompanyPath.Extra1 = string.Empty;
         infoCompanyPath.Extra2 = string.Empty;
         infoCompanyPath.ExtraDate = DateTime.Now;
         infoUser.UserName = txtAdminUserName.Text.Trim();
         infoUser.Password = txtPassword.Text.Trim();
         infoUser.Active = true;
         infoUser.Extra1 = string.Empty;
         infoUser.Extra2 = string.Empty;
         infoUser.Narration = string.Empty;
         infoUser.RoleId = 1;
         infoCompanyPath.CompanyId = 1;
         infoCompany.CompanyId = 1;
         infoUser.UserId = PublicVariables._decCurrentUserId;
         spCompany.CompanyEdit(infoCompany);
         spCompanyPath.CompanyPathEdit(infoCompanyPath);
         spUser.UserEdit(infoUser);
         Messages.UpdatedMessage();
         //  To set default currencyId...........In exchangeRate..//
         ExchangeRateSP spExchangeRate = new ExchangeRateSP();
         ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
         infoExchangeRate.ExchangeRateId = 1;
         infoExchangeRate.Date = PublicVariables._dtCurrentDate;
         infoExchangeRate.CurrencyId = infoCompany.CurrencyId;
         infoExchangeRate.ExtraDate = PublicVariables._dtCurrentDate;
         infoExchangeRate.Narration = string.Empty;
         infoExchangeRate.Rate = 1;
         infoExchangeRate.Extra1 = string.Empty;
         infoExchangeRate.Extra2 = string.Empty;
         spExchangeRate.ExchangeRateEdit(infoExchangeRate);
         FinancialYearInfo infoFinancialYear = new FinancialYearInfo();
         FinancialYearSP spFinancialYear = new FinancialYearSP();
         decimal decIdentity;
         infoFinancialYear.FromDate = PublicVariables._dtFromDate;
         infoFinancialYear.ToDate = PublicVariables._dtToDate;
         infoFinancialYear.ExtraDate = DateTime.Now;
         infoFinancialYear.Extra1 = string.Empty;
         infoFinancialYear.Extra2 = string.Empty;
         bool isExist = spFinancialYear.FinancialYearExistenceCheck(PublicVariables._dtFromDate, PublicVariables._dtToDate);
         if (!isExist)
         {
             decIdentity = spFinancialYear.FinancialYearAddWithReturnIdentity(infoFinancialYear);
         }
         //===========Add companyDetails in ExternalDb =====================//
         decimal decCompanyIdForTemp = PublicVariables._decCurrentCompanyId;
         PublicVariables._decCurrentCompanyId = 0;
         CompanySP spExCompany = new CompanySP();
         CompanyPathSP spExCompanyPath = new CompanyPathSP();
         CompanyInfo infoExCompany = new CompanyInfo();
         CompanyPathInfo infoExCompanyPath = new CompanyPathInfo();
         infoExCompany = infoCompany;
         infoExCompanyPath = infoCompanyPath;
         infoExCompany.CompanyId = decCompanyIdForTemp;
         infoExCompanyPath.CompanyId = decCompanyIdForTemp;
         spExCompany.CompanyEdit(infoExCompany);
         spExCompanyPath.CompanyPathEdit(infoExCompanyPath);
         PublicVariables._decCurrentCompanyId = decCompanyIdForTemp;
        this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show("CR2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Example #13
0
        /// <summary>
        /// Fill the corresponding details of party and calculations on cell value changed 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvPartyBalance_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                PartyBalanceSP SpPartyBalance = new PartyBalanceSP();
                
                
                if (e.RowIndex != -1 && e.ColumnIndex != -1)
                {
                    if (dgvPartyBalance.Rows[e.RowIndex].Cells["dgvcmbCurrency"].Value == null || dgvPartyBalance.Rows[e.RowIndex].Cells["dgvcmbCurrency"].Value.ToString() == string.Empty)
                    {
                        dgvPartyBalance.Rows[e.RowIndex].Cells["dgvcmbCurrency"].Value = Convert.ToDecimal(1);//decExchangeRateId;
                        
                    }
                    if (dgvPartyBalance.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.Name == "dgvtxtAmount" || dgvPartyBalance.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.Name == "dgvcmbCurrency")
                    {
                        TotalAmount();
                    }
                    //---------------------check column missing---------------------------------//
                    CheckColumnMissing(e);
                    //==========================================================================//
                    if (dgvPartyBalance.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.Name == "dgvcmbReference")
                    {
                        if (dgvPartyBalance.CurrentRow.Cells["dgvcmbReference"].Value != null)//&& dgvPartyBalance.CurrentRow.Cells["dgvcmbReference"].Value.ToString() != string.Empty)
                        {
                            //to fill combo without filling the already selected value
                            if (dgvPartyBalance.CurrentRow.Cells["dgvcmbReference"].Value.ToString() == "Against")
                            {
                                dgvPartyBalance.CurrentRow.Cells["dgvcmbVoucherType"].ReadOnly = false;
                                if (frmJournalVoucherObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = strDebitOrCredit;
                                }
                                else if (frmPaymentVoucherObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = "Dr";
                                }
                                else if (frmReceiptVoucherObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = "Cr";
                                }
                                else if (frmPdcpayableObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = "Dr";
                                }
                                else if (frmPdcReceivableObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = "Cr";
                                }
                            }
                            else if (dgvPartyBalance.CurrentRow.Cells["dgvcmbReference"].Value.ToString() == "New")
                            {
                                dgvPartyBalance.CurrentRow.Cells["dgvcmbVoucherType"].ReadOnly = true;
                                dgvPartyBalance.CurrentRow.Cells["dgvcmbVoucherType"].Value = string.Empty;
                                dgvPartyBalance.CurrentRow.Cells["dgvtxtVoucherNo"].Value = null;
                                dgvPartyBalance.CurrentRow.Cells["dgvtxtPending"].Value = null;
                                dgvPartyBalance.CurrentRow.Cells["dgvcmbCurrency"].ReadOnly = false;
                                if (frmJournalVoucherObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = strDebitOrCredit;
                                }
                                else if (frmPaymentVoucherObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = "Dr";
                                }
                                else if (frmReceiptVoucherObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = "Cr";
                                }
                                else if (frmPdcpayableObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = "Dr";
                                }
                                else if (frmPdcReceivableObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = "Cr";
                                }
                            }
                            //
                            else if (dgvPartyBalance.CurrentRow.Cells["dgvcmbReference"].Value.ToString() == "OnAccount")
                            {
                                dgvPartyBalance.CurrentRow.Cells["dgvcmbVoucherType"].ReadOnly = true;
                                dgvPartyBalance.CurrentRow.Cells["dgvcmbVoucherType"].Value = string.Empty;
                                dgvPartyBalance.CurrentRow.Cells["dgvtxtVoucherNo"].Value = null;
                                dgvPartyBalance.CurrentRow.Cells["dgvtxtPending"].Value = null;
                                dgvPartyBalance.CurrentRow.Cells["dgvcmbCurrency"].ReadOnly = false;
                                if (frmJournalVoucherObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = strDebitOrCredit;
                                }
                                else if (frmPaymentVoucherObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = "Dr";
                                }
                                else if (frmReceiptVoucherObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = "Cr";
                                }
                                else if (frmPdcpayableObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = "Dr";
                                }
                                else if (frmPdcReceivableObj != null)
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtCrDr"].Value = "Cr";
                                }
                            }
                        }
                    }
                    else if (dgvPartyBalance.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.Name == "dgvcmbVoucherType")
                    {
                        if (dgvPartyBalance.CurrentRow.Cells["dgvcmbVoucherType"].Value != null && dgvPartyBalance.CurrentRow.Cells["dgvcmbVoucherType"].Value.ToString().Trim() != string.Empty)
                        {
                            ExchangeRateSP spExchangeRate = new ExchangeRateSP();
                            ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
                            string str = dgvPartyBalance.CurrentRow.Cells["dgvcmbVoucherType"].Value.ToString();
                            string[] words;
                            words = str.Split('_');
                            DataTable dtbl = new DataTable();
                            dtbl = SpPartyBalance.PartyBalanceComboViewByLedgerId(decLedgerId, strDebitOrCredit, decVoucherTypeId, strVoucherNo);
                            for (int inD = 0; inD < dtbl.Rows.Count; inD++)
                            {
                                if (dgvPartyBalance.Rows[e.RowIndex].Cells["dgvcmbVoucherType"].Value.ToString() == dtbl.Rows[inD]["value"].ToString())
                                {
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtVoucherNo"].Value = dtbl.Rows[inD]["voucherNo"].ToString();
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtPending"].Value = Math.Round(Convert.ToDecimal(dtbl.Rows[inD]["balance"].ToString()), PublicVariables._inNoOfDecimalPlaces);

                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtOldExchangeRateId"].Value = dtbl.Rows[inD]["exchangeRateId"].ToString();
                                    if (Convert.ToDecimal(dtbl.Rows[inD]["exchangeRateId"].ToString()) != 1m)
                                    {
                                        infoExchangeRate = spExchangeRate.ExchangeRateView(Convert.ToDecimal(dtbl.Rows[inD]["exchangeRateId"].ToString()));
                                        decimal decCurrentExchangeRateId = spExchangeRate.GetExchangeRateId(infoExchangeRate.CurrencyId, dtmVoucherDate);
                                        if (decCurrentExchangeRateId == 0)
                                        {
                                            CurrencySP spCurrency = new CurrencySP();
                                            CurrencyInfo infoCurrency = new CurrencyInfo();
                                            infoCurrency = spCurrency.CurrencyView(infoExchangeRate.CurrencyId);
                                            dgvPartyBalance.CurrentRow.Cells["dgvcmbCurrency"].Value = decCurrentExchangeRateId;
                                            
                                            Messages.InformationMessage("Set ExchangeRate for "+infoCurrency.CurrencyName);
                                            
                                        }
                                        else
                                        {
                                            dgvPartyBalance.CurrentRow.Cells["dgvcmbCurrency"].Value = decCurrentExchangeRateId;
                                        }
                                    }
                                    else
                                    {
                                        dgvPartyBalance.CurrentRow.Cells["dgvcmbCurrency"].Value = 1m;
                                    }
                                    dgvPartyBalance.CurrentRow.Cells["dgvtxtInvoiceNo"].Value = dtbl.Rows[inD]["invoiceNo"].ToString();
                                }
                            }
                            dgvPartyBalance.CurrentRow.Cells["dgvtxtAmount"].Value = null;
                            dgvPartyBalance.CurrentRow.Cells["dgvcmbCurrency"].ReadOnly = true;
                        }
                        //to make voucherno,pendingamount,invoiceno,currency as null when vouchertype is selected as empty
                        else
                        {
                            dgvPartyBalance.CurrentRow.Cells["dgvtxtVoucherNo"].Value = null;
                            dgvPartyBalance.CurrentRow.Cells["dgvtxtPending"].Value = null;
                            dgvPartyBalance.CurrentRow.Cells["dgvtxtAmount"].Value = null;
                            dgvPartyBalance.CurrentRow.Cells["dgvtxtInvoiceNo"].Value = null;
                            dgvPartyBalance.CurrentRow.Cells["dgvcmbCurrency"].Value = null;
                            SettingsSP spSettings = new SettingsSP();
                            if (spSettings.SettingsStatusCheck("MultiCurrency") == "Yes")
                            {
                                dgvcmbCurrency.ReadOnly = false;
                            }
                            else
                            {
                                dgvcmbCurrency.ReadOnly = true;

                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PB:16" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #14
0
 /// <summary>
 /// Function to fill controls for update
 /// </summary>
 public void FillControls()
 {
     try
     {
         ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
         ExchangeRateSP spExchangeRate = new ExchangeRateSP();
         infoExchangeRate = spExchangeRate.ExchangeRateView(decId);
         int inNoOfDecimalPlaces = spExchangeRate.NoOfDecimalNumberViewByExchangeRateId(decId);
         cmbCurrency.SelectedValue = infoExchangeRate.CurrencyId.ToString();
         dtpDate.Text = infoExchangeRate.Date.ToString();
         txtExchangeRate.Text = Math.Round(Convert.ToDecimal(infoExchangeRate.Rate.ToString()), inNoOfDecimalPlaces).ToString();
         txtNarration.Text = infoExchangeRate.Narration;
         decExchangeRateId = infoExchangeRate.ExchangeRateId;
     }
     catch (Exception ex)
     {
         MessageBox.Show("ER13:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Example #15
0
 /// <summary>
 /// Function to edit
 /// </summary>
 public void Editfunction()
 {
     try
     {
         ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
         ExchangeRateSP spExchangeRate = new ExchangeRateSP();
         infoExchangeRate.CurrencyId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         infoExchangeRate.Date = Convert.ToDateTime(dtpDate.Text.Trim().ToString());
         infoExchangeRate.Rate = Convert.ToDecimal(txtExchangeRate.Text.Trim().ToString());
         infoExchangeRate.Narration = txtNarration.Text.Trim();
         infoExchangeRate.Extra1 = String.Empty;
         infoExchangeRate.Extra2 = String.Empty;
         infoExchangeRate.ExchangeRateId = decId;
         if (spExchangeRate.ExchangeRateCheckExistence(Convert.ToDateTime(txtDate.Text.Trim().ToString()), Convert.ToDecimal(cmbCurrency.SelectedValue.ToString()), decExchangeRateId) == false)
         {
             if (ExchangeRateCheck())
             {
                 spExchangeRate.ExchangeRateEdit(infoExchangeRate);
                 Messages.UpdatedMessage();
                 SearchClear();
                 Clear();
             }
         }
         else
         {
             Messages.InformationMessage("Already exists");
             cmbCurrency.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("ER3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Example #16
0
 /// <summary>
 /// Function to get particular values from ExchangeRate Table based on the parameter
 /// </summary>
 /// <param name="exchangeRateId"></param>
 /// <returns></returns>
 public ExchangeRateInfo ExchangeRateView(decimal exchangeRateId)
 {
     ExchangeRateInfo exchangerateinfo = new ExchangeRateInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("ExchangeRateView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@exchangeRateId", SqlDbType.Decimal);
         sprmparam.Value = exchangeRateId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             exchangerateinfo.ExchangeRateId = decimal.Parse(sdrreader[0].ToString());
             exchangerateinfo.CurrencyId = decimal.Parse(sdrreader[1].ToString());
             exchangerateinfo.Date = DateTime.Parse(sdrreader[2].ToString());
             exchangerateinfo.Rate = decimal.Parse(sdrreader[3].ToString());
             exchangerateinfo.Narration = sdrreader[4].ToString();
             exchangerateinfo.ExtraDate = DateTime.Parse(sdrreader[5].ToString());
             exchangerateinfo.Extra1 = sdrreader[6].ToString();
             exchangerateinfo.Extra2 = sdrreader[7].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return exchangerateinfo;
 }