示例#1
0
        public Int64 Insert(ProductSubGroupBaseVariationsMatrixDetails 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);
            }
        }
示例#2
0
        public Int32 Save(ProductSubGroupBaseVariationsMatrixDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveProductSubGroupBaseVariationsMatrix(@MatrixID, @SubGroupID, @Description, @UnitID," +
                             "@Price, @PurchasePrice, @IncludeInSubtotalDiscount," +
                             "@VAT, @EVAT, @LocalTax, @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("Description", Details.Description);
                cmd.Parameters.AddWithValue("UnitID", Details.UnitID);
                cmd.Parameters.AddWithValue("Price", Details.Price);
                cmd.Parameters.AddWithValue("PurchasePrice", Details.PurchasePrice);
                cmd.Parameters.AddWithValue("IncludeInSubtotalDiscount", Details.IncludeInSubtotalDiscount);
                cmd.Parameters.AddWithValue("VAT", Details.VAT);
                cmd.Parameters.AddWithValue("EVAT", Details.EVAT);
                cmd.Parameters.AddWithValue("LocalTax", Details.LocalTax);
                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);
            }
        }
示例#3
0
        public bool UpdateVariationDesc(ProductSubGroupBaseVariationsMatrixDetails Details)
        {
            try
            {
                string SQL = "UPDATE tblProductSubGroupBaseVariationsMatrix SET " +
                             "Description = @Description " +
                             "WHERE SubGroupID = @SubGroupID AND MatrixID = @MatrixID;";


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

                cmd.Parameters.AddWithValue("@SubGroupID", Details.SubGroupID);
                cmd.Parameters.AddWithValue("@MatrixID", Details.MatrixID);
                cmd.Parameters.AddWithValue("@Description", Details.Description);

                base.ExecuteNonQuery(cmd);

                return(true);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
示例#4
0
        public Int64 InsertBaseVariation(ProductSubGroupBaseVariationsMatrixDetails Details)
        {
            try
            {
                ProductSubGroupBaseVariationsMatrix clsProductSubGroupBaseVariationsMatrix = new ProductSubGroupBaseVariationsMatrix(base.Connection, base.Transaction);
                return(clsProductSubGroupBaseVariationsMatrix.Insert(Details));
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
示例#5
0
        public bool Update(ProductSubGroupBaseVariationsMatrixDetails Details)
        {
            try
            {
                Save(Details);

                return(true);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
示例#6
0
        public bool UpdateBaseVariation(ProductSubGroupBaseVariationsMatrixDetails Details)
        {
            try
            {
                ProductSubGroupBaseVariationsMatrix clsProductSubGroupBaseVariationsMatrix = new ProductSubGroupBaseVariationsMatrix(base.Connection, base.Transaction);
                clsProductSubGroupBaseVariationsMatrix.Update(Details);

                return(true);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
示例#7
0
        public ProductSubGroupBaseVariationsMatrixDetails BaseDetails(Int64 MatrixID, Int64 SubGroupID)
        {
            try
            {
                string SQL = "SELECT " +
                             "MatrixID, " +
                             "SubGroupID, " +
                             "description, " +
                             "a.UnitID, " +
                             "b.UnitName, " +
                             "a.Price, " +
                             "a.PurchasePrice, " +
                             "a.IncludeInSubtotalDiscount, " +
                             "a.VAT, " +
                             "a.EVAT, " +
                             "a.LocalTax " +
                             "FROM tblProductSubGroupBaseVariationsMatrix a INNER JOIN " +
                             "tblUnit b ON a.UnitID = b.UnitID " +
                             "WHERE MatrixID = @MatrixID AND a.SubGroupID = @SubGroupID;";



                MySqlCommand cmd = new MySqlCommand();


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

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

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

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

                ProductSubGroupBaseVariationsMatrixDetails Details = new ProductSubGroupBaseVariationsMatrixDetails();

                while (myReader.Read())
                {
                    Details.MatrixID                  = myReader.GetInt64("MatrixID");
                    Details.SubGroupID                = myReader.GetInt64("SubGroupID");
                    Details.Description               = "" + myReader["Description"].ToString();
                    Details.UnitID                    = myReader.GetInt32("UnitID");
                    Details.UnitName                  = "" + myReader["UnitName"].ToString();
                    Details.Price                     = myReader.GetDecimal("Price");
                    Details.PurchasePrice             = myReader.GetDecimal("PurchasePrice");
                    Details.IncludeInSubtotalDiscount = myReader.GetBoolean("IncludeInSubtotalDiscount");
                    Details.VAT      = myReader.GetDecimal("VAT");
                    Details.EVAT     = myReader.GetDecimal("EVAT");
                    Details.LocalTax = myReader.GetDecimal("LocalTax");
                }

                myReader.Close();

                return(Details);
            }

            catch (Exception ex)
            {
                {
                }

                throw base.ThrowException(ex);
            }
        }