Exemple #1
0
        private void ddlProduct_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                BO.ProductPackSize objProductPackSize = new BO.ProductPackSize();
                int productId = Convert.ToInt32(ddlProduct.SelectedValue);
                var product   = _IProduct.GetProductList().FirstOrDefault(m => m.ProductId == productId);
                txtPackSizee.Text = product.PackSize;

                var productPackSize = _IProductPackSize.GETStripAndPcsPerStripByProductID(productId);
                txtStrip.Text       = Convert.ToString(productPackSize.Strip);
                txtPcsPerStrip.Text = Convert.ToString(productPackSize.PcsPerStrip);
                GetCurrentStock();
                Reset();
                //List<BO.ProductPackSize> objPackSizeList = new List<BO.ProductPackSize>();
                //foreach (var objProduct in productList)
                //{
                //    BO.ProductPackSize objPackSize = new BO.ProductPackSize();
                //    //objPackSize.PackSizeID = objProduct.ProdPackSize.PackSizeID;
                //    objPackSize.PackSizeID = objProduct.PackSizeID;
                //    objPackSize.PackSize = objProduct.PackSize;
                //    objPackSizeList.Add(objPackSize);
                //}
            }
            catch (Exception ex)
            {
            }
        }
Exemple #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                BO.ProductPackSize ObjProductPackSize = new BO.ProductPackSize();

                ObjProductPackSize.PackSize            = txtPackSize.Text;
                ObjProductPackSize.Strip               = Convert.ToInt32(txtStrip.Text);
                ObjProductPackSize.PcsPerStrip         = Convert.ToInt32(txtPcsPerStrip.Text);
                ObjProductPackSize.PackSizeDescription = txtDescription.Text;

                if (btnSave.Text == "Update" && txtPackSize.Text != "")
                {
                    ObjProductPackSize.PackSizeID = ID;
                    if (_IProductPackSize.Update(ObjProductPackSize) > 0)
                    {
                        MessageBox.Show("Successfully Update");
                        Reset();
                    }
                }

                else if (txtPackSize.Text != "")
                {
                    if (_IProductPackSize.Insert(ObjProductPackSize) > 0)
                    {
                        MessageBox.Show("Operation Success");
                        //MsgBox msgbox = new MsgBox();
                        //msgbox.Show();
                        //lblMessageBox.Text = "Operation Success";
                        //lblMessageBox.ForeColor = Color.Green;
                        // GetBrand();
                        Reset();
                    }
                    else
                    {
                        lblMessageBox.Text      = "Operation Failed";
                        lblMessageBox.ForeColor = System.Drawing.Color.Red;
                        // lblMessageBox.Font.Bold = true;
                    }
                }
                else
                {
                    MsgBox msgbox = new MsgBox();
                    msgbox.Show();
                    txtPackSize.Focus();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #3
0
 private IList <BO.ProductPackSize> GetProductPackSizeList(Int32?PackSizeID)
 {
     try
     {
         SqlConnection  con = CreateCon();
         SqlDataAdapter da  = new SqlDataAdapter();
         da.SelectCommand             = new SqlCommand();
         da.SelectCommand.CommandText = "[POS_SP_GET_GETProductPackSize]";
         da.SelectCommand.CommandType = CommandType.StoredProcedure;
         da.SelectCommand.Connection  = con;
         //   da.SelectCommand.Parameters.Add("@PackSizeID", System.Data.SqlDbType.Int).Value = PackSizeID;
         if (con.State == ConnectionState.Closed)
         {
             con.Open();
         }
         DataSet ds = new DataSet();
         da.Fill(ds);
         if (con.State == ConnectionState.Open)
         {
             con.Close();
         }
         DataTable dt = ds.Tables[0];
         List <POS.BO.ProductPackSize> objDoctorList = new List <POS.BO.ProductPackSize>();
         POS.BO.ProductPackSize        obj           = null;
         int index = 1;
         foreach (DataRow row in dt.Rows)
         {
             obj                     = new BO.ProductPackSize();
             obj.Sln                 = index++;
             obj.PackSizeID          = Convert.ToInt32(row["PackSizeID"]);
             obj.Strip               = Convert.ToInt32(row["Strip"]);
             obj.PcsPerStrip         = Convert.ToInt32(row["PcsPerStrip"]);
             obj.PackSize            = row["PackSizeName"].ToString();
             obj.PackSizeDescription = row["Description"].ToString();
             objDoctorList.Add(obj);
         }
         return(objDoctorList);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #4
0
 public BO.ProductPackSize GETStripAndPcsPerStripByProductID(long productID)
 {
     try
     {
         SqlConnection  con = CreateCon();
         SqlDataAdapter da  = new SqlDataAdapter();
         da.SelectCommand             = new SqlCommand();
         da.SelectCommand.CommandText = "POS_SET_SP_GET_StripAndPcsPerStripByProductID";
         da.SelectCommand.CommandType = CommandType.StoredProcedure;
         da.SelectCommand.Connection  = con;
         da.SelectCommand.Parameters.Add("@ProductID", System.Data.SqlDbType.BigInt).Value = productID;
         if (con.State == ConnectionState.Closed)
         {
             con.Open();
         }
         DataSet ds = new DataSet();
         da.Fill(ds);
         if (con.State == ConnectionState.Open)
         {
             con.Close();
         }
         DataTable dt = ds.Tables[0];
         List <POS.BO.ProductPackSize> objProductPackSize = new List <POS.BO.ProductPackSize>();
         POS.BO.ProductPackSize        obj = null;
         int index = 1;
         foreach (DataRow row in dt.Rows)
         {
             obj             = new BO.ProductPackSize();
             obj.Sln         = index++;
             obj.ProductId   = Convert.ToInt32(row["ProductID"]);
             obj.PackSizeID  = Convert.ToInt32(row["PackSizeID"]);
             obj.Strip       = Convert.ToInt32(row["Strip"]);
             obj.PcsPerStrip = Convert.ToInt32(row["PcsPerStrip"]);
             obj.PackSize    = row["PackSizeName"].ToString();
         }
         return(obj);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #5
0
        private void grvPackSize_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                BO.ProductPackSize ObjProductPackSize = new BO.ProductPackSize();
                if (e.ColumnIndex == grvPackSize.Columns["Edit"].Index && e.RowIndex >= 0)
                {
                    int numberRow = Convert.ToInt32(e.RowIndex);
                    ID = Convert.ToInt32(grvPackSize.Rows[numberRow].Cells[0].Value.ToString());

                    ObjProductPackSize = _IProductPackSize.GetProductPackSizeList().FirstOrDefault(m => m.PackSizeID == ID);

                    txtPackSize.Text    = Convert.ToString(ObjProductPackSize.PackSize);
                    txtStrip.Text       = Convert.ToString(ObjProductPackSize.Strip);
                    txtDescription.Text = Convert.ToString(ObjProductPackSize.PackSizeDescription);
                    txtPcsPerStrip.Text = Convert.ToString(ObjProductPackSize.PcsPerStrip);
                    //txtPackSize.Text = Convert.ToString(grvPackSize.Rows[numberRow].Cells[2].Value);
                    //txtStrip.Text = Convert.ToString(grvPackSize.Rows[numberRow].Cells[3].Value);
                    //txtPcsPerStrip.Text = Convert.ToString(grvPackSize.Rows[numberRow].Cells[4]);
                    //txtDescription.Text = Convert.ToString(grvPackSize.Rows[numberRow].Cells[5].Value);
                    btnSave.Text = "Update";
                }
                if (e.ColumnIndex == grvPackSize.Columns["Delete"].Index && e.RowIndex >= 0)
                {
                    int numberRow = Convert.ToInt32(e.RowIndex);
                    ID = Convert.ToInt32(grvPackSize.Rows[numberRow].Cells[0].Value.ToString());
                    if (_IProductPackSize.Delete(ID) > 0)
                    {
                        MessageBox.Show("Operation Success");
                        Reset();
                    }
                }
            }
            catch (Exception ex)
            {
                lblMessageBox.Text      = ex.ToString();
                lblMessageBox.Enabled   = true;
                lblMessageBox.ForeColor = Color.Red;
            }
        }