Example #1
0
        // end of methods for mem form

        //methods for mem account

        //method to get bill
        public double getBill(int id)
        {
            double bill;
            int    monthsPaid;
            int    monthsToPay;

            try
            {
                membership m = wvac.memberships.Find(id);
                monthsPaid  = Convert.ToInt32(m.MonthsPaid);
                monthsToPay = Convert.ToInt32(m.MonthsToPay);
                if (monthsToPay - monthsPaid == 1)
                {
                    bill = Convert.ToDouble(m.Balance);
                }
                else
                {
                    bill = m.MonthlyDue;
                }
            }
            catch
            {
                bill = 0;
            }
            return(bill);
        }
Example #2
0
 public PrimaryAccountMap(bool defaultMap)
 {
     this._id = this.id;
     if (defaultMap)
     {
         this._email = "";
         this._username = "";
         this._password = "";
         functionality func = new functionality();
         this._salt = func.randomCharacterSet(20);
         this._memberLevel = membership.Unverified;
         this._adminTrust = administrativeTrust.Unknown;
         this._accountBalance = 0.00m;
         this._coinBankVal1 = "";
         this._coinBankVal2 = "";
     }
     else
     {
         this._email = this.email;
         this._username = this.username;
         this._password = this.password;
         this._salt = this.salt;
         this._memberLevel = this.memberLevel;
         this._adminTrust = this.adminTrust;
         this._accountBalance = this.accountBalance;
         this._coinBankVal1 = this.coinBankVal1;
         this._coinBankVal2 = this.coinBankVal2;
     }
 }
Example #3
0
    public string memberEnumToString(membership value)
    {
        switch (value)
        {
        case membership.Unverified:
            return("Unverified");

        case membership.Verified:
            return("Verified");

        case membership.Bronze:
            return("Bronze");

        case membership.Silver:
            return("Silver");

        case membership.Gold:
            return("Gold");

        case membership.Platinum:
            return("Platinum");

        default:
            return("NULL");
        }
    }
Example #4
0
 public PrimaryAccountMap(bool defaultMap)
 {
     this._id = this.id;
     if (defaultMap)
     {
         this._email    = "";
         this._username = "";
         this._password = "";
         functionality func = new functionality();
         this._salt           = func.randomCharacterSet(20);
         this._memberLevel    = membership.Unverified;
         this._adminTrust     = administrativeTrust.Unknown;
         this._accountBalance = 0.00m;
         this._coinBankVal1   = "";
         this._coinBankVal2   = "";
     }
     else
     {
         this._email          = this.email;
         this._username       = this.username;
         this._password       = this.password;
         this._salt           = this.salt;
         this._memberLevel    = this.memberLevel;
         this._adminTrust     = this.adminTrust;
         this._accountBalance = this.accountBalance;
         this._coinBankVal1   = this.coinBankVal1;
         this._coinBankVal2   = this.coinBankVal2;
     }
 }
Example #5
0
        //create member lumpsum
        public membership CreateMemberLump(int userId, int shares, string modeofP)
        {
            membership      member = new membership();
            MembershipModel mm     = new MembershipModel();

            member = mm.CreateMemberLump(userId, shares, modeofP);
            return(member);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            membership membership = db.memberships.Find(id);

            db.memberships.Remove(membership);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #7
0
        //method to view membership profile
        public string ViewMembership(int id)
        {
            string       selectedProfile;
            const String format = "{0,-20}{1,-5}";

            try
            {
                membership m = wvac.memberships.Find(id);

                var profile = (from c in wvac.memberships
                               where c.ID == id
                               join u in wvac.users on c.UserID equals u.UserID
                               select new
                {
                    u.firstName,
                    u.lastName,
                    c.Shares,
                    c.TotalAmount,
                    c.Balance,
                    c.BeginDate,
                    c.ModeOfPayment,
                    c.MonthsToPay,
                    c.MonthsPaid,
                    c.MonthlyDue,
                    c.SchedDate,
                    c.status
                });
                string mode = Convert.ToString(profile.First().ModeOfPayment);
                if (mode == "Installment")
                {
                    selectedProfile = string.Format(format, "Name: ", profile.First().firstName) + " " + profile.First().lastName + "\n";
                    selectedProfile = selectedProfile + string.Format(format, "Shares: ", profile.First().Shares) + "\n";
                    selectedProfile = selectedProfile + string.Format(format, "Total Amount: ", profile.First().TotalAmount) + "\n";
                    selectedProfile = selectedProfile + string.Format(format, "Balance: ", profile.First().Balance) + "\n";
                    selectedProfile = selectedProfile + string.Format(format, "Date of Contract: ", profile.First().BeginDate) + "\n";
                    selectedProfile = selectedProfile + string.Format(format, "Mode Of Payment: ", profile.First().ModeOfPayment) + "\n";
                    selectedProfile = selectedProfile + string.Format(format, "Number of Payments: ", profile.First().MonthsToPay) + "\n";
                    selectedProfile = selectedProfile + string.Format(format, "Months Paid:  ", profile.First().MonthsPaid) + "\n";
                    selectedProfile = selectedProfile + string.Format(format, "Monthly Due: ", profile.First().MonthlyDue) + "\n";
                    selectedProfile = selectedProfile + string.Format(format, "Schedule Date: ", profile.First().SchedDate) + "\n";
                    selectedProfile = selectedProfile + string.Format(format, "Status: ", profile.First().status) + "\n";
                }
                else
                {
                    selectedProfile = string.Format(format, "Name: ", profile.First().firstName) + " " + profile.First().lastName + "\n";
                    selectedProfile = selectedProfile + string.Format(format, "Shares: ", profile.First().Shares) + "\n";
                    selectedProfile = selectedProfile + string.Format(format, "Total Amount: ", profile.First().TotalAmount) + "\n";
                    selectedProfile = selectedProfile + string.Format(format, "Date of Contract: ", profile.First().BeginDate) + "\n";
                    selectedProfile = selectedProfile + string.Format(format, "Mode Of Payment: ", profile.First().ModeOfPayment) + "\n";
                    selectedProfile = selectedProfile + string.Format(format, "Status: ", profile.First().status) + "\n";
                }
            }
            catch
            {
                selectedProfile = "Profile not found.";
            }
            return(selectedProfile);
        }
Example #8
0
        //create member installment
        public membership CreateMemberIns(int uID, int shares, string mode, int months,
                                          double bal, double monthlyDue, string typeIns)
        {
            membership      member = new membership();
            MembershipModel mm     = new MembershipModel();

            member = mm.CreateMemberInstallment(uID, shares, mode, months, bal, monthlyDue, typeIns);

            return(member);
        }
Example #9
0
        // GET: membership
        public ActionResult Index()
        {
            membership membership = db.membership.Find(1);

            if (membership == null)
            {
                return(HttpNotFound());
            }
            return(View(membership));
        }
Example #10
0
 public ActionResult Edit([Bind(Include = "id,en_content,th_content")] membership membership)
 {
     if (ModelState.IsValid)
     {
         db.Entry(membership).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(membership));
 }
Example #11
0
        public ActionResult Create([Bind(Include = "id,en_content,th_content")] membership membership)
        {
            if (ModelState.IsValid)
            {
                db.membership.Add(membership);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(membership));
        }
Example #12
0
 public PrimaryAccountMap()
 {
     this._id             = this.id;
     this._email          = this.email;
     this._username       = this.username;
     this._password       = this.password;
     this._salt           = this.salt;
     this._memberLevel    = this.memberLevel;
     this._adminTrust     = this.adminTrust;
     this._accountBalance = this.accountBalance;
     this._coinBankVal1   = this.coinBankVal1;
     this._coinBankVal2   = this.coinBankVal2;
 }
Example #13
0
 public PrimaryAccountMap()
 {
     this._id = this.id;
      this._email = this.email;
      this._username = this.username;
      this._password = this.password;
      this._salt = this.salt;
      this._memberLevel = this.memberLevel;
      this._adminTrust = this.adminTrust;
      this._accountBalance = this.accountBalance;
      this._coinBankVal1 = this.coinBankVal1;
      this._coinBankVal2 = this.coinBankVal2;
 }
        // GET: memberships/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            membership membership = db.memberships.Find(id);

            if (membership == null)
            {
                return(HttpNotFound());
            }
            return(View(membership));
        }
        // GET: memberships/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            membership membership = db.memberships.Find(id);

            if (membership == null)
            {
                return(HttpNotFound());
            }
            ViewBag.storeid = new SelectList(db.stores, "storeid", "storename", membership.storeid);
            return(View(membership));
        }
 public ActionResult Edit([Bind(Include = "memberid,merchantname,emailid,mobileno,address,identifyproof,vatno,servicetaxno,dateofexpiry,status,storeid")] membership membership, HttpPostedFileBase identifyproof)
 {
     if (ModelState.IsValid)
     {
         if (identifyproof != null)
         {
             string photoname = identifyproof.FileName;
             identifyproof.SaveAs(Server.MapPath("~/uploads/" + photoname));
             membership.identifyproof = "~/uploads/" + photoname;
         }
         db.Entry(membership).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.storeid = new SelectList(db.stores, "storeid", "storename", membership.storeid);
     return(View(membership));
 }
        public ActionResult Create([Bind(Include = "memberid,merchantname,emailid,mobileno,address,vatno,servicetaxno,storeid,identifyproof")] membership membership, HttpPostedFileBase identifyproof)
        {
            if (ModelState.IsValid)
            {
                membership.status = "Active";
                int year = Convert.ToInt32(DateTime.Now.Year.ToString()) + 5;
                membership.dateofexpiry = DateTime.Today.AddYears(5).ToString();
                string photoname = identifyproof.FileName;
                identifyproof.SaveAs(Server.MapPath("~/uploads/" + photoname));
                membership.identifyproof = "~/uploads/" + photoname;
                db.memberships.Add(membership);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.storeid = new SelectList(db.stores, "storeid", "storename", membership.storeid);
            return(View(membership));
        }
Example #18
0
        //create member (either lumpsum or installment)
        public string CreateMember(string mode, int shares, double payment, int uID, int months,
                                   double bal, double monthlyDue, string typeIns)
        {
            MembershipModel mm     = new MembershipModel();
            String          output = " ";

            if (ConfirmShares(shares) == true)
            {
                if (mode.Equals("Installment") == true)
                {
                    if (ConfirmPayment(payment, shares, mode) == true)
                    {
                        membership mem = CreateMemberIns(uID, shares, mode, months, bal, monthlyDue, typeIns);
                        output = mm.InsertMembership(mem);
                    }
                    else
                    {
                        output = "You must at least pay 25% of the total amount of shares";
                    }
                }
                else
                {
                    if (ConfirmPayment(payment, shares, mode) == true)
                    {
                        membership mem = CreateMemberLump(uID, shares, mode);
                        output = mm.InsertMembership(mem);
                    }
                    else
                    {
                        output = "Insufficient amount of cash";
                    }
                }
            }
            else
            {
                output = "You must at least subscribe to 40 shares";
            }

            return(output);
        }
Example #19
0
        //method to get fine
        public double getFine(int id, DateTime payDate)
        {
            int    days;
            double fine = 0;

            membership m = wvac.memberships.Find(id);
            DateTime   s = m.SchedDate.Value;

            days = payDate.Day - s.Day;



            if (payDate.Month - s.Month > 0)
            {
                if (payDate.Month == 1 || payDate.Month == 3 || payDate.Month == 5 || payDate.Month == 7 ||
                    payDate.Month == 8 || payDate.Month == 10 || payDate.Month == 12)
                {
                    days = 31 - s.Day + payDate.Day;
                }

                else if (payDate.Month == 11 || payDate.Month == 4 || payDate.Month == 6 || payDate.Month == 9)
                {
                    days = 30 - s.Day + payDate.Day;
                }
                else
                {
                    days = 28 - s.Day + payDate.Day;
                }
            }

            if (days > 15)
            {
                fine = m.MonthlyDue * 0.02;
            }

            return(fine);
        }
Example #20
0
        public static String Membership(membership membership)
        {
            try
            {
                var membershipCSV = new StringBuilder("");
                foreach (member member in membership.member)
                {
                    membershipCSV.Append(membership.sourcedid.id + "," + member.sourcedid.id + ",");
                    if (member.idtype != null)
                        membershipCSV.Append(member.idtype);
                    else
                        membershipCSV.Append(" ");
                    membershipCSV.Append(",");
                    if (member.role[0] != null)
                    {
                        membershipCSV.Append(member.role[0].status + "," + member.role[0].roletype + ",");
                        if (member.role[0].timeframe != null)
                            membershipCSV.Append(member.role[0].timeframe.begin + "," + member.role[0].timeframe.end + "\r\n");
                        else
                            membershipCSV.Append(" , \r\n");

                    }
                    else
                        membershipCSV.Append(" , , , \r\n");
                }

                return membershipCSV.ToString();
            }
            catch (Exception e)
            {
                throw e;
            }
        }