Beispiel #1
0
        public Int32 Save(ProductGroupUnitsMatrixDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveProductGroupUnitMatrix(@MatrixID, @GroupID, @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("GroupID", Details.GroupID);
                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);
            }
        }
		public Int64 Insert(ProductGroupUnitsMatrixDetails 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);
			}	
		}
Beispiel #3
0
        public Int64 Insert(ProductGroupUnitsMatrixDetails 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);
            }
        }
Beispiel #4
0
        public ProductGroupUnitsMatrixDetails UnitDetails(Int64 GroupID, Int64 MatrixID)
        {
            try
            {
                string SQL = "SELECT a.MatrixID, a.GroupID, a.BaseUnitID, b.UnitName 'BaseUnitName', " +
                             "a.BaseUnitValue, a.BottomUnitID, c.UnitName 'BottomUnitName', a.BottomUnitValue " +
                             "FROM tblProductGroupUnitMatrix a INNER JOIN " +
                             "tblUnit b ON a.BaseUnitID = b.UnitID INNER JOIN " +
                             "tblUnit c ON a.BottomUnitID = c.UnitID LEFT OUTER JOIN " +
                             "tblProductGroup d ON a.GroupID = d.GroupID " +
                             "WHERE a.GroupID = " + GroupID + " " +
                             "AND a.MatrixID = " + MatrixID + ";";



                MySqlCommand cmd = new MySqlCommand();


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

//				MySqlParameter prmGroupID = new MySqlParameter("@GroupID",MySqlDbType.Int16);
//				prmGroupID.Value = GroupID;
//				cmd.Parameters.Add(prmGroupID);

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

                ProductGroupUnitsMatrixDetails Details = new ProductGroupUnitsMatrixDetails();

                while (myReader.Read())
                {
                    Details.MatrixID        = myReader.GetInt64("MatrixID");
                    Details.GroupID         = myReader.GetInt64("GroupID");
                    Details.BaseUnitID      = myReader.GetInt32("BaseUnitID");
                    Details.BaseUnitName    = "" + myReader["BaseUnitName"].ToString();
                    Details.BaseUnitValue   = myReader.GetDecimal("BaseUnitValue");
                    Details.BottomUnitID    = myReader.GetInt32("BottomUnitID");
                    Details.BottomUnitName  = "" + myReader["BottomUnitName"].ToString();
                    Details.BottomUnitValue = myReader.GetDecimal("BottomUnitValue");
                }

                myReader.Close();

                return(Details);
            }

            catch (Exception ex)
            {
                {
                }

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

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

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

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

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

				while (myReader.Read()) 
				{
					Details.MatrixID = myReader.GetInt64("MatrixID");
					Details.GroupID = myReader.GetInt64("GroupID");
					Details.BaseUnitID = myReader.GetInt32("BaseUnitID");
					Details.BaseUnitName = "" + myReader["BaseUnitName"].ToString();
					Details.BaseUnitValue = myReader.GetDecimal("BaseUnitValue");
					Details.BottomUnitID = myReader.GetInt32("BottomUnitID");
					Details.BottomUnitName = "" + myReader["BottomUnitName"].ToString();
					Details.BottomUnitValue = myReader.GetDecimal("BottomUnitValue");
				}

				myReader.Close();

				return Details;
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
        public Int32 Save(ProductGroupUnitsMatrixDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveProductGroupUnitMatrix(@MatrixID, @GroupID, @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("GroupID", Details.GroupID);
                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);
            }
        }
Beispiel #9
0
		private void SaveRecord()
		{
			ProductGroupUnitsMatrix clsUnitMatrix = new ProductGroupUnitsMatrix();
			ProductGroupUnitsMatrixDetails clsDetails = new ProductGroupUnitsMatrixDetails();

			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();
		}
Beispiel #10
0
		private Int64 SaveRecord()
		{
			ProductGroupUnitsMatrix clsUnitMatrix = new ProductGroupUnitsMatrix();
			ProductGroupUnitsMatrixDetails clsDetails = new ProductGroupUnitsMatrixDetails();

			clsDetails.GroupID = Convert.ToInt64(lblGroupID.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;
		}