Пример #1
0
 /// <summary>
 /// Function to Update values in CompanyPath Table
 /// </summary>
 /// <param name="companypathinfo"></param>
 public void CompanyPathEdit(CompanyPathInfo companypathinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("CompanyPathEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@companyId", SqlDbType.Decimal);
         sprmparam.Value = companypathinfo.CompanyId;
         sprmparam       = sccmd.Parameters.Add("@companyName", SqlDbType.VarChar);
         sprmparam.Value = companypathinfo.CompanyName;
         sprmparam       = sccmd.Parameters.Add("@companyPath", SqlDbType.VarChar);
         sprmparam.Value = companypathinfo.CompanyPath;
         sprmparam       = sccmd.Parameters.Add("@isDefault", SqlDbType.Bit);
         sprmparam.Value = companypathinfo.IsDefault;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = companypathinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = companypathinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
Пример #2
0
        /// <summary>
        /// Function to get particular values from CompanyPath Table based on the parameter
        /// </summary>
        /// <param name="companyId"></param>
        /// <returns></returns>
        public CompanyPathInfo CompanyPathView(decimal companyId)
        {
            CompanyPathInfo companypathinfo = new CompanyPathInfo();
            SqlDataReader   sdrreader       = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("CompanyPathView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@companyId", SqlDbType.Decimal);
                sprmparam.Value = companyId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    companypathinfo.CompanyId   = decimal.Parse(sdrreader[0].ToString());
                    companypathinfo.CompanyName = sdrreader[1].ToString();
                    companypathinfo.CompanyPath = sdrreader[2].ToString();
                    companypathinfo.IsDefault   = bool.Parse(sdrreader[3].ToString());
                    companypathinfo.ExtraDate   = DateTime.Parse(sdrreader[4].ToString());
                    companypathinfo.Extra1      = sdrreader[5].ToString();
                    companypathinfo.Extra2      = sdrreader[6].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(companypathinfo);
        }