示例#1
0
        //[Authorize(Roles = "Admin,Client,Employee")]
        public ActionResult Index(string Status, string Id, string InvoiceTo, string InvoiceNumber, bool data = false, string UserAction = "Add")
        {
            ViewBag.Result = "Failed";
            if (data == true)
            {
                ViewBag.Result = "Succeeded";
            }

            string UserId     = User.Identity.GetUserId();
            var    UserDetail = generic.GetUserDetail(User.Identity.GetUserId());

            ViewData["UserProfile"] = generic.GetUserDetail(UserId);
            ViewData["EmpDetails"]  = emsMgr.GetEmployeeBasicDetails(UserId).FirstOrDefault();
            ViewData["CompanyLogo"] = cmsMgr.GetCompanyLogo(UserDetail.SubscriberId).FirstOrDefault();
            var plandetail = admin.GetUserplanDetails(UserDetail.SubscriberId).Where(c => c.AddOnId == 3).FirstOrDefault();

            ViewData["plandetail"] = plandetail;

            ViewData["JOItems"]      = cmsMgr.GetJobOrderItems(Id).AsEnumerable();
            ViewData["ItemType"]     = (from i in db.ItemTypeMasters.Where(i => i.CorporateId == UserDetail.SubscriberId) select i).AsEnumerable();
            ViewData["InvItems"]     = cmsMgr.GetInvoiceItems(InvoiceNumber).AsEnumerable();
            ViewData["InvTaxs"]      = admin.GetInvoiceTaxes(InvoiceNumber).AsEnumerable();
            ViewData["TaxType"]      = admin.GetTaxMaster().AsEnumerable();
            ViewData["ItemDuration"] = Global.GetDuration();
            ViewBag.UserAction       = UserAction;
            if (UserAction == "Edit")
            {
                var Invoice = admin.GetInvoiceDetails(UserId, InvoiceNumber);
                ViewBag.InvoiceDate    = Invoice.InvoiceDate;
                ViewBag.Currency       = Invoice.Currency;
                ViewBag.InvoiceNumber  = InvoiceNumber;
                ViewBag.InvoiceTo      = Invoice.InvoiceTo;
                ViewBag.ReferenceId    = Invoice.ReferenceId;
                ViewBag.NetAmount      = Invoice.NetAmount;
                ViewBag.AdditionalCost = Invoice.AdditionalCost;
                ViewBag.Deductions     = Invoice.Deductions;
                ViewData["Content"]    = (from i in db.InVoiceAttachment.Where(i => i.ReferenceId == Invoice.ReferenceId) select i).FirstOrDefault();
                PopulateCurrency(Invoice.Currency);
                return(View(Invoice));
            }
            else
            {
                ViewBag.InvoiceTo      = InvoiceTo;
                ViewBag.ReferenceId    = Id;
                ViewBag.InvoiceDate    = DateTime.Now.Date;
                ViewBag.AdditionalCost = 0;
                ViewBag.Deductions     = 0;
                PopulateCurrency();
            }

            return(View());
        }
        //[Authorize(Roles = "Client")]
        public ActionResult Create(string JobOrderNumber, string result = "")
        {
            string UserId      = User.Identity.GetUserId();
            var    userDetails = generic.GetUserDetail(UserId);

            ViewData["UserProfile"] = userDetails;
            ViewData["CompanyLogo"] = cmsMgr.GetCompanyLogo(userDetails.SubscriberId).FirstOrDefault();

            ViewBag.Result = result;
            var joborder = udb.JobOrder.Find(JobOrderNumber);

            ViewData["JOItems"] = cmsMgr.GetJobOrderItems(JobOrderNumber).AsEnumerable();

            ViewData["ItemType"] = (from i in udb.ItemTypeMasters.Where(i => i.CorporateId == userDetails.SubscriberId) select i).AsEnumerable();

            ViewData["Content"] = (from i in udb.JobOrderAttachment.Where(i => i.JobOrderNumber == JobOrderNumber) select i).FirstOrDefault();

            ViewData["ItemDuration"] = Global.GetDuration();

            if (joborder != null)
            {
                PopulateOrderType(userDetails.SubscriberId, joborder.JobOrderTypeId);
                PopulateCurrency(joborder.Currency);
                PopulateSalaryRange(joborder.SalaryRange);
                PopulateExperienceRange(joborder.ExpRange);

                if (joborder.StartDate != null)
                {
                    ViewBag.startDate = joborder.StartDate.Value.ToString("dd-MM-yyyy");
                }
            }
            else
            {
                PopulateOrderType(userDetails.SubscriberId);
                PopulateCurrency();
                PopulateSalaryRange();
                PopulateExperienceRange();
            }
            return(View(joborder));
        }