Ejemplo n.º 1
0
        public Int32 Save(CashCountDetails Details)
        {
            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

                string SQL = "CALL procSaveCashCount(@BranchID, @TerminalNo, @SyncID, @CashCountID, @CashierID, @CashierName, @DateCreated, @DenominationID, @DenominationValue, @DenominationCount, @DenominationAmount, @BranchCode, @CreatedOn, @LastModified);";

                cmd.Parameters.AddWithValue("BranchID", Details.BranchDetails.BranchID);
                cmd.Parameters.AddWithValue("TerminalNo", Details.TerminalNo);
                cmd.Parameters.AddWithValue("SyncID", Details.SyncID);
                cmd.Parameters.AddWithValue("CashCountID", Details.CashCountID);
                cmd.Parameters.AddWithValue("CashierID", Details.CashierID);
                cmd.Parameters.AddWithValue("CashierName", Details.CashierName);
                cmd.Parameters.AddWithValue("DateCreated", Details.DateCreated);
                cmd.Parameters.AddWithValue("DenominationID", Details.DenominationDetails.DenominationID);
                cmd.Parameters.AddWithValue("DenominationValue", Details.DenominationDetails.DenominationValue);
                cmd.Parameters.AddWithValue("DenominationCount", Details.DenominationCount);
                cmd.Parameters.AddWithValue("DenominationAmount", Details.DenominationAmount);
                cmd.Parameters.AddWithValue("BranchCode", Details.BranchDetails.BranchCode);
                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);

                cmd.CommandText = SQL;
                return(base.ExecuteNonQuery(cmd));
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Ejemplo n.º 2
0
        private Int64 Insert(CashCountDetails Details)
        {
            try
            {
                Save(Details);

                return(Int64.Parse(base.getLAST_INSERT_ID(this)));
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Ejemplo n.º 3
0
		private Int64 Insert(CashCountDetails Details)
		{
			try 
			{
                Save(Details);

                return Int64.Parse(base.getLAST_INSERT_ID(this));
			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Ejemplo n.º 4
0
        public System.Data.DataTable ListAsDataTable(CashCountDetails clsSearchKey, string SortField = "CashCountID", 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 (clsSearchKey.CashierID != 0)
                {
                    SQL += "AND CashierID = @CashierID ";
                    cmd.Parameters.AddWithValue("CashierID", clsSearchKey.CashierID);
                }
                if (!string.IsNullOrEmpty(clsSearchKey.TerminalNo))
                {
                    SQL += "AND TerminalNo = @TerminalNo ";
                    cmd.Parameters.AddWithValue("CashierID", clsSearchKey.CashierID);
                }
                if (!string.IsNullOrEmpty(clsSearchKey.CashierName))
                {
                    SQL += "AND CashierName = @CashierName ";
                    cmd.Parameters.AddWithValue("CashierID", clsSearchKey.CashierID);
                }
                if (!string.IsNullOrEmpty(clsSearchKey.DenominationDetails.DenominationCode))
                {
                    SQL += "AND DenominationCode = @DenominationCode ";
                    cmd.Parameters.AddWithValue("CashierID", clsSearchKey.CashierID);
                }

                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);
            }
        }
Ejemplo n.º 5
0
		public void Insert(CashCountDetails[] Details)
		{
			try 
			{
				if (Details.Length > 0)
				{
                    decimal Amount = 0;
					foreach(CashCountDetails details in Details)
					{
						Insert(details);	
						Amount += details.DenominationAmount;
					}
					CashierReports clsCashierReport = new CashierReports(base.Connection, base.Transaction);
                    clsCashierReport.UpdateCashCount(Details[0].BranchDetails.BranchID, Details[0].CashierID, Details[0].TerminalNo, Amount);
				}
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Ejemplo n.º 6
0
        public CashCountDetails Details(Int64 CashCountID)
        {
            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

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

                cmd.Parameters.AddWithValue("@CashCountID", CashCountID);

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

                CashCountDetails Details = new CashCountDetails();
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    Details.BranchDetails       = new Branch(base.Connection, base.Transaction).Details(Int32.Parse(dr["BranchID"].ToString()));
                    Details.TerminalNo          = dr["TerminalNo"].ToString();
                    Details.SyncID              = Int64.Parse(dr["SyncID"].ToString());
                    Details.CashCountID         = Int64.Parse(dr["CashCountID"].ToString());
                    Details.CashierID           = Int64.Parse(dr["CashierID"].ToString());
                    Details.CashierName         = dr["CashierName"].ToString();
                    Details.DateCreated         = DateTime.Parse(dr["DateCreated"].ToString());
                    Details.DenominationDetails = new Denominations(base.Connection, base.Transaction).Details(Int32.Parse(dr["DenominationID"].ToString()));
                    Details.DenominationValue   = decimal.Parse(dr["DenominationValue"].ToString());
                    Details.DenominationCount   = Int32.Parse(dr["DenominationCount"].ToString());
                    Details.DenominationAmount  = Int32.Parse(dr["DenominationAmount"].ToString());
                }

                return(Details);
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Ejemplo n.º 7
0
        private bool SaveRecord()
        {
            System.Data.DataTable dt = (System.Data.DataTable) dgCashCount.DataSource;

            ArrayList arrCashCountDetails = new ArrayList();
            CashCountDetails clsDetails;
            //CashCounts clsCashCount = new CashCounts();

            foreach (System.Data.DataRow dr in dt.Rows)
            {
                clsDetails = new CashCountDetails();
                clsDetails.BranchDetails = mclsTerminalDetails.BranchDetails;
                clsDetails.TerminalNo = mclsTerminalDetails.TerminalNo;
                clsDetails.CashierID = mclsSalesTransactionDetails.CashierID;
                clsDetails.CashierName = mclsSalesTransactionDetails.CashierName;
                clsDetails.DateCreated = DateTime.Now;
                clsDetails.DenominationDetails = new Data.DenominationDetails
                {
                    DenominationID = Convert.ToInt32(dr["DenominationID"].ToString().Replace(",", "")),
                    DenominationCode = dr["DenominationCode"].ToString().Replace(",", ""),
                    DenominationValue = Convert.ToDecimal(dr["DenominationValue"].ToString().Replace(",", "")),
                    ImagePath = dr["ImagePath"].ToString().Replace(",", "")
                };
                clsDetails.DenominationCount = Convert.ToInt32(dr["DenominationCount"].ToString().Replace(",", ""));
                clsDetails.DenominationValue = Convert.ToDecimal(dr["DenominationValue"].ToString().Replace(",", ""));
                clsDetails.DenominationAmount = Convert.ToDecimal(dr["DenominationAmount"].ToString().Replace(",", ""));
                arrCashCountDetails.Add(clsDetails);
            }
            if (arrCashCountDetails != null)
            {
                CashCountDetails[] arrDetails = new CashCountDetails[arrCashCountDetails.Count];
                arrCashCountDetails.CopyTo(arrDetails);

                //Sep 3, 2014 remove saving here and move to M<ainWnd
                //Terminal clsTerminal = new Terminal(clsCashCount.Connection, clsCashCount.Transaction);
                //clsTerminal.UpdateIsCashCountInitialized(mclsTerminalDetails.BranchDetails.BranchID, mclsTerminalDetails.TerminalNo, mclsSalesTransactionDetails.CashierID, true);

                //clsCashCount.Insert(arrDetails);
                //clsCashCount.CommitAndDispose();

                marrCashCountDetails = arrDetails;
            }
            
            return true;
        }
Ejemplo n.º 8
0
        public System.Data.DataTable ListAsDataTable(CashCountDetails clsSearchKey, string SortField = "CashCountID", 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 (clsSearchKey.CashierID != 0)
                {
                    SQL += "AND CashierID = @CashierID ";
                    cmd.Parameters.AddWithValue("CashierID", clsSearchKey.CashierID);
                }
                if (!string.IsNullOrEmpty(clsSearchKey.TerminalNo))
                {
                    SQL += "AND TerminalNo = @TerminalNo ";
                    cmd.Parameters.AddWithValue("CashierID", clsSearchKey.CashierID);
                }
                if (!string.IsNullOrEmpty(clsSearchKey.CashierName))
                {
                    SQL += "AND CashierName = @CashierName ";
                    cmd.Parameters.AddWithValue("CashierID", clsSearchKey.CashierID);
                }
                if (!string.IsNullOrEmpty(clsSearchKey.DenominationDetails.DenominationCode))
                {
                    SQL += "AND DenominationCode = @DenominationCode ";
                    cmd.Parameters.AddWithValue("CashierID", clsSearchKey.CashierID);
                }

                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);
            }
		}
Ejemplo n.º 9
0
		public CashCountDetails Details(Int64 CashCountID)
		{
			try
			{
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
				
				string SQL=	SQLSelect() + "WHERE CashCountID = @CashCountID ";

                cmd.Parameters.AddWithValue("@CashCountID", CashCountID);

                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);
				
				CashCountDetails Details = new CashCountDetails();
                foreach (System.Data.DataRow dr in dt.Rows)
				{
                    Details.BranchDetails = new Branch(base.Connection, base.Transaction).Details(Int32.Parse(dr["BranchID"].ToString()));
                    Details.TerminalNo = dr["TerminalNo"].ToString();
                    Details.SyncID = Int64.Parse(dr["SyncID"].ToString());
                    Details.CashCountID = Int64.Parse(dr["CashCountID"].ToString());
					Details.CashierID = Int64.Parse(dr["CashierID"].ToString());
					Details.CashierName = dr["CashierName"].ToString();
					Details.DateCreated = DateTime.Parse(dr["DateCreated"].ToString());
                    Details.DenominationDetails = new Denominations(base.Connection, base.Transaction).Details(Int32.Parse(dr["DenominationID"].ToString()));
                    Details.DenominationValue = decimal.Parse(dr["DenominationValue"].ToString());
                    Details.DenominationCount = Int32.Parse(dr["DenominationCount"].ToString());
                    Details.DenominationAmount = Int32.Parse(dr["DenominationAmount"].ToString());
				}

				return Details;
			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Ejemplo n.º 10
0
        public Int32 Save(CashCountDetails Details)
        {
            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

                string SQL = "CALL procSaveCashCount(@BranchID, @TerminalNo, @SyncID, @CashCountID, @CashierID, @CashierName, @DateCreated, @DenominationID, @DenominationValue, @DenominationCount, @DenominationAmount, @BranchCode, @CreatedOn, @LastModified);";

                cmd.Parameters.AddWithValue("BranchID", Details.BranchDetails.BranchID);
                cmd.Parameters.AddWithValue("TerminalNo", Details.TerminalNo);
                cmd.Parameters.AddWithValue("SyncID", Details.SyncID);
                cmd.Parameters.AddWithValue("CashCountID", Details.CashCountID);
                cmd.Parameters.AddWithValue("CashierID", Details.CashierID);
                cmd.Parameters.AddWithValue("CashierName", Details.CashierName);
                cmd.Parameters.AddWithValue("DateCreated", Details.DateCreated);
                cmd.Parameters.AddWithValue("DenominationID", Details.DenominationDetails.DenominationID);
                cmd.Parameters.AddWithValue("DenominationValue", Details.DenominationDetails.DenominationValue);
                cmd.Parameters.AddWithValue("DenominationCount", Details.DenominationCount);
                cmd.Parameters.AddWithValue("DenominationAmount", Details.DenominationAmount);
                cmd.Parameters.AddWithValue("BranchCode", Details.BranchDetails.BranchCode);
                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);

                cmd.CommandText = SQL;
                return base.ExecuteNonQuery(cmd);
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }