Exemplo n.º 1
0
 private static void AddPaymentHierarchy(DataRow[] childRows, POSPayments payment, DataTable dt)
 {
     foreach (DataRow dr in childRows)
     {
         POSPayments subPayment  = CreatePayment(dr);
         DataRow[]   subChildren = dt.Select("ParentType = '" + subPayment.PaymentModeId + "'");
         if (subChildren.Length > 0)
         {
             AddPaymentHierarchy(subChildren, subPayment, dt);
         }
         payment.SubPayments.Add(subPayment);
     }
 }
Exemplo n.º 2
0
        public static List <POSPayments> Search(ref string dbMessage)
        {
            try
            {
                DBParameterList    dbParamList = new DBParameterList();
                List <POSPayments> paymentList = new List <POSPayments>();
                int Mode = 1;
                if (Common.IsMiniBranchLocation == 1)
                {
                    Mode = 2;
                }
                else
                {
                    Mode = 1;
                }
                //dbParamList.Add(new DBParameter("@businessLineId", Common.BusinessLine, DbType.String));
                dbParamList.Add(new DBParameter(Common.PARAM_MODE, Mode, DbType.Int32));
                dbParamList.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH));
                using (DataTaskManager dtManager = new DataTaskManager())
                {
                    DataTable dt = dtManager.ExecuteDataTable(SP_PAYMENT_TYPES_SEARCH, dbParamList);
                    if (dt != null)
                    {
                        DataRow[] firstLevelRows = dt.Select("Level = 1");

                        foreach (DataRow dr in firstLevelRows)
                        {
                            //POSTypes serviceType = new POSTypes(dr["Id"].ToString(), dr["ShortDescription"].ToString(), dr["CustomerTypeId"].ToString(), dr["ReceiptDisplay"].ToString(), dr["ParentType"].ToString(), Convert.ToUInt16(dr["Level"]), Convert.ToDecimal(dr["Price"]));
                            POSPayments payment   = CreatePayment(dr);
                            DataRow[]   childRows = dt.Select("ParentType = '" + payment.PaymentModeId + "'");
                            if (childRows.Length > 0)
                            {
                                AddPaymentHierarchy(childRows, payment, dt);
                            }
                            paymentList.Add(payment);
                        }
                    }
                }
                return(paymentList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }