Exemplo n.º 1
0
        public ReceiptDetails Details(string Module)
        {
            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

                string SQL = SQLSelect() + "WHERE Module = @Module;";

                cmd.Parameters.AddWithValue("Module", Module);

                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);

                ReceiptDetails Details = new ReceiptDetails();
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    Details.Module      = "" + dr["Module"].ToString();
                    Details.Text        = "" + dr["Text"].ToString();
                    Details.Value       = "" + dr["Value"].ToString();
                    Details.Orientation = (ReportFormatOrientation)Enum.Parse(typeof(ReportFormatOrientation), dr["Orientation"].ToString());
                }

                return(Details);
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Exemplo n.º 2
0
        public Int32 Save(ReceiptDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveReceipt(@ReceiptID, @Module, @Text, @Value, @Orientation, @CreatedOn, @LastModified);";

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

                cmd.Parameters.AddWithValue("ReceiptID", Details.ReceiptID);
                cmd.Parameters.AddWithValue("Module", Details.Module);
                cmd.Parameters.AddWithValue("Text", Details.Text);
                cmd.Parameters.AddWithValue("Value", Details.Value);
                cmd.Parameters.AddWithValue("Orientation", Details.Orientation.ToString("d"));
                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);
            }
        }
Exemplo n.º 3
0
 public void Update(ReceiptDetails Details)
 {
     try
     {
         Save(Details);
     }
     catch (Exception ex)
     {
         throw base.ThrowException(ex);
     }
 }
Exemplo n.º 4
0
        public System.Data.DataTable ListAsDataTable(ReceiptDetails ReceiptDetails, string SortField = "ReceiptID", SortOption SortOrder = SortOption.Ascending, Int32 limit = 0)
        {
            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

                string SQL = SQLSelect() + "WHERE 1=1 ";

                if (ReceiptDetails.ReceiptID != 0)
                {
                    SQL += "AND ReceiptID = @ReceiptID) ";
                    cmd.Parameters.AddWithValue("@ReceiptID", ReceiptDetails.ReceiptID);
                }
                if (!string.IsNullOrEmpty(ReceiptDetails.Module))
                {
                    SQL += "AND Module = @Module) ";
                    cmd.Parameters.AddWithValue("@Module", ReceiptDetails.Module);
                }
                if (!string.IsNullOrEmpty(ReceiptDetails.Value))
                {
                    SQL += "AND Value = @Value) ";
                    cmd.Parameters.AddWithValue("@Value", ReceiptDetails.Value);
                }


                SQL += "ORDER BY " + SortField + " ";
                SQL += SortOrder == SortOption.Ascending ? "ASC " : "DESC ";
                SQL += limit == 0 ? "" : "LIMIT " + limit.ToString() + " ";

                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);
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Exemplo n.º 5
0
        public System.Data.DataTable ListAsDataTable(ReceiptDetails ReceiptDetails, string SortField = "ReceiptID", SortOption SortOrder = SortOption.Ascending, Int32 limit = 0)
        {
            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

                string SQL = SQLSelect() + "WHERE 1=1 ";

                if (ReceiptDetails.ReceiptID != 0)
                {
                    SQL += "AND ReceiptID = @ReceiptID) ";
                    cmd.Parameters.AddWithValue("@ReceiptID", ReceiptDetails.ReceiptID);
                }
                if (!string.IsNullOrEmpty(ReceiptDetails.Module))
                {
                    SQL += "AND Module = @Module) ";
                    cmd.Parameters.AddWithValue("@Module", ReceiptDetails.Module);
                }
                if (!string.IsNullOrEmpty(ReceiptDetails.Value))
                {
                    SQL += "AND Value = @Value) ";
                    cmd.Parameters.AddWithValue("@Value", ReceiptDetails.Value);
                }
                

                SQL += "ORDER BY " + SortField + " ";
                SQL += SortOrder == SortOption.Ascending ? "ASC " : "DESC ";
                SQL += limit == 0 ? "" : "LIMIT " + limit.ToString() + " ";

                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;
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Exemplo n.º 6
0
		public ReceiptDetails Details(string Module)
		{
			try
			{
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

				string SQL=	SQLSelect() + "WHERE Module = @Module;"; 
				  
                cmd.Parameters.AddWithValue("Module", Module);

                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);
                
                ReceiptDetails Details = new ReceiptDetails();
				foreach (System.Data.DataRow dr in dt.Rows)
				{
					Details.Module = "" + dr["Module"].ToString();
					Details.Text = "" + dr["Text"].ToString();
					Details.Value = "" + dr["Value"].ToString();
					Details.Orientation = (ReportFormatOrientation) Enum.Parse(typeof(ReportFormatOrientation), dr["Orientation"].ToString());
				}

				return Details;
			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Exemplo n.º 7
0
        public Int32 Save(ReceiptDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveReceipt(@ReceiptID, @Module, @Text, @Value, @Orientation, @CreatedOn, @LastModified);";

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

                cmd.Parameters.AddWithValue("ReceiptID", Details.ReceiptID);
                cmd.Parameters.AddWithValue("Module", Details.Module);
                cmd.Parameters.AddWithValue("Text", Details.Text);
                cmd.Parameters.AddWithValue("Value", Details.Value);
                cmd.Parameters.AddWithValue("Orientation", Details.Orientation.ToString("d"));
                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);
            }
        }
Exemplo n.º 8
0
		public void Update(ReceiptDetails Details)
		{
			try 
			{
                Save(Details);
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
		}
Exemplo n.º 9
0
		private void SaveRecord()
		{
			DropDownList cboOrientationBox;
			DropDownList cboBox;
			TextBox txtBox;
			int iCtr = 1;

			Receipt clsReceipt = new Receipt();
			ReceiptDetails clsDetails = new ReceiptDetails();

			clsDetails.Module = "ReportHeaderSpacer";
			clsDetails.Value = txtReportHeaderSpacer.Text;
			clsReceipt.Update(clsDetails);

			for (iCtr=1;iCtr<=10;iCtr++)
			{
				cboOrientationBox = (DropDownList) this.FindControl("cboReportHeaderOrientation" + iCtr);
				cboBox = (DropDownList) this.FindControl("cboReportHeader" + iCtr);
				txtBox = (TextBox) this.FindControl("txtReportHeader" + iCtr);
				clsDetails.Module = "ReportHeader" + iCtr;
				clsDetails.Text = txtBox.Text;
				clsDetails.Value = cboBox.SelectedItem.Value.ToString();
				clsDetails.Orientation = (ReportFormatOrientation) Enum.Parse(typeof(ReportFormatOrientation),cboOrientationBox.SelectedItem.Value.ToString());

				clsReceipt.Update(clsDetails);
			}
			for (iCtr=1;iCtr<=10;iCtr++)
			{
				cboOrientationBox = (DropDownList) this.FindControl("cboPageHeaderOrientation" + iCtr);
				cboBox = (DropDownList) this.FindControl("cboPageHeader" + iCtr);
				txtBox = (TextBox) this.FindControl("txtPageHeader" + iCtr);

				clsDetails.Module = "PageHeader" + iCtr;
				clsDetails.Text = txtBox.Text;
				clsDetails.Value = cboBox.SelectedItem.Value.ToString();
				clsDetails.Orientation = (ReportFormatOrientation) Enum.Parse(typeof(ReportFormatOrientation),cboOrientationBox.SelectedItem.Value.ToString());

				clsReceipt.Update(clsDetails);
			}
			for (iCtr=1;iCtr<=20;iCtr++)
			{
				cboOrientationBox = (DropDownList) this.FindControl("cboPageFooterAOrientation" + iCtr);
				cboBox = (DropDownList) this.FindControl("cboPageFooterA" + iCtr);
				txtBox = (TextBox) this.FindControl("txtPageFooterA" + iCtr);

				clsDetails.Module = "PageFooterA" + iCtr;
				clsDetails.Text = txtBox.Text;
				clsDetails.Value = cboBox.SelectedItem.Value.ToString();
				clsDetails.Orientation = (ReportFormatOrientation) Enum.Parse(typeof(ReportFormatOrientation),cboOrientationBox.SelectedItem.Value.ToString());

				clsReceipt.Update(clsDetails);
			}
			for (iCtr=1;iCtr<=5;iCtr++)
			{
				cboOrientationBox = (DropDownList) this.FindControl("cboPageFooterBOrientation" + iCtr);
				cboBox = (DropDownList) this.FindControl("cboPageFooterB" + iCtr);
				txtBox = (TextBox) this.FindControl("txtPageFooterB" + iCtr);

				clsDetails.Module = "PageFooterB" + iCtr;
				clsDetails.Text = txtBox.Text;
				clsDetails.Value = cboBox.SelectedItem.Value.ToString();
				clsDetails.Orientation = (ReportFormatOrientation) Enum.Parse(typeof(ReportFormatOrientation),cboOrientationBox.SelectedItem.Value.ToString());

				clsReceipt.Update(clsDetails);
			}
			for (iCtr=1;iCtr<=5;iCtr++)
			{
				cboOrientationBox = (DropDownList) this.FindControl("cboReportFooterOrientation" + iCtr);
				cboBox = (DropDownList) this.FindControl("cboReportFooter" + iCtr);
				txtBox = (TextBox) this.FindControl("txtReportFooter" + iCtr);

				clsDetails.Module = "ReportFooter" + iCtr;
				clsDetails.Text = txtBox.Text;
				clsDetails.Value = cboBox.SelectedItem.Value.ToString();
				clsDetails.Orientation = (ReportFormatOrientation) Enum.Parse(typeof(ReportFormatOrientation),cboOrientationBox.SelectedItem.Value.ToString());

				clsReceipt.Update(clsDetails);
			}

			clsDetails.Module = "ReportFooterSpacer";
			clsDetails.Value = txtReportFooterSpacer.Text;
			clsReceipt.Update(clsDetails);

			clsReceipt.CommitAndDispose();
		}