Beispiel #1
0
 /// <summary>
 /// Function to Update values in Counter Table
 /// </summary>
 /// <param name="counterinfo"></param>
 public void CounterEdit(CounterInfo counterinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("CounterEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@counterId", SqlDbType.Decimal);
         sprmparam.Value = counterinfo.CounterId;
         sprmparam       = sccmd.Parameters.Add("@counterName", SqlDbType.VarChar);
         sprmparam.Value = counterinfo.CounterName;
         sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = counterinfo.Narration;
         sprmparam       = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = counterinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = counterinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
Beispiel #2
0
 /// <summary>
 /// Function to Update values in Counter Table
 /// </summary>
 /// <param name="counterinfo"></param>
 public void CounterEdit(CounterInfo counterinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("CounterEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@counterId", SqlDbType.Decimal);
         sprmparam.Value = counterinfo.CounterId;
         sprmparam = sccmd.Parameters.Add("@counterName", SqlDbType.VarChar);
         sprmparam.Value = counterinfo.CounterName;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = counterinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = counterinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = counterinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
Beispiel #3
0
 /// <summary>
 /// Function to save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         CounterInfo infoCounter = new CounterInfo();
         CounterSP   spCounter   = new CounterSP();
         infoCounter.CounterName = txtCounterName.Text.Trim();
         infoCounter.Narration   = txtNarration.Text.Trim();
         infoCounter.Extra1      = string.Empty;
         infoCounter.Extra2      = string.Empty;
         if (spCounter.CounterCheckIfExist(txtCounterName.Text.Trim(), 0) == false)
         {
             decLedgerId = spCounter.CounterAddWithIdentity(infoCounter);
             Messages.SavedMessage();
             Clear();
             decIdForOtherForms = decLedgerId;
         }
         else
         {
             Messages.InformationMessage("Counter name already exist");
             txtCounterName.Focus();
         }
         if (frmPOSObj != null)
         {
             this.Close();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("CT3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #4
0
        /// <summary>
        /// Counter view with narration
        /// </summary>
        /// <param name="decCounterId"></param>
        /// <returns></returns>
        public CounterInfo CounterWithNarrationView(decimal decCounterId)
        {
            CounterInfo   counterinfo = new CounterInfo();
            SqlDataReader sdrreader   = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("CounterWithNarrationView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@counterId", SqlDbType.Decimal);
                sprmparam.Value = decCounterId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    counterinfo.CounterId   = Convert.ToDecimal(sdrreader[0].ToString());
                    counterinfo.CounterName = sdrreader[1].ToString();
                    counterinfo.Narration   = sdrreader[2].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(counterinfo);
        }
Beispiel #5
0
 /// <summary>
 /// Function to edit
 /// </summary>
 public void EditFunction()
 {
     try
     {
         CounterInfo infoCounter = new CounterInfo();
         CounterSP   spCounter   = new CounterSP();
         infoCounter.CounterName = txtCounterName.Text.Trim();
         infoCounter.Narration   = txtNarration.Text.Trim();
         infoCounter.Extra1      = string.Empty;
         infoCounter.Extra2      = string.Empty;
         infoCounter.CounterId   = Convert.ToDecimal(dgvCounter.CurrentRow.Cells["dgvtxtcounterId"].Value.ToString());
         if (txtCounterName.Text.ToString() != strCounterName)
         {
             if (spCounter.CounterCheckIfExist(txtCounterName.Text.Trim(), decCounterId) == false)
             {
                 if (spCounter.CounterEditParticularField(infoCounter))
                 {
                     Messages.UpdatedMessage();
                     Clear();
                 }
                 else if (infoCounter.CounterId == 1)
                 {
                     Messages.InformationMessage("Cannot update");
                     Clear();
                     txtCounterName.Focus();
                 }
             }
             else
             {
                 Messages.InformationMessage("Counter name already exist");
                 txtCounterName.Focus();
             }
         }
         else
         {
             spCounter.CounterEditParticularField(infoCounter);
             Messages.UpdatedMessage();
             Clear();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "CT4" + ex.Message;
     }
 }
 /// <summary>
 /// Function to edit
 /// </summary>
 public void EditFunction()
 {
     try
     {
         CounterInfo infoCounter = new CounterInfo();
         CounterBll  bllCounter  = new CounterBll();
         infoCounter.CounterName = txtCounterName.Text.Trim();
         infoCounter.Narration   = txtNarration.Text.Trim();
         infoCounter.Extra1      = string.Empty;
         infoCounter.Extra2      = string.Empty;
         infoCounter.CounterId   = Convert.ToDecimal(dgvCounter.CurrentRow.Cells["dgvtxtcounterId"].Value.ToString());
         if (txtCounterName.Text.ToString() != strCounterName)
         {
             if (bllCounter.CounterCheckIfExist(txtCounterName.Text.Trim(), decCounterId) == false)
             {
                 if (bllCounter.CounterEditParticularField(infoCounter))
                 {
                     Messages.UpdatedMessage();
                     Clear();
                 }
                 else if (infoCounter.CounterId == 1)
                 {
                     Messages.InformationMessage("Cannot update");
                     Clear();
                     txtCounterName.Focus();
                 }
             }
             else
             {
                 Messages.InformationMessage("Counter name already exist");
                 txtCounterName.Focus();
             }
         }
         else
         {
             bllCounter.CounterEditParticularField(infoCounter);
             Messages.UpdatedMessage();
             Clear();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("CT4" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill controls to update
 /// </summary>
 public void FillControls()
 {
     try
     {
         CounterInfo infoCounter = new CounterInfo();
         CounterBll  bllCounter  = new CounterBll();
         infoCounter         = bllCounter.CounterWithNarrationView(Convert.ToDecimal(dgvCounter.CurrentRow.Cells[1].Value.ToString()));
         txtCounterName.Text = infoCounter.CounterName;
         txtNarration.Text   = infoCounter.Narration;
         btnSave.Text        = "Update";
         btnDelete.Enabled   = true;
         decCounterId        = infoCounter.CounterId;
         strCounterName      = infoCounter.CounterName;
     }
     catch (Exception ex)
     {
         MessageBox.Show("CT8" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #8
0
 /// <summary>
 /// Function to fill controls to update
 /// </summary>
 public void FillControls()
 {
     try
     {
         CounterInfo infoCounter = new CounterInfo();
         CounterSP   spCounter   = new CounterSP();
         infoCounter         = spCounter.CounterWithNarrationView(Convert.ToDecimal(dgvCounter.CurrentRow.Cells[1].Value.ToString()));
         txtCounterName.Text = infoCounter.CounterName;
         txtNarration.Text   = infoCounter.Narration;
         btnSave.Text        = "Update";
         btnDelete.Enabled   = true;
         decCounterId        = infoCounter.CounterId;
         strCounterName      = infoCounter.CounterName;
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "CT8" + ex.Message;
     }
 }
Beispiel #9
0
        /// <summary>
        /// Function to insert values to Counter Table
        /// </summary>
        /// <param name="CounterInfo"></param>
        /// <returns></returns>
        public decimal CounterAddWithIdentity(CounterInfo CounterInfo)
        {
            decimal decLedgerId = 0;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("CounterAddWithIdentity", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@counterName", SqlDbType.VarChar);
                sprmparam.Value = CounterInfo.CounterName;
                sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
                sprmparam.Value = CounterInfo.Narration;
                sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
                sprmparam.Value = CounterInfo.Extra1;
                sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
                sprmparam.Value = CounterInfo.Extra2;
                object obj = sccmd.ExecuteScalar();
                if (obj != null)
                {
                    decLedgerId = Convert.ToDecimal(obj.ToString());
                }
                else
                {
                    decLedgerId = 0;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sqlcon.Close();
            }
            return(decLedgerId);
        }
Beispiel #10
0
        /// <summary>
        /// Function to insert values to Counter Table
        /// </summary>
        /// <param name="counterinfo"></param>
        /// <returns></returns>
        public bool CounterAddSpecificFeilds(CounterInfo counterinfo)
        {
            bool isSave = false;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("CounterAddSpecificFeilds", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@counterName", SqlDbType.VarChar);
                sprmparam.Value = counterinfo.CounterName;
                sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
                sprmparam.Value = counterinfo.Narration;
                sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
                sprmparam.Value = counterinfo.Extra1;
                sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
                sprmparam.Value = counterinfo.Extra2;
                int inWork = sccmd.ExecuteNonQuery();
                if (inWork > 0)
                {
                    isSave = true;
                }
                else
                {
                    isSave = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sqlcon.Close();
            }
            return(isSave);
        }
Beispiel #11
0
        /// <summary>
        /// Function to Update values in Counter Table
        /// </summary>
        /// <param name="counterinfo"></param>
        /// <returns></returns>
        public bool CounterEditParticularField(CounterInfo counterinfo)
        {
            bool isEdit = false;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("counterEditParticularField", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@counterId", SqlDbType.Decimal);
                sprmparam.Value = counterinfo.CounterId;
                sprmparam       = sccmd.Parameters.Add("@counterName", SqlDbType.VarChar);
                sprmparam.Value = counterinfo.CounterName;
                sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
                sprmparam.Value = counterinfo.Narration;
                int inAffectedRows = sccmd.ExecuteNonQuery();
                if (inAffectedRows > 0)
                {
                    isEdit = true;
                }
                else
                {
                    isEdit = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sqlcon.Close();
            }
            return(isEdit);
        }
Beispiel #12
0
 /// <summary>
 /// Function to insert values to Counter Table
 /// </summary>
 /// <param name="counterinfo"></param>
 /// <returns></returns>
 public bool CounterAddSpecificFeilds(CounterInfo counterinfo)
 {
     bool isSave = false;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("CounterAddSpecificFeilds", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@counterName", SqlDbType.VarChar);
         sprmparam.Value = counterinfo.CounterName;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = counterinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = counterinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = counterinfo.Extra2;
         int inWork = sccmd.ExecuteNonQuery();
         if (inWork > 0)
         {
             isSave = true;
         }
         else
         {
             isSave = false;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return isSave;
 }
Beispiel #13
0
 /// <summary>
 /// Function to save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         CounterInfo infoCounter = new CounterInfo();
         CounterSP spCounter = new CounterSP();
         infoCounter.CounterName = txtCounterName.Text.Trim();
         infoCounter.Narration = txtNarration.Text.Trim();
         infoCounter.Extra1 = string.Empty;
         infoCounter.Extra2 = string.Empty;
         if (spCounter.CounterCheckIfExist(txtCounterName.Text.Trim(), 0) == false)
         {
             decLedgerId = spCounter.CounterAddWithIdentity(infoCounter);
             Messages.SavedMessage();
             Clear();
             decIdForOtherForms = decLedgerId;
         }
         else
         {
             Messages.InformationMessage("Counter name already exist");
             txtCounterName.Focus();
         }
         if (frmPOSObj != null)
         {
             this.Close();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("CT3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #14
0
 /// <summary>
 /// Function to fill controls to update
 /// </summary>
 public void FillControls()
 {
     try
     {
         CounterInfo infoCounter = new CounterInfo();
         CounterSP spCounter = new CounterSP();
         infoCounter = spCounter.CounterWithNarrationView(Convert.ToDecimal(dgvCounter.CurrentRow.Cells[1].Value.ToString()));
         txtCounterName.Text = infoCounter.CounterName;
         txtNarration.Text = infoCounter.Narration;
         btnSave.Text = "Update";
         btnDelete.Enabled = true;
         decCounterId = infoCounter.CounterId;
         strCounterName = infoCounter.CounterName;
     }
     catch (Exception ex)
     {
         MessageBox.Show("CT8" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #15
0
 /// <summary>
 /// Function to edit
 /// </summary>
 public void EditFunction()
 {
     try
     {
         CounterInfo infoCounter = new CounterInfo();
         CounterSP spCounter = new CounterSP();
         infoCounter.CounterName = txtCounterName.Text.Trim();
         infoCounter.Narration = txtNarration.Text.Trim();
         infoCounter.Extra1 = string.Empty;
         infoCounter.Extra2 = string.Empty;
         infoCounter.CounterId = Convert.ToDecimal(dgvCounter.CurrentRow.Cells["dgvtxtcounterId"].Value.ToString());
         if (txtCounterName.Text.ToString() != strCounterName)
         {
             if (spCounter.CounterCheckIfExist(txtCounterName.Text.Trim(), decCounterId) == false)
             {
                 if (spCounter.CounterEditParticularField(infoCounter))
                 {
                     Messages.UpdatedMessage();
                     Clear();
                 }
                 else if (infoCounter.CounterId == 1)
                 {
                     Messages.InformationMessage("Cannot update");
                     Clear();
                     txtCounterName.Focus();
                 }
             }
             else
             {
                 Messages.InformationMessage("Counter name already exist");
                 txtCounterName.Focus();
             }
         }
         else
         {
             spCounter.CounterEditParticularField(infoCounter);
             Messages.UpdatedMessage();
             Clear();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("CT4" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #16
0
 /// <summary>
 /// Function to Update values in Counter Table
 /// </summary>
 /// <param name="counterinfo"></param>
 /// <returns></returns>
 public bool CounterEditParticularField(CounterInfo counterinfo)
 {
     bool isEdit = false;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("counterEditParticularField", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@counterId", SqlDbType.Decimal);
         sprmparam.Value = counterinfo.CounterId;
         sprmparam = sccmd.Parameters.Add("@counterName", SqlDbType.VarChar);
         sprmparam.Value = counterinfo.CounterName;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = counterinfo.Narration;
         int inAffectedRows = sccmd.ExecuteNonQuery();
         if (inAffectedRows > 0)
         {
             isEdit = true;
         }
         else
         {
             isEdit = false;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return isEdit;
 }
Beispiel #17
0
 /// <summary>
 /// Counter view with narration 
 /// </summary>
 /// <param name="decCounterId"></param>
 /// <returns></returns>
 public CounterInfo CounterWithNarrationView(decimal decCounterId)
 {
     CounterInfo counterinfo = new CounterInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("CounterWithNarrationView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@counterId", SqlDbType.Decimal);
         sprmparam.Value = decCounterId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             counterinfo.CounterId = Convert.ToDecimal(sdrreader[0].ToString());
             counterinfo.CounterName = sdrreader[1].ToString();
             counterinfo.Narration = sdrreader[2].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return counterinfo;
 }
Beispiel #18
0
 /// <summary>
 /// Function to insert values to Counter Table
 /// </summary>
 /// <param name="CounterInfo"></param>
 /// <returns></returns>
 public decimal CounterAddWithIdentity(CounterInfo CounterInfo)
 {
     decimal decLedgerId = 0;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("CounterAddWithIdentity", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@counterName", SqlDbType.VarChar);
         sprmparam.Value = CounterInfo.CounterName;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = CounterInfo.Narration;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = CounterInfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = CounterInfo.Extra2;
         object obj = sccmd.ExecuteScalar();
         if (obj != null)
         {
             decLedgerId = Convert.ToDecimal(obj.ToString());
         }
         else
         {
             decLedgerId = 0;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return decLedgerId;
 }