public credit_type insert_credit_type()
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    application app = new application
                    {
                        app_id = Guid.NewGuid().ToString()
                    };
                    db.applications.InsertOnSubmit(app);
                    credit_type.App_id = app.app_id;
                    db.credit_types.InsertOnSubmit(credit_type);
                    db.SubmitChanges();

                    scope.Complete();
                }


                return(find_credit_type_By_AppId(credit_type.App_id));
            }
            catch (Exception)
            {
                return(null);
            }
        }
        public master_balance_sheet insert_master_balance_sheet()
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    application app = new application
                    {
                        app_id = Guid.NewGuid().ToString()
                    };
                    db.applications.InsertOnSubmit(app);
                    master_balance_sheet.App_id = app.app_id;
                    db.master_balance_sheets.InsertOnSubmit(master_balance_sheet);
                    db.SubmitChanges();

                    scope.Complete();
                }


                return(find_master_balance_sheet_By_AppId(master_balance_sheet.App_id));
            }
            catch (Exception)
            {
                return(null);
            }
        }
        public shop_expense insert_shop_expense()
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    application app = new application
                    {
                        app_id = Guid.NewGuid().ToString()
                    };
                    db.SubmitChanges();
                    shop_expense.app_id = app.app_id;
                    db.shop_expenses.InsertOnSubmit(shop_expense);
                    db.SubmitChanges();

                    scope.Complete();
                }


                return(find_shop_expense_By_AppId(shop_expense.app_id));
            }
            catch (Exception)
            {
                return(null);
            }
        }
        public bank_list insert_bank_list()
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    application app = new application
                    {
                        app_id = Guid.NewGuid().ToString()
                    };
                    db.applications.InsertOnSubmit(app);
                    bank_list.app_id = app.app_id;
                    db.bank_lists.InsertOnSubmit(bank_list);
                    db.SubmitChanges();

                    scope.Complete();
                }


                return(find_bank_list_By_AppId(bank_list.app_id));
            }
            catch (Exception)
            {
                return(null);
            }
        }
Exemple #5
0
        public mail insert_mail()
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    //application app = new application
                    //{
                    //    app_id = Guid.NewGuid().ToString()
                    //};
                    //db.applications.InsertOnSubmit(app);
                    // mail.app_id = app.app_id;
                    db.mails.InsertOnSubmit(mail);
                    db.SubmitChanges();

                    scope.Complete();
                }


                return(mail);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Exemple #6
0
        public shop insert_shop()
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    application app = new application
                    {
                        app_id = Guid.NewGuid().ToString()
                    };
                    db.SubmitChanges();
                    shop.app_id = app.app_id;
                    shop.master_balance_sheets.Add(new master_balance_sheet {
                        App_id = Guid.NewGuid().ToString(), credit_balance = 0, netbalance = 0, online_credit = 0, sales_balance = 0
                    });
                    db.shops.InsertOnSubmit(shop);
                    db.SubmitChanges();

                    scope.Complete();
                }


                return(find_shop_By_AppId(shop.app_id));
            }
            catch (Exception)
            {
                return(null);
            }
        }
        public login insert_login()
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    application app = new application
                    {
                        app_id = Guid.NewGuid().ToString()
                    };
                    login.password = Utilities.MD5Encript.MD5Hash(login.password);
                    db.applications.InsertOnSubmit(app);
                    login.App_id = app.app_id;
                    db.logins.InsertOnSubmit(login);
                    db.SubmitChanges();

                    scope.Complete();
                }


                return(find_login_By_AppId(login.App_id));
            }
            catch (Exception)
            {
                return(null);
            }
        }
Exemple #8
0
        public master_sb_sale alter_master_sb_sale()
        {
            try
            {
                master_sb_sale prev_master_sb_sale = db.master_sb_sales.SingleOrDefault(a => a.id == master_sb_sale.id);

                prev_master_sb_sale.balance     = master_sb_sale.balance;
                prev_master_sb_sale.cancelled   = master_sb_sale.cancelled;
                prev_master_sb_sale.commision   = master_sb_sale.commision;
                prev_master_sb_sale.date        = master_sb_sale.date;
                prev_master_sb_sale.date_posted = master_sb_sale.date_posted;
                prev_master_sb_sale.islocked    = master_sb_sale.islocked;
                prev_master_sb_sale.isverified  = master_sb_sale.isverified;
                prev_master_sb_sale.net_balance = master_sb_sale.net_balance;
                prev_master_sb_sale.posted_by   = master_sb_sale.posted_by;
                prev_master_sb_sale.sales       = master_sb_sale.sales;
                prev_master_sb_sale.shop        = master_sb_sale.shop;
                prev_master_sb_sale.stake       = master_sb_sale.stake;
                prev_master_sb_sale.winnings    = master_sb_sale.winnings;
                db.SubmitChanges();
                return(master_sb_sale);
            }
            catch (Exception)
            {
                return(null);
            }
        }
        public login_log insert_login_log()
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    application app = new application
                    {
                        app_id = Guid.NewGuid().ToString()
                    };
                    db.applications.InsertOnSubmit(app);
                    login_log.App_id = app.app_id;
                    db.login_logs.InsertOnSubmit(login_log);
                    db.SubmitChanges();

                    scope.Complete();
                }


                return(find_login_log_By_AppId(login_log.App_id));
            }
            catch (Exception)
            {
                return(null);
            }
        }
        public admin_user insert_admin_user()
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    application app = new application
                    {
                        app_id = Guid.NewGuid().ToString()
                    };
                    db.applications.InsertOnSubmit(app);

                    admin_user.app_id = app.app_id;

                    if (admin_user.login1 != null)
                    {
                        admin_user.login1.password = Utilities.MD5Encript.MD5Hash(admin_user.login1.password);
                    }
                    db.admin_users.InsertOnSubmit(admin_user);
                    db.SubmitChanges();

                    scope.Complete();
                }


                return(find_admin_user_By_AppId(admin_user.app_id));
            }
            catch (Exception)
            {
                return(null);
            }
        }
Exemple #11
0
 public transaction_type insert_transaction_type()
 {
     try
     {
         db.transaction_types.InsertOnSubmit(transaction_type);
         db.SubmitChanges();
         return(find_transaction_type_By_AppId(transaction_type.App_id));
     }
     catch (Exception)
     {
         return(null);
     }
 }
 public shop_credit insert_shop_credit()
 {
     try
     {
         db.shop_credits.InsertOnSubmit(shop_credit);
         db.SubmitChanges();
         return(find_shop_credit_By_AppId(shop_credit.app_id));
     }
     catch (Exception)
     {
         return(null);
     }
 }
Exemple #13
0
 public master_expense insert_master_expense()
 {
     try
     {
         db.master_expenses.InsertOnSubmit(master_expense);
         db.SubmitChanges();
         return(find_master_expense_By_AppId(master_expense.app_id));
     }
     catch (Exception)
     {
         return(null);
     }
 }
 public shop_balance_sheet insert_shop_balance_sheet()
 {
     try
     {
         db.shop_balance_sheets.InsertOnSubmit(shop_balance_sheet);
         db.SubmitChanges();
         return(find_shop_balance_sheet_By_AppId(shop_balance_sheet.App_id));
     }
     catch (Exception)
     {
         return(null);
     }
 }
 public master_credit insert_master_credit()
 {
     try
     {
         db.master_credits.InsertOnSubmit(master_credit);
         db.SubmitChanges();
         return(find_master_credit_By_AppId(master_credit.app_id));
     }
     catch (Exception)
     {
         return(null);
     }
 }
 public commission_transaction insert_commission_transaction()
 {
     try
     {
         db.commission_transactions.InsertOnSubmit(commission_transaction);
         db.SubmitChanges();
         return(find_commission_transaction_By_AppId(commission_transaction.app_id));
     }
     catch (Exception)
     {
         return(null);
     }
 }
 public transaction_category insert_transaction_category()
 {
     try
     {
         db.transaction_categories.InsertOnSubmit(transaction_category);
         db.SubmitChanges();
         return(find_transaction_category_By_AppId(transaction_category.app_id));
     }
     catch (Exception)
     {
         return(null);
     }
 }
 public master_transaction insert_master_transaction()
 {
     try
     {
         db.master_transactions.InsertOnSubmit(master_transaction);
         db.SubmitChanges();
         return(find_master_transaction_By_AppId(master_transaction.app_id));
     }
     catch (Exception)
     {
         return(null);
     }
 }
 public master_lodgement_reimbursment insert_master_lodgement_reimbursment()
 {
     try
     {
         db.master_lodgement_reimbursments.InsertOnSubmit(master_lodgement_reimbursment);
         db.SubmitChanges();
         return(find_master_lodgement_reimbursment_By_AppId(master_lodgement_reimbursment.app_id));
     }
     catch (Exception)
     {
         return(null);
     }
 }
 public state_local_govt insert_state_local_govt()
 {
     try
     {
         db.state_local_govts.InsertOnSubmit(state_local_govt);
         db.SubmitChanges();
         return(state_local_govt);
     }
     catch (Exception)
     {
         return(null);
     }
 }
 public debt_transaction insert_debt_transaction()
 {
     try
     {
         db.debt_transactions.InsertOnSubmit(debt_transaction);
         db.SubmitChanges();
         return(find_debt_transaction_By_AppId(debt_transaction.app_id));
     }
     catch (Exception)
     {
         return(null);
     }
 }
Exemple #22
0
 public shop_type insert_shop_type()
 {
     try
     {
         db.shop_types.InsertOnSubmit(shop_type);
         db.SubmitChanges();
         return(find_shop_type_By_AppId(shop_type.app_id));
     }
     catch (Exception)
     {
         return(null);
     }
 }
 public application insert_application()
 {
     try
     {
         application.app_id = Guid.NewGuid().ToString();
         db.applications.InsertOnSubmit(application);
         db.SubmitChanges();
         return(find_application_By_AppId(application.app_id));
     }
     catch (Exception)
     {
         return(null);
     }
 }
Exemple #24
0
        private void SaveTransactions()
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    db.master_transactions.InsertAllOnSubmit(transactionsToSave);
                    db.debt_transactions.InsertAllOnSubmit(debtTransactionToSave);
                    foreach (master_balance_sheet bal in ShopBalancesToUpdate)
                    {
                        master_balance_sheet prevbal = db.master_balance_sheets.SingleOrDefault(a => a.id == bal.id);
                        prevbal.credit_balance = bal.credit_balance;
                        prevbal.sales_balance  = bal.sales_balance;
                        prevbal.netbalance     = bal.netbalance;
                    }

                    foreach (debt debt in shopDebtsToUpdate)
                    {
                        debt prevdebt = db.debts.SingleOrDefault(a => a.id == debt.id);
                        prevdebt.current_amount = debt.current_amount;
                        prevdebt.status         = debt.status;
                    }

                    db.SubmitChanges();
                    scope.Complete();
                }
            }
            catch (Exception)
            {
            }
        }
Exemple #25
0
        public void loadStream(string x)
        {
            //if (Request.ContentType == "text/xml" || Request.ContentType == "text/plain" || Request.ContentType == "text/html"|| Request.ContentType == "application/xml")
            //{

            XDocument doc      = null;;
            XDocument xmlInput = XDocument.Parse(x);
            IEnumerable <XElement> requests = xmlInput.Elements();
            //initialize to objects and process then return request;
            string root = xmlInput.Root.Name.ToString();

            if (root.Contains("Customer"))
            {
                doc = generateCustomerValidationRequests(doc, requests);
            }
            else if (root.Contains("PaymentNotificationRequest"))
            {
                payment_request req = new payment_request {
                    request = x, date = DateTime.Now
                };
                BettingSuiteDataContext db = new BettingSuiteDataContext();
                db.payment_requests.InsertOnSubmit(req);
                db.SubmitChanges();

                var paymentrequests = xmlInput.Descendants("Payment").ToList();
                doc = generatePaymentNotificationRequests(doc, paymentrequests);
            }

            sendResponse(doc);
            // }

            //}
        }
Exemple #26
0
        private bool savePaymentDetails(PaymentNotificationRequestHelper pnr)
        {
            BettingSuiteDataContext db = new BettingSuiteDataContext();

            if (iSNotDuplicate(pnr.getPaymentLogId(), db))
            {
                try
                {
                    using (TransactionScope scope = new TransactionScope())
                    {
                        PaymentNotificationRequest pr = setPaymentRequestObjAndSave(pnr, db);
                        shop shop = new CRUD.shop_crud().find_shop_By_ID(pr.CustReference);
                        foreach (PaymentItemHelper it in pnr.getPaymentItems())
                        {
                            if (it.getItemCode().Equals(ConfigurationManager.AppSettings["SalesCode"].ToString()))
                            {
                                AddSalesTransaction(shop, pr, db);
                            }
                            else if (it.getItemCode().Equals(ConfigurationManager.AppSettings["LEASE DEBT"].ToString()))
                            {
                                //do lease debt lodgement
                            }
                            else if (it.getItemCode().Equals(ConfigurationManager.AppSettings["OPERATIONAL DEBT"].ToString()))
                            {
                                //do operational debt lodgement
                            }
                            else if (it.getItemCode().Equals(ConfigurationManager.AppSettings["ONLINE AGENCY"].ToString()))
                            {
                                //send online dept updates on online agency
                            }
                            else if (it.getItemCode().Equals(ConfigurationManager.AppSettings["ONLINE USER"].ToString()))
                            {
                                //send online dept updates on online user
                            }
                            else if (it.getItemCode().Equals(ConfigurationManager.AppSettings["PAYMENT COMMISION"].ToString()))
                            {
                                //futute implementation
                            }
                            else
                            {
                                //send acknologement message of payments
                            }
                        }

                        db.SubmitChanges();
                        scope.Complete();

                        return(true);
                    }
                }
                catch (Exception)
                {
                    return(false);
                }
            }
            else
            {
            }
            return(false);
        }
 public void saveList()
 {
     db.SubmitChanges();
     //foreach (master_transaction user in list_)
     //{
     //    new CRUD.master_transactions_crud(user).alter_master_transaction();
     //}
 }
 public void saveList()
 {
     db.SubmitChanges();
     //foreach (admin_user user in list_)
     //{
     //    new CRUD.admin_users_crud(user).alter_admin_user();
     //}
 }
 public bool rechargeVendor(string name, int newcredits)
 {
     try{
         sms_vendor vendor = getVendorsByName(name);
         vendor.remaining_credits += newcredits;
         db.SubmitChanges();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Exemple #30
0
        public bool ReactivateMail(string validationcode, int days, int val)
        {
            mail_validity mailvalidity = db.mail_validities.First();

            if (mailvalidity.validatycode == validationcode && val == 1)
            {
                mailvalidity.expirydate = mailvalidity.expirydate.Value.AddDays(days);
                db.SubmitChanges();
                return(true);
            }
            else if (mailvalidity.validatycode == validationcode && val == 2)
            {
                //sms_vendor smsv;
                db.sms_vendors.SingleOrDefault(a => a.vendor_name == "50kobo").expiry_date.AddDays(days);
                //smsv.expiry_date = smsv.expiry_date.AddDays(days);
                db.SubmitChanges();
                return(true);
            }
            else
            {
                return(false);
            }
        }