Exemple #1
0
        public Int32 Save(ProductSubGroupUnitsMatrixDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveProductSubGroupUnitMatrix(@MatrixID, @SubGroupID, @BaseUnitID, @BaseUnitValue, " +
                             "@BottomUnitID, @BottomUnitValue, @CreatedOn, @LastModified);";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("MatrixID", Details.MatrixID);
                cmd.Parameters.AddWithValue("SubGroupID", Details.SubGroupID);
                cmd.Parameters.AddWithValue("BaseUnitID", Details.BaseUnitID);
                cmd.Parameters.AddWithValue("BaseUnitValue", Details.BaseUnitValue);
                cmd.Parameters.AddWithValue("BottomUnitID", Details.BottomUnitID);
                cmd.Parameters.AddWithValue("BottomUnitValue", Details.BottomUnitValue);
                cmd.Parameters.AddWithValue("CreatedOn", Details.CreatedOn == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.CreatedOn);
                cmd.Parameters.AddWithValue("LastModified", Details.LastModified == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.LastModified);

                return(base.ExecuteNonQuery(cmd));
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Exemple #2
0
        public Int64 Insert(ProductSubGroupUnitsMatrixDetails Details)
        {
            try
            {
                Save(Details);

                string SQL = "SELECT LAST_INSERT_ID();";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                System.Data.DataTable dt = new System.Data.DataTable("LAST_INSERT_ID");
                base.MySqlDataAdapterFill(cmd, dt);


                Int64 iID = 0;
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    iID = Int64.Parse(dr[0].ToString());
                }

                return(iID);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
		public Int64 Insert(ProductSubGroupUnitsMatrixDetails Details)
		{
			try 
			{
                Save(Details);

                string SQL = "SELECT LAST_INSERT_ID();";
	 			
				MySqlCommand cmd = new MySqlCommand();
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;
				
                System.Data.DataTable dt = new System.Data.DataTable("LAST_INSERT_ID");
                base.MySqlDataAdapterFill(cmd, dt);
                

                Int64 iID = 0;
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    iID = Int64.Parse(dr[0].ToString());
                }							

				return iID;
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Exemple #4
0
        public ProductSubGroupUnitsMatrixDetails LastDetails(Int64 SubGroupID)
        {
            try
            {
                string SQL = "SELECT a.MatrixID, a.SubGroupID, a.BaseUnitID, b.UnitName 'BaseUnitName', " +
                             "a.BaseUnitValue, a.BottomUnitID, c.UnitName 'BottomUnitName', a.BottomUnitValue " +
                             "FROM tblProductSubGroupUnitMatrix a INNER JOIN " +
                             "tblUnit b ON a.BaseUnitID = b.UnitID INNER JOIN " +
                             "tblUnit c ON a.BottomUnitID = c.UnitID LEFT OUTER JOIN " +
                             "tblProductSubGroup d ON a.SubGroupID = d.ProductSubGroupID " +
                             "WHERE a.SubGroupID = @SubGroupID " +
                             "ORDER BY a.MatrixID DESC LIMIT 1;";



                MySqlCommand cmd = new MySqlCommand();


                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                MySqlParameter prmSubGroupID = new MySqlParameter("@SubGroupID", MySqlDbType.Int64);
                prmSubGroupID.Value = SubGroupID;
                cmd.Parameters.Add(prmSubGroupID);

                MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult);

                ProductSubGroupUnitsMatrixDetails Details = new ProductSubGroupUnitsMatrixDetails();

                while (myReader.Read())
                {
                    Details.MatrixID        = myReader.GetInt64(0);
                    Details.SubGroupID      = myReader.GetInt16(1);;
                    Details.BaseUnitID      = myReader.GetInt16(2);
                    Details.BaseUnitName    = myReader.GetString(3);
                    Details.BaseUnitValue   = myReader.GetDecimal(4);
                    Details.BottomUnitID    = myReader.GetInt16(5);
                    Details.BottomUnitName  = myReader.GetString(6);
                    Details.BottomUnitValue = myReader.GetDecimal(7);
                }

                myReader.Close();

                return(Details);
            }

            catch (Exception ex)
            {
                {
                }

                throw base.ThrowException(ex);
            }
        }
Exemple #5
0
        public void Update(ProductSubGroupUnitsMatrixDetails Details)
        {
            try
            {
                Save(Details);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Exemple #6
0
		private void SaveRecord()
		{
			ProductSubGroupUnitsMatrix clsUnitMatrix = new ProductSubGroupUnitsMatrix();
			ProductSubGroupUnitsMatrixDetails clsDetails = new ProductSubGroupUnitsMatrixDetails();

			clsDetails.MatrixID = Convert.ToInt64(lblMatrixID.Text);
			clsDetails.BaseUnitID = Convert.ToInt32(lblBaseUnitID.Text);
			clsDetails.BaseUnitValue = Convert.ToDecimal(txtBaseUnitValue.Text);
			clsDetails.BottomUnitID = Convert.ToInt32(cboBottomUnit.SelectedItem.Value);
			clsDetails.BottomUnitValue = Convert.ToDecimal(txtBottomUnitValue.Text);
			clsUnitMatrix.Update(clsDetails);
			
			clsUnitMatrix.CommitAndDispose();
		}
Exemple #7
0
		private Int64 SaveRecord()
		{
			ProductSubGroupUnitsMatrix clsUnitMatrix = new ProductSubGroupUnitsMatrix();
			ProductSubGroupUnitsMatrixDetails clsDetails = new ProductSubGroupUnitsMatrixDetails();

			clsDetails.SubGroupID = Convert.ToInt32(lblSubGroupID.Text);
			clsDetails.BaseUnitID = Convert.ToInt32(lblBaseUnitID.Text);
			clsDetails.BaseUnitValue = Convert.ToDecimal(txtBaseUnitValue.Text);
			clsDetails.BottomUnitID = Convert.ToInt32(cboBottomUnit.SelectedItem.Value);
			clsDetails.BottomUnitValue = Convert.ToDecimal(txtBottomUnitValue.Text);
			Int64 id = clsUnitMatrix.Insert(clsDetails);
			
			clsUnitMatrix.CommitAndDispose();

			return id;
		}
		public void InheritGroupUnitMatrix(Int64 ProductGroupID, Int64 ProductSubGroupID)
		{
			try 
			{	
				

				ProductGroupUnitsMatrix clsProductGroupUnitsMatrix = new ProductGroupUnitsMatrix(base.Connection, base.Transaction);

				ProductSubGroupUnitsMatrix clsUnitMatrix = new ProductSubGroupUnitsMatrix(base.Connection, base.Transaction);
				ProductSubGroupUnitsMatrixDetails clsProductSubGroupUnitsMatrixDetails = new ProductSubGroupUnitsMatrixDetails();

				MySqlDataReader clsProductGroupUnitsMatrixList = clsProductGroupUnitsMatrix.List(ProductGroupID,"MatrixID",SortOption.Ascending);
				
				while (clsProductGroupUnitsMatrixList.Read())
				{
					clsProductSubGroupUnitsMatrixDetails.SubGroupID = Convert.ToInt64(ProductSubGroupID);
					clsProductSubGroupUnitsMatrixDetails.BaseUnitID = Convert.ToInt32(clsProductGroupUnitsMatrixList["BaseUnitID"]);
					clsProductSubGroupUnitsMatrixDetails.BaseUnitValue = Convert.ToDecimal(clsProductGroupUnitsMatrixList["BaseUnitValue"]);
					clsProductSubGroupUnitsMatrixDetails.BottomUnitID = Convert.ToInt32(clsProductGroupUnitsMatrixList["BottomUnitID"]);
					clsProductSubGroupUnitsMatrixDetails.BottomUnitValue = Convert.ToDecimal(clsProductGroupUnitsMatrixList["BottomUnitValue"]);
					clsUnitMatrix.Insert(clsProductSubGroupUnitsMatrixDetails);

				}
				clsProductGroupUnitsMatrixList.Close();
			}

			catch (Exception ex)
			{
				
				
				{
					
					
					
					
				}

				throw base.ThrowException(ex);
			}	
		}
		public void Update(ProductSubGroupUnitsMatrixDetails Details)
		{
			try 
			{
                Save(Details);
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
		public ProductSubGroupUnitsMatrixDetails LastDetails(Int64 SubGroupID)
		{
			try
			{
				string SQL =	"SELECT a.MatrixID, a.SubGroupID, a.BaseUnitID, b.UnitName 'BaseUnitName', " +
					"a.BaseUnitValue, a.BottomUnitID, c.UnitName 'BottomUnitName', a.BottomUnitValue " +
					"FROM tblProductSubGroupUnitMatrix a INNER JOIN " +
					"tblUnit b ON a.BaseUnitID = b.UnitID INNER JOIN " + 
					"tblUnit c ON a.BottomUnitID = c.UnitID LEFT OUTER JOIN " + 	
					"tblProductSubGroup d ON a.SubGroupID = d.ProductSubGroupID " +
					"WHERE a.SubGroupID = @SubGroupID " +
					"ORDER BY a.MatrixID DESC LIMIT 1;"; 
				  
				
	 			
				MySqlCommand cmd = new MySqlCommand();
				
				
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;

				MySqlParameter prmSubGroupID = new MySqlParameter("@SubGroupID",MySqlDbType.Int64);			
				prmSubGroupID.Value = SubGroupID;
				cmd.Parameters.Add(prmSubGroupID);

				MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult);
				
				ProductSubGroupUnitsMatrixDetails Details = new ProductSubGroupUnitsMatrixDetails();

				while (myReader.Read()) 
				{
					Details.MatrixID = myReader.GetInt64(0);
					Details.SubGroupID = myReader.GetInt16(1);;
					Details.BaseUnitID = myReader.GetInt16(2);
					Details.BaseUnitName = myReader.GetString(3);
					Details.BaseUnitValue = myReader.GetDecimal(4);
					Details.BottomUnitID = myReader.GetInt16(5);
					Details.BottomUnitName = myReader.GetString(6);
					Details.BottomUnitValue = myReader.GetDecimal(7);
				}

				myReader.Close();

				return Details;
			}

			catch (Exception ex)
			{
				
				
				{
					
					
					
					
				}

				throw base.ThrowException(ex);
			}	
		}
        public Int32 Save(ProductSubGroupUnitsMatrixDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveProductSubGroupUnitMatrix(@MatrixID, @SubGroupID, @BaseUnitID, @BaseUnitValue, " +
                                                    "@BottomUnitID, @BottomUnitValue, @CreatedOn, @LastModified);";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("MatrixID", Details.MatrixID);
                cmd.Parameters.AddWithValue("SubGroupID", Details.SubGroupID);
                cmd.Parameters.AddWithValue("BaseUnitID", Details.BaseUnitID);
                cmd.Parameters.AddWithValue("BaseUnitValue", Details.BaseUnitValue);
                cmd.Parameters.AddWithValue("BottomUnitID", Details.BottomUnitID);
                cmd.Parameters.AddWithValue("BottomUnitValue", Details.BottomUnitValue);
                cmd.Parameters.AddWithValue("CreatedOn", Details.CreatedOn == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.CreatedOn);
                cmd.Parameters.AddWithValue("LastModified", Details.LastModified == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.LastModified);

                return base.ExecuteNonQuery(cmd);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }