Ejemplo n.º 1
0
        /// <summary>
        /// Function to get values for Service VoucherTypeId By ServiceMasterId And VocherNo
        /// </summary>
        /// <param name="decServiceMasterId"></param>
        /// <param name="decVoucherNo"></param>
        /// <returns></returns>
        public ServiceMasterInfo GetServiceVoucherTypeIdByServiceMasterIdAndVocherNo(decimal decServiceMasterId, decimal decVoucherNo)
        {
            ServiceMasterInfo servicemasterinfo = new ServiceMasterInfo();
            SqlDataReader     sdrreader         = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("GetServiceVoucherTypeIdByServiceMasterIdAndVocherNo", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@serviceMasterId", SqlDbType.Decimal);
                sprmparam.Value = decServiceMasterId;
                sprmparam       = sccmd.Parameters.Add("@voucherNo", SqlDbType.Decimal);
                sprmparam.Value = decVoucherNo;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    servicemasterinfo.VoucherTypeId = decimal.Parse(sdrreader["voucherTypeId"].ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(servicemasterinfo);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Function to Update values in ServiceMaster Table
 /// </summary>
 /// <param name="servicemasterinfo"></param>
 public void ServiceMasterEdit(ServiceMasterInfo servicemasterinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("ServiceMasterEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@serviceMasterId", SqlDbType.Decimal);
         sprmparam.Value = servicemasterinfo.ServiceMasterId;
         sprmparam       = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
         sprmparam.Value = servicemasterinfo.SuffixPrefixId;
         sprmparam       = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
         sprmparam.Value = servicemasterinfo.Date;
         sprmparam       = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal);
         sprmparam.Value = servicemasterinfo.LedgerId;
         sprmparam       = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal);
         sprmparam.Value = servicemasterinfo.TotalAmount;
         sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = servicemasterinfo.Narration;
         sprmparam       = sccmd.Parameters.Add("@userId", SqlDbType.Decimal);
         sprmparam.Value = servicemasterinfo.UserId;
         sprmparam       = sccmd.Parameters.Add("@creditPeriod", SqlDbType.Int);
         sprmparam.Value = servicemasterinfo.CreditPeriod;
         sprmparam       = sccmd.Parameters.Add("@serviceAccount", SqlDbType.Decimal);
         sprmparam.Value = servicemasterinfo.ServiceAccount;
         sprmparam       = sccmd.Parameters.Add("@exchangeRateId", SqlDbType.Decimal);
         sprmparam.Value = servicemasterinfo.ExchangeRateId;
         sprmparam       = sccmd.Parameters.Add("@employeeId", SqlDbType.Decimal);
         sprmparam.Value = servicemasterinfo.EmployeeId;
         sprmparam       = sccmd.Parameters.Add("@customer", SqlDbType.VarChar);
         sprmparam.Value = servicemasterinfo.Customer;
         sprmparam       = sccmd.Parameters.Add("@discount", SqlDbType.Decimal);
         sprmparam.Value = servicemasterinfo.Discount;
         sprmparam       = sccmd.Parameters.Add("@grandTotal", SqlDbType.Decimal);
         sprmparam.Value = servicemasterinfo.GrandTotal;
         sprmparam       = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = servicemasterinfo.VoucherTypeId;
         sprmparam       = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
         sprmparam.Value = servicemasterinfo.FinancialYearId;
         sprmparam       = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = servicemasterinfo.ExtraDate;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = servicemasterinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = servicemasterinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        ///  Function to get particular values from ServiceMaster Table based on the parameter
        /// </summary>
        /// <param name="serviceMasterId"></param>
        /// <returns></returns>
        public ServiceMasterInfo ServiceMasterView(decimal serviceMasterId)
        {
            ServiceMasterInfo servicemasterinfo = new ServiceMasterInfo();
            SqlDataReader     sdrreader         = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("ServiceMasterView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@serviceMasterId", SqlDbType.Decimal);
                sprmparam.Value = serviceMasterId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    servicemasterinfo.ServiceMasterId = decimal.Parse(sdrreader["serviceMasterId"].ToString());
                    servicemasterinfo.VoucherNo       = sdrreader["voucherNo"].ToString();
                    servicemasterinfo.InvoiceNo       = sdrreader["invoiceNo"].ToString();
                    servicemasterinfo.SuffixPrefixId  = decimal.Parse(sdrreader["suffixPrefixId"].ToString());
                    servicemasterinfo.Date            = DateTime.Parse(sdrreader["date"].ToString());
                    servicemasterinfo.LedgerId        = decimal.Parse(sdrreader["ledgerId"].ToString());
                    servicemasterinfo.TotalAmount     = decimal.Parse(sdrreader["totalAmount"].ToString());
                    servicemasterinfo.Narration       = sdrreader["narration"].ToString();
                    servicemasterinfo.UserId          = decimal.Parse(sdrreader["userId"].ToString());
                    servicemasterinfo.CreditPeriod    = int.Parse(sdrreader["creditPeriod"].ToString());
                    servicemasterinfo.ServiceAccount  = decimal.Parse(sdrreader["serviceAccount"].ToString());
                    servicemasterinfo.ExchangeRateId  = decimal.Parse(sdrreader["exchangeRateId"].ToString());
                    servicemasterinfo.EmployeeId      = Convert.ToDecimal(sdrreader["employeeId"].ToString());
                    servicemasterinfo.Customer        = sdrreader["customer"].ToString();
                    servicemasterinfo.Discount        = decimal.Parse(sdrreader["discount"].ToString());
                    servicemasterinfo.GrandTotal      = decimal.Parse(sdrreader["grandTotal"].ToString());
                    servicemasterinfo.VoucherTypeId   = decimal.Parse(sdrreader["voucherTypeId"].ToString());
                    servicemasterinfo.FinancialYearId = decimal.Parse(sdrreader["financialYearId"].ToString());
                    servicemasterinfo.ExtraDate       = DateTime.Parse(sdrreader["extraDate"].ToString());
                    servicemasterinfo.Extra1          = sdrreader["extra1"].ToString();
                    servicemasterinfo.Extra2          = sdrreader["extra2"].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(servicemasterinfo);
        }