Ejemplo n.º 1
0
        public Int32 Save(SalesTransactionItemAttachmentDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveTransactionItemAttachments(@TransactionItemAttachmentsID, @TransactionItemsID, @TransactionID, @OrigFileName, @FileName, @UploadedByName, @LastUpdatedByName, @CreatedOn, @LastModified);";

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

                cmd.Parameters.AddWithValue("TransactionItemAttachmentsID", Details.TransactionItemAttachmentsID);
                cmd.Parameters.AddWithValue("TransactionItemsID", Details.TransactionItemsID);
                cmd.Parameters.AddWithValue("TransactionID", Details.TransactionID);
                cmd.Parameters.AddWithValue("OrigFileName", Details.OrigFileName);
                cmd.Parameters.AddWithValue("FileName", Details.FileName);
                cmd.Parameters.AddWithValue("UploadedByName", Details.UploadedByName);
                cmd.Parameters.AddWithValue("LastUpdatedByName", Details.LastUpdatedByName);
                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 void Update(SalesTransactionItemAttachmentDetails Details)
		{
			try 
			{
                Save(Details);
			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Ejemplo n.º 3
0
 public void Update(SalesTransactionItemAttachmentDetails Details)
 {
     try
     {
         Save(Details);
     }
     catch (Exception ex)
     {
         throw base.ThrowException(ex);
     }
 }
		public Int32 Insert(SalesTransactionItemAttachmentDetails Details)
		{
			try 
			{
                Save(Details);

                return Int32.Parse(base.getLAST_INSERT_ID(this));
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Ejemplo n.º 5
0
        public Int32 Insert(SalesTransactionItemAttachmentDetails Details)
        {
            try
            {
                Save(Details);

                return(Int32.Parse(base.getLAST_INSERT_ID(this)));
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Ejemplo n.º 6
0
        public System.Data.DataTable ListAsDataTable(SalesTransactionItemAttachmentDetails clsSearchKey = new SalesTransactionItemAttachmentDetails(), string SortField = "TransactionItemAttachmentsID", SortOption SortOrder = SortOption.Ascending)
        {
            MySqlCommand cmd = new MySqlCommand();

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

            string SQL = "SELECT TransactionItemAttachmentsID, TransactionItemsID, TransactionID, " +
                         "OrigFileName, FileName, Deleted, UploadedByName, DeletedByName, LastUpdatedByName, CreatedOn, LastModified " +
                         "FROM tblTransactionItemAttachments WHERE Deleted = 0 ";

            if (clsSearchKey.TransactionItemAttachmentsID != 0)
            {
                SQL += "AND TransactionItemAttachmentsID = @TransactionItemAttachmentsID ";
                cmd.Parameters.AddWithValue("@TransactionItemAttachmentsID", clsSearchKey.TransactionItemAttachmentsID);
            }

            if (clsSearchKey.TransactionItemsID != 0)
            {
                SQL += "AND TransactionItemsID = @TransactionItemsID ";
                cmd.Parameters.AddWithValue("@TransactionItemsID", clsSearchKey.TransactionItemsID);
            }

            if (clsSearchKey.TransactionID != 0)
            {
                SQL += "AND TransactionID = @TransactionID ";
                cmd.Parameters.AddWithValue("@TransactionID", clsSearchKey.TransactionID);
            }

            SQL += "ORDER BY " + (!string.IsNullOrEmpty(SortField) ? SortField : "TransactionItemAttachmentsID") + " ";
            SQL += SortOrder == SortOption.Ascending ? "ASC " : "DESC ";

            cmd.CommandText = SQL;
            string strDataTableName = "tbl" + this.GetType().FullName.Split(new Char[] { '.' })[this.GetType().FullName.Split(new Char[] { '.' }).Length - 1]; System.Data.DataTable dt = new System.Data.DataTable(strDataTableName);

            base.MySqlDataAdapterFill(cmd, dt);

            return(dt);
        }
Ejemplo n.º 7
0
        public SalesTransactionItemAttachmentDetails Details(Int32 TransactionItemAttachmentsID)
        {
            try
            {
                SalesTransactionItemAttachmentDetails clsSearchKey = new SalesTransactionItemAttachmentDetails()
                {
                    TransactionItemAttachmentsID = TransactionItemAttachmentsID
                };

                System.Data.DataTable dt = ListAsDataTable(clsSearchKey);

                SalesTransactionItemAttachmentDetails Details = new SalesTransactionItemAttachmentDetails();
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    Details.TransactionItemAttachmentsID = Int64.Parse(dr["TransactionItemAttachmentsID"].ToString());
                    Details.TransactionItemsID           = Int64.Parse(dr["TransactionItemsID"].ToString());
                    Details.TransactionID = Int64.Parse(dr["TransactionID"].ToString());

                    Details.OrigFileName      = dr["OrigFileName"].ToString();
                    Details.FileName          = dr["FileName"].ToString();
                    Details.Deleted           = bool.Parse(dr["Deleted"].ToString());
                    Details.UploadedByName    = dr["UploadedByName"].ToString();
                    Details.DeletedByName     = dr["DeletedByName"].ToString();
                    Details.LastUpdatedByName = dr["LastUpdatedByName"].ToString();

                    Details.CreatedOn    = DateTime.Parse(dr["CreatedOn"].ToString());
                    Details.LastModified = DateTime.Parse(dr["LastModified"].ToString());
                }

                return(Details);
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
        public Int32 Save(SalesTransactionItemAttachmentDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveTransactionItemAttachments(@TransactionItemAttachmentsID, @TransactionItemsID, @TransactionID, @OrigFileName, @FileName, @UploadedByName, @LastUpdatedByName, @CreatedOn, @LastModified);";

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

                cmd.Parameters.AddWithValue("TransactionItemAttachmentsID", Details.TransactionItemAttachmentsID);
                cmd.Parameters.AddWithValue("TransactionItemsID", Details.TransactionItemsID);
                cmd.Parameters.AddWithValue("TransactionID", Details.TransactionID);
                cmd.Parameters.AddWithValue("OrigFileName", Details.OrigFileName);
                cmd.Parameters.AddWithValue("FileName", Details.FileName);
                cmd.Parameters.AddWithValue("UploadedByName", Details.UploadedByName);
                cmd.Parameters.AddWithValue("LastUpdatedByName", Details.LastUpdatedByName);
                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 System.Data.DataTable ListAsDataTable(SalesTransactionItemAttachmentDetails clsSearchKey = new SalesTransactionItemAttachmentDetails(), string SortField = "TransactionItemAttachmentsID", SortOption SortOrder = SortOption.Ascending)
		{
            MySqlCommand cmd = new MySqlCommand();
            cmd.CommandType = System.Data.CommandType.Text;

            string SQL = "SELECT TransactionItemAttachmentsID, TransactionItemsID, TransactionID, " +
                         "OrigFileName, FileName, Deleted, UploadedByName, DeletedByName, LastUpdatedByName, CreatedOn, LastModified " +
                         "FROM tblTransactionItemAttachments WHERE Deleted = 0 ";

            if (clsSearchKey.TransactionItemAttachmentsID != 0)
            {
                SQL += "AND TransactionItemAttachmentsID = @TransactionItemAttachmentsID ";
                cmd.Parameters.AddWithValue("@TransactionItemAttachmentsID", clsSearchKey.TransactionItemAttachmentsID);
            }

            if (clsSearchKey.TransactionItemsID != 0)
            {
                SQL += "AND TransactionItemsID = @TransactionItemsID ";
                cmd.Parameters.AddWithValue("@TransactionItemsID", clsSearchKey.TransactionItemsID);
            }

            if (clsSearchKey.TransactionID != 0)
            {
                SQL += "AND TransactionID = @TransactionID ";
                cmd.Parameters.AddWithValue("@TransactionID", clsSearchKey.TransactionID);
            }

            SQL += "ORDER BY " + (!string.IsNullOrEmpty(SortField) ? SortField : "TransactionItemAttachmentsID") + " ";
            SQL += SortOrder == SortOption.Ascending ? "ASC " : "DESC ";
            
            cmd.CommandText = SQL;
            string strDataTableName = "tbl" + this.GetType().FullName.Split(new Char[] { '.' })[this.GetType().FullName.Split(new Char[] { '.' }).Length - 1]; System.Data.DataTable dt = new System.Data.DataTable(strDataTableName);
            base.MySqlDataAdapterFill(cmd, dt);

            return dt;
		}
		public SalesTransactionItemAttachmentDetails Details(Int32 TransactionItemAttachmentsID)
		{
			try
			{
                SalesTransactionItemAttachmentDetails clsSearchKey = new SalesTransactionItemAttachmentDetails()
                { TransactionItemAttachmentsID = TransactionItemAttachmentsID };

                System.Data.DataTable dt = ListAsDataTable(clsSearchKey);

                SalesTransactionItemAttachmentDetails Details = new SalesTransactionItemAttachmentDetails();
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    Details.TransactionItemAttachmentsID = Int64.Parse(dr["TransactionItemAttachmentsID"].ToString());
                    Details.TransactionItemsID = Int64.Parse(dr["TransactionItemsID"].ToString());
                    Details.TransactionID = Int64.Parse(dr["TransactionID"].ToString());

                    Details.OrigFileName = dr["OrigFileName"].ToString();
                    Details.FileName = dr["FileName"].ToString();
                    Details.Deleted = bool.Parse(dr["Deleted"].ToString());
                    Details.UploadedByName = dr["UploadedByName"].ToString();
                    Details.DeletedByName = dr["DeletedByName"].ToString();
                    Details.LastUpdatedByName = dr["LastUpdatedByName"].ToString();

                    Details.CreatedOn = DateTime.Parse(dr["CreatedOn"].ToString());
                    Details.LastModified = DateTime.Parse(dr["LastModified"].ToString());
                }

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