Пример #1
0
        public List <CSalesproduct> allselsproduct(string uID)
        {
            List <CSalesproduct> salesproductList = new List <CSalesproduct>();
            DataTable            oDt = null;

            try
            {
                strSQL = string.Format("SELECT SOMstr_OID, SOMstr_Branch, SOMstr_Code, SOMstr_Date,SOMstr_TotalAmt,SOMstr_NetAmt FROM dbo.t_SOMstr ");

                oManager = new CConManager();
                oDt      = oManager.Read(strSQL);
                if (oDt != null)
                {
                    foreach (DataRow dr in oDt.Rows)
                    {
                        CSalesproduct osalesproduct = new CSalesproduct();
                        osalesproduct.SOMstr_OID      = dr["SOMstr_OID"].ToString();
                        osalesproduct.SOMstr_Branch   = dr["SOMstr_Branch"].ToString();
                        osalesproduct.SOMstr_Code     = dr["SOMstr_Code"].ToString();
                        osalesproduct.SOMstr_Date     = DateTime.Parse(dr["SOMstr_Date"].ToString());
                        osalesproduct.SOMstr_TotalAmt = float.Parse(dr["SOMstr_TotalAmt"].ToString());
                        osalesproduct.SOMstr_NetAmt   = float.Parse(dr["SOMstr_NetAmt"].ToString());
                        salesproductList.Add(osalesproduct);

                        osalesproduct = null;
                    }
                }
            }
            catch (Exception ex)
            {
                CConManager oManager = new CConManager();
                oManager.s_ErrorMessage = ex.Message;
            }
            return(salesproductList);
        }
Пример #2
0
        private void dgvSaleaProduct_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            CDeleteSalesPorduct oSaleaProduct = new CDeleteSalesPorduct();


            if (dgvSaleaProduct.Rows.Count > 0)
            {
                if (e.RowIndex != -1)
                {
                    if (e.ColumnIndex == 6)
                    {
                        if (MessageBox.Show("Are You Sure You Want TO Delete Sales Data?", "Sales Delete!!", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            string SODMas_OID = dgvSaleaProduct.Rows[e.RowIndex].Cells["CSalesID"].Value.ToString();

                            CSalesproduct oSalseMaster = oSaleaProduct.DeleteFromMaster(SODMas_OID, CurrentUser);
                            dgvSaleaProduct.Rows.RemoveAt(e.RowIndex);

                            dgvSaleaProduct.Refresh();
                            dgvSaleaDetails.Rows.Clear();
                        }
                    }
                }
            }
        }
Пример #3
0
        public CSalesproduct DeleteFromMaster(string SOMaster_OID, string uID)
        {
            CSalesproduct oSaleaProduct = new CSalesproduct();
            DataTable     oDt           = null;

            try
            {
                strSQL = "delete from t_SODet where  SODet_MStrOID = '" + SOMaster_OID + "'";

                oManager = new CConManager();
                oDt      = oManager.Read(strSQL);

                strSQL = string.Empty;

                strSQL = "delete from t_SOMstr where  SOMstr_OID = '" + SOMaster_OID + "'";

                oManager = new CConManager();
                oDt      = oManager.Read(strSQL);

                //strSQL = "Update t_SOMstr set SOMstr_OID='" +  + "'";
            }
            catch (Exception ex)
            {
                CConManager oManager = new CConManager();
                oManager.s_ErrorMessage = ex.Message;
            }
            return(oSaleaProduct);
        }
Пример #4
0
        private void dgvSaleaProduct_CellClick_1(object sender, DataGridViewCellEventArgs e)
        {
            CDeleteSalesPorduct oSaleaProduct = new CDeleteSalesPorduct();


            if (dgvSaleaProduct.Rows.Count > 0)
            {
                if (e.RowIndex != -1)
                {
                    if (e.ColumnIndex == 4)
                    {
                        if (MessageBox.Show("Are You Sure You Want TO Delete Sales Data?", "Sales Delete!!", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            string SODMas_OID = dgvSaleaProduct.Rows[e.RowIndex].Cells["CSalesID"].Value.ToString();
                            float  amount     = float.Parse(dgvSaleaProduct.Rows[e.RowIndex].Cells["SOMstr_NetAmt"].Value.ToString());
                            float  NetAmount  = float.Parse(txtTotalNetAmount.Text);
                            //float deletedAmount = NetAmount - amount;
                            float percentage = (amount * 100) / NetAmount;
                            txtDeletedAmount.Text = percentage.ToString();

                            CSalesproduct oSalseMaster = oSaleaProduct.DeleteFromMaster(SODMas_OID, CurrentUser);
                            dgvSaleaProduct.Rows.RemoveAt(e.RowIndex);

                            btnScarch_Click(sender, e);
                            //dgvSaleaDetails.Rows.Clear();
                            //getmaxID();
                        }
                    }
                }
            }
        }