Example #1
0
        /// <summary>
        /// Function to insert values to SalaryPackageDetails Table
        /// </summary>
        /// <param name="salarypackagedetailsinfo"></param>
        /// <returns></returns>
        public bool SalaryPackageDetailsAdd(SalaryPackageDetailsInfo salarypackagedetailsinfo)
        {
            bool isSave = false;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("SalaryPackageDetailsAdd", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@salaryPackageId", SqlDbType.Decimal);
                sprmparam.Value = salarypackagedetailsinfo.SalaryPackageId;
                sprmparam       = sccmd.Parameters.Add("@payHeadId", SqlDbType.Decimal);
                sprmparam.Value = salarypackagedetailsinfo.PayHeadId;
                sprmparam       = sccmd.Parameters.Add("@amount", SqlDbType.Decimal);
                sprmparam.Value = salarypackagedetailsinfo.Amount;
                sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
                sprmparam.Value = salarypackagedetailsinfo.Narration;
                sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
                sprmparam.Value = salarypackagedetailsinfo.Extra1;
                sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
                sprmparam.Value = salarypackagedetailsinfo.Extra2;
                int inValue = sccmd.ExecuteNonQuery();
                if (inValue > 0)
                {
                    isSave = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sqlcon.Close();
            }
            return(isSave);
        }
Example #2
0
        /// <summary>
        /// Function to get particular values from SalaryPackageDetails table based on the parameter
        /// </summary>
        /// <param name="salaryPackageDetailsId"></param>
        /// <returns></returns>
        public SalaryPackageDetailsInfo SalaryPackageDetailsView(decimal salaryPackageDetailsId)
        {
            SalaryPackageDetailsInfo salarypackagedetailsinfo = new SalaryPackageDetailsInfo();
            SqlDataReader            sdrreader = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("SalaryPackageDetailsView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@salaryPackageDetailsId", SqlDbType.Decimal);
                sprmparam.Value = salaryPackageDetailsId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    salarypackagedetailsinfo.SalaryPackageDetailsId = decimal.Parse(sdrreader[0].ToString());
                    salarypackagedetailsinfo.SalaryPackageId        = decimal.Parse(sdrreader[1].ToString());
                    salarypackagedetailsinfo.PayHeadId = decimal.Parse(sdrreader[2].ToString());
                    salarypackagedetailsinfo.Amount    = decimal.Parse(sdrreader[3].ToString());
                    salarypackagedetailsinfo.Narration = sdrreader[4].ToString();
                    salarypackagedetailsinfo.ExtraDate = DateTime.Parse(sdrreader[5].ToString());
                    salarypackagedetailsinfo.Extra1    = sdrreader[6].ToString();
                    salarypackagedetailsinfo.Extra2    = sdrreader[7].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(salarypackagedetailsinfo);
        }
 /// <summary>
 /// Function to insert values to SalaryPackageDetails Table
 /// </summary>
 /// <param name="salarypackagedetailsinfo"></param>
 /// <returns></returns>
 public bool SalaryPackageDetailsAdd(SalaryPackageDetailsInfo salarypackagedetailsinfo)
 {
     bool isSave = false;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("SalaryPackageDetailsAdd", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@salaryPackageId", SqlDbType.Decimal);
         sprmparam.Value = salarypackagedetailsinfo.SalaryPackageId;
         sprmparam = sccmd.Parameters.Add("@payHeadId", SqlDbType.Decimal);
         sprmparam.Value = salarypackagedetailsinfo.PayHeadId;
         sprmparam = sccmd.Parameters.Add("@amount", SqlDbType.Decimal);
         sprmparam.Value = salarypackagedetailsinfo.Amount;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = salarypackagedetailsinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = salarypackagedetailsinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = salarypackagedetailsinfo.Extra2;
         int inValue = sccmd.ExecuteNonQuery();
         if (inValue > 0)
         {
             isSave = true;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return isSave;
 }
Example #4
0
 /// <summary>
 /// Function to Update values in SalaryPackageDetails Table
 /// </summary>
 /// <param name="salarypackagedetailsinfo"></param>
 public void SalaryPackageDetailsEdit(SalaryPackageDetailsInfo salarypackagedetailsinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("SalaryPackageDetailsEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@salaryPackageDetailsId", SqlDbType.Decimal);
         sprmparam.Value = salarypackagedetailsinfo.SalaryPackageDetailsId;
         sprmparam       = sccmd.Parameters.Add("@salaryPackageId", SqlDbType.Decimal);
         sprmparam.Value = salarypackagedetailsinfo.SalaryPackageId;
         sprmparam       = sccmd.Parameters.Add("@payHeadId", SqlDbType.Decimal);
         sprmparam.Value = salarypackagedetailsinfo.PayHeadId;
         sprmparam       = sccmd.Parameters.Add("@amount", SqlDbType.Decimal);
         sprmparam.Value = salarypackagedetailsinfo.Amount;
         sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = salarypackagedetailsinfo.Narration;
         sprmparam       = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = salarypackagedetailsinfo.ExtraDate;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = salarypackagedetailsinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = salarypackagedetailsinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
 /// <summary>
 /// Function to Update values in SalaryPackageDetails Table
 /// </summary>
 /// <param name="salarypackagedetailsinfo"></param>
 public void SalaryPackageDetailsEdit(SalaryPackageDetailsInfo salarypackagedetailsinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("SalaryPackageDetailsEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@salaryPackageDetailsId", SqlDbType.Decimal);
         sprmparam.Value = salarypackagedetailsinfo.SalaryPackageDetailsId;
         sprmparam = sccmd.Parameters.Add("@salaryPackageId", SqlDbType.Decimal);
         sprmparam.Value = salarypackagedetailsinfo.SalaryPackageId;
         sprmparam = sccmd.Parameters.Add("@payHeadId", SqlDbType.Decimal);
         sprmparam.Value = salarypackagedetailsinfo.PayHeadId;
         sprmparam = sccmd.Parameters.Add("@amount", SqlDbType.Decimal);
         sprmparam.Value = salarypackagedetailsinfo.Amount;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = salarypackagedetailsinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = salarypackagedetailsinfo.ExtraDate;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = salarypackagedetailsinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = salarypackagedetailsinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
 /// <summary>
 /// Function to get particular values from SalaryPackageDetails table based on the parameter
 /// </summary>
 /// <param name="salaryPackageDetailsId"></param>
 /// <returns></returns>
 public SalaryPackageDetailsInfo SalaryPackageDetailsView(decimal salaryPackageDetailsId)
 {
     SalaryPackageDetailsInfo salarypackagedetailsinfo = new SalaryPackageDetailsInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("SalaryPackageDetailsView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@salaryPackageDetailsId", SqlDbType.Decimal);
         sprmparam.Value = salaryPackageDetailsId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             salarypackagedetailsinfo.SalaryPackageDetailsId = decimal.Parse(sdrreader[0].ToString());
             salarypackagedetailsinfo.SalaryPackageId = decimal.Parse(sdrreader[1].ToString());
             salarypackagedetailsinfo.PayHeadId = decimal.Parse(sdrreader[2].ToString());
             salarypackagedetailsinfo.Amount = decimal.Parse(sdrreader[3].ToString());
             salarypackagedetailsinfo.Narration = sdrreader[4].ToString();
             salarypackagedetailsinfo.ExtraDate = DateTime.Parse(sdrreader[5].ToString());
             salarypackagedetailsinfo.Extra1 = sdrreader[6].ToString();
             salarypackagedetailsinfo.Extra2 = sdrreader[7].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return salarypackagedetailsinfo;
 }