Пример #1
0
 /// <summary>
 /// Function to insert values to BarcodeSettings table
 /// </summary>
 /// <param name="barcodesettingsinfo"></param>
 public void BarcodeSettingsAdd(BarcodeSettingsInfo barcodesettingsinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("BarcodeSettingsAddorEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@showProductCode", SqlDbType.Bit);
         sprmparam.Value = barcodesettingsinfo.ShowProductCode;
         sprmparam       = sccmd.Parameters.Add("@showCompanyName", SqlDbType.Bit);
         sprmparam.Value = barcodesettingsinfo.ShowCompanyName;
         sprmparam       = sccmd.Parameters.Add("@companyName", SqlDbType.VarChar);
         sprmparam.Value = barcodesettingsinfo.CompanyName;
         sprmparam       = sccmd.Parameters.Add("@showPurchaseRate", SqlDbType.Bit);
         sprmparam.Value = barcodesettingsinfo.ShowPurchaseRate;
         sprmparam       = sccmd.Parameters.Add("@showMRP", SqlDbType.Bit);
         sprmparam.Value = barcodesettingsinfo.ShowMRP;
         sprmparam       = sccmd.Parameters.Add("@point", SqlDbType.VarChar);
         sprmparam.Value = barcodesettingsinfo.Point;
         sprmparam       = sccmd.Parameters.Add("@zero", SqlDbType.VarChar);
         sprmparam.Value = barcodesettingsinfo.Zero;
         sprmparam       = sccmd.Parameters.Add("@one", SqlDbType.VarChar);
         sprmparam.Value = barcodesettingsinfo.One;
         sprmparam       = sccmd.Parameters.Add("@two", SqlDbType.VarChar);
         sprmparam.Value = barcodesettingsinfo.Two;
         sprmparam       = sccmd.Parameters.Add("@three", SqlDbType.VarChar);
         sprmparam.Value = barcodesettingsinfo.Three;
         sprmparam       = sccmd.Parameters.Add("@four", SqlDbType.VarChar);
         sprmparam.Value = barcodesettingsinfo.Four;
         sprmparam       = sccmd.Parameters.Add("@five", SqlDbType.VarChar);
         sprmparam.Value = barcodesettingsinfo.Five;
         sprmparam       = sccmd.Parameters.Add("@six", SqlDbType.VarChar);
         sprmparam.Value = barcodesettingsinfo.Six;
         sprmparam       = sccmd.Parameters.Add("@seven", SqlDbType.VarChar);
         sprmparam.Value = barcodesettingsinfo.Seven;
         sprmparam       = sccmd.Parameters.Add("@eight", SqlDbType.VarChar);
         sprmparam.Value = barcodesettingsinfo.Eight;
         sprmparam       = sccmd.Parameters.Add("@nine", SqlDbType.VarChar);
         sprmparam.Value = barcodesettingsinfo.Nine;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = barcodesettingsinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = barcodesettingsinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
Пример #2
0
 /// <summary>
 /// Save Or Edit Function
 /// </summary>
 public void SaveOrEdit()
 {
     try
     {
         bool isOk = true;
         if (cbxShowCompanyNAmeAs.Checked && txtShowCompanyName.Text.Trim() == string.Empty)
         {
             MessageBox.Show("Enter company code", "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
             txtShowCompanyName.Focus();
             isOk = false;
         }
         else if ((cbxShowPurchaseRate.Checked && CheckGroupBox()) || (!cbxShowPurchaseRate.Checked))
         {
             if (PublicVariables.isMessageAdd)
             {
                 if (Messages.SaveMessage())
                 {
                     isOk = true;
                 }
                 else
                 {
                     isOk = false;
                 }
             }
             if (isOk)
             {
                 BarcodeSettingsInfo InfoSettings = new BarcodeSettingsInfo();
                 InfoSettings.ShowMRP          = cbxShowMrp.Checked;
                 InfoSettings.ShowProductCode  = rbtnShowProductCode.Checked;
                 InfoSettings.ShowCompanyName  = cbxShowCompanyNAmeAs.Checked;
                 InfoSettings.ShowPurchaseRate = cbxShowPurchaseRate.Checked;
                 InfoSettings.CompanyName      = txtShowCompanyName.Text.Trim();
                 InfoSettings.Zero             = txtZero.Text.Trim();
                 InfoSettings.One    = txtOne.Text.Trim();
                 InfoSettings.Two    = txtTwo.Text.Trim();
                 InfoSettings.Three  = txtThree.Text.Trim();
                 InfoSettings.Four   = txtFour.Text.Trim();
                 InfoSettings.Five   = txtFive.Text.Trim();
                 InfoSettings.Six    = txtSix.Text.Trim();
                 InfoSettings.Seven  = txtSeven.Text.Trim();
                 InfoSettings.Eight  = txtEight.Text.Trim();
                 InfoSettings.Nine   = txtNine.Text.Trim();
                 InfoSettings.Point  = txtPoint.Text.Trim();
                 InfoSettings.Extra1 = string.Empty;
                 InfoSettings.Extra2 = string.Empty;
                 BarcodeSettingsSP spbarcodesetting = new BarcodeSettingsSP();
                 spbarcodesetting.BarcodeSettingsAdd(InfoSettings);
                 Messages.SavedMessage();
                 this.Close();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("BS5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #3
0
        /// <summary>
        /// Function to view particular values based on parameter
        /// </summary>
        /// <param name="barcodeSettingsId"></param>
        /// <returns></returns>
        public BarcodeSettingsInfo BarcodeSettingsView(decimal barcodeSettingsId)
        {
            BarcodeSettingsInfo barcodesettingsinfo = new BarcodeSettingsInfo();
            SqlDataReader       sdrreader           = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("BarcodeSettingsView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@barcodeSettingsId", SqlDbType.Decimal);
                sprmparam.Value = barcodeSettingsId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    barcodesettingsinfo.BarcodeSettingsId = decimal.Parse(sdrreader[0].ToString());
                    barcodesettingsinfo.ShowProductCode   = bool.Parse(sdrreader[1].ToString());
                    barcodesettingsinfo.ShowCompanyName   = bool.Parse(sdrreader[2].ToString());
                    barcodesettingsinfo.CompanyName       = sdrreader[3].ToString();
                    barcodesettingsinfo.ShowPurchaseRate  = bool.Parse(sdrreader[4].ToString());
                    barcodesettingsinfo.ShowMRP           = bool.Parse(sdrreader[5].ToString());
                    barcodesettingsinfo.Point             = sdrreader[6].ToString();
                    barcodesettingsinfo.Zero      = sdrreader[7].ToString();
                    barcodesettingsinfo.One       = sdrreader[8].ToString();
                    barcodesettingsinfo.Two       = sdrreader[9].ToString();
                    barcodesettingsinfo.Three     = sdrreader[10].ToString();
                    barcodesettingsinfo.Four      = sdrreader[11].ToString();
                    barcodesettingsinfo.Five      = sdrreader[12].ToString();
                    barcodesettingsinfo.Six       = sdrreader[13].ToString();
                    barcodesettingsinfo.Seven     = sdrreader[14].ToString();
                    barcodesettingsinfo.Eight     = sdrreader[15].ToString();
                    barcodesettingsinfo.Nine      = sdrreader[16].ToString();
                    barcodesettingsinfo.Extra1    = sdrreader[17].ToString();
                    barcodesettingsinfo.Extra2    = sdrreader[18].ToString();
                    barcodesettingsinfo.ExtraDate = DateTime.Parse(sdrreader[19].ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(barcodesettingsinfo);
        }