public ActionResult UpdatePackage(int packageid, company company)
        {
            try
            {
                packageUtil = new PackageUtil();
                package_subscription objsubscription = new package_subscription();
                var data = db.packages.AsEnumerable().Where(x => x.package_id == packageid).First();
                objsubscription.subscription_start_date = DateTime.Now;
                objsubscription.subscription_end_date   = DateTime.Now.AddDays(Convert.ToDouble(data.duration_days.duration_days_value));
                objsubscription.subscription_price      = data.setup_cost;
                objsubscription.subscription_discount   = 0;
                objsubscription.subscription_tax        = 0;
                objsubscription.user_id           = SessionUtil.GetUserID();
                objsubscription.per_user_price    = data.per_user_price;
                objsubscription.package_id        = data.package_id;
                objsubscription.duration_days_id  = data.duration_days_id;
                objsubscription.payment_status_id = 1;
                objsubscription.company_id        = company.company_id;
                result = packageUtil.Post_Package_Subscription(objsubscription);
                switch (result.MessageType)
                {
                case MessageType.Success:
                    return(RedirectToAction("EditCompany", "CompanySetting", new { id = company.company_id, Result = result.Message, MessageType = result.MessageType }));

                default:
                    return(RedirectToAction("Index", "CompanySetting", new { Result = result.Message, MessageType = result.MessageType }));
                }
            }
            catch
            {
                return(View());
            }
            return(View());
            //return RedirectToAction("Index", "Company", new { Result = result.Message, MessageType = result.MessageType });
        }
        public ActionResult updatepaymentstatus(string remark, string paid, string can, string package_subscription_id)
        {
            packageUtil = new PackageUtil();
            int val = Convert.ToInt32(package_subscription_id);
            package_subscription packageSubscription = new package_subscription();

            packageSubscription.package_subscription_id = val;
            if (paid != null && paid != "")
            {
                packageSubscription.payment_detail    = remark;
                packageSubscription.payment_status_id = Convert.ToInt32(paid);
            }
            if (can != null && can != "")
            {
                packageSubscription.cancel_remark     = remark;
                packageSubscription.payment_status_id = Convert.ToInt32(can);
            }
            result = packageUtil.Post_Package_Subscription(packageSubscription);
            switch (result.MessageType)
            {
            case MessageType.Success:
                return(RedirectToAction("Index", "CompanySetting", new { Result = result.Message, MessageType = result.MessageType }));

            default:
                return(RedirectToAction("Index", "CompanySetting", new { Result = result.Message, MessageType = result.MessageType }));
            }
        }
Exemplo n.º 3
0
        public ActionResult UpdatePackage(int packageid, int company_id, int allow_users)
        {
            try
            {
                var     date        = DateTime.Now;
                decimal Total_Price = 0;

                var packagedatacount = db.package_subscription.AsEnumerable().Where(x => x.is_active && x.package_id == packageid && x.subscription_end_date >= date && x.company_id == CompanyId).FirstOrDefault();
                packageUtil = new PackageUtil();
                package_subscription objsubscription = new package_subscription();

                var data = db.packages.AsEnumerable().Where(x => x.package_id == packageid).First();
                objsubscription.subscription_start_date = DateTime.Now;
                objsubscription.subscription_end_date   = DateTime.Now.AddDays(Convert.ToDouble(data.duration_days.duration_days_value));
                objsubscription.allow_users             = allow_users;
                Total_Price = data.setup_cost + (data.per_user_price * allow_users);
                objsubscription.subscription_price          = Total_Price;//////////data.setup_cost; ///////////// Changed By Pravin
                objsubscription.subscription_discount       = 0;
                objsubscription.subscription_tax_display    = data.tax_display;
                objsubscription.subscription_tax_percentage = data.tax_percentage;
                objsubscription.subscription_tax            = Total_Price * ((data.tax_percentage) / 100); ///////0;
                objsubscription.user_id           = SessionUtil.GetUserID();
                objsubscription.setup_cost        = data.setup_cost;
                objsubscription.per_user_price    = data.per_user_price;
                objsubscription.package_id        = data.package_id;
                objsubscription.duration_days_id  = data.duration_days_id;
                objsubscription.payment_status_id = 1;
                objsubscription.company_id        = company_id;
                if (packagedatacount != null)
                {
                    objsubscription.package_subscription_id = packagedatacount.package_subscription_id;
                    objsubscription.payment_status_id       = packagedatacount.payment_status_id;
                }
                result = packageUtil.Post_Package_Subscription(objsubscription);
                switch (result.MessageType)
                {
                case MessageType.Success:
                    return(RedirectToAction("EditCompany", "Company", new { id = company_id, Result = result.Message, MessageType = result.MessageType }));

                default:
                    return(RedirectToAction("Index", "Company", new { Result = result.Message, MessageType = result.MessageType }));
                }
            }
            catch
            {
                return(View());
            }
            return(View());
            //return RedirectToAction("Index", "Company", new { Result = result.Message, MessageType = result.MessageType });
        }