Ejemplo n.º 1
0
        public async Task <ActionResult> Create([Bind(Include = "Id,Title,From,To,MatterNumber,StaffId,Locations,Priority,MeetingType,CreatedBy,CreatedOn,ModifiedBy,ModifiedOn")] Calendar calendar)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var user = User.Identity.Name;
                    calendar.CreatedBy = user;
                    calendar.CreatedOn = DateTime.Today;

                    db.Calendars.Add(calendar);
                    await db.SaveChangesAsync();

                    return(RedirectToAction("Index", "Dashboards"));
                }
                catch (Exception)
                {
                    ViewBag.Error = "Can't Add Calendar, Error Occured. Please Contact IT Department.";
                }
            }
            else
            {
                ViewBag.Error  = "Fill in the required fields to continue";
                ViewBag.Matter = new SelectList(db.GetAllMattersForDropDown(), "Id", "Subject");
                ViewBag.Staff  = new SelectList(db.GetAllStaffForDropDown(), "StaffId", "StaffName");
                return(View(calendar));
            }
            ViewBag.Matter = new SelectList(db.GetAllMattersForDropDown(), "Id", "Subject");
            ViewBag.Staff  = new SelectList(db.GetAllStaffForDropDown(), "StaffId", "StaffName");
            return(View(calendar));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> Create([Bind(Include = "LineManagerId,Name,Department,Designation,CreatedBy,CreatedOn,ModifiedBy,ModifiedOn")] LineManager lineManager)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var user = User.Identity;
                    lineManager.CreatedBy = user.Name;
                    lineManager.CreatedOn = DateTime.Today;

                    db.LineManagers.Add(lineManager);
                    await db.SaveChangesAsync();

                    return(RedirectToAction("Index"));
                }
                else
                {
                    ViewBag.Error = "Can't add Document. Fill in the required Fields. ";
                    return(View(lineManager));
                }
            }
            catch (Exception ex)
            {
                ViewBag.Error = "Can't add Line Manager. Fill in the required Fields. " + ex.Message;
            }

            return(View(lineManager));
        }
Ejemplo n.º 3
0
        public async Task <ActionResult> Create([Bind(Include = "Id,FirstName,LastName,PolicyNumber,EffectiveDate,EndDate,Gender,Relationship,DateOfBirth,Description,Address,StaffId,CreatedBy,CreatedOn,ModifiedBy,ModifiedOn")] Dependant dependant)
        {
            if (ModelState.IsValid)
            {
                var user = User.Identity.Name;
                dependant.CreatedBy = user;
                dependant.CreatedOn = DateTime.Today;
                dependant.StaffId   = LegalGuideUtility.StaffId;
                db.Dependants.Add(dependant);
                await db.SaveChangesAsync();

                return(RedirectToAction("Create", "Dependants"));
            }
            var gender = new List <SelectListItem> {
                new SelectListItem {
                    Text = "Male", Value = "M"
                },
                new SelectListItem {
                    Text = "Female", Value = "F"
                }
            };

            ViewBag.Gender = gender;
            //ViewBag.StaffId = new SelectList(db.Staffs, "StaffId", "FirstName", dependant.StaffId);
            return(View(dependant));
        }
Ejemplo n.º 4
0
        public async Task <ActionResult> Create([Bind(Include = "Id,TaskType,Description,MatterNumber,NotifyDays,CreatedBy,CreatedOn,ModifiedBy,ModifiedOn,Priority,Reporter,Assignee,DueDate")] LMSTask lMSTask)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var user = User.Identity.Name;
                    lMSTask.CreatedBy = user;
                    lMSTask.CreatedOn = DateTime.Today;

                    db.LMSTasks.Add(lMSTask);
                    await db.SaveChangesAsync();

                    return(RedirectToAction("Index"));
                }
                catch (Exception)
                {
                    ViewBag.Error = "Can't Add Task, Error Occured. Please Contact IT Department.";
                }
            }
            else
            {
                ViewBag.Error    = "Fill in the required fields to continue";
                ViewBag.Matter   = new SelectList(db.GetAllMattersForDropDown(), "Id", "Subject");
                ViewBag.Staff    = new SelectList(db.GetAllStaffForDropDown(), "StaffId", "StaffName");
                ViewBag.Priority = new List <SelectListItem> {
                    new SelectListItem {
                        Value = "Critical", Text = "Critical"
                    },
                    new SelectListItem {
                        Value = "High", Text = "High"
                    },
                    new SelectListItem {
                        Value = "Medium", Text = "Medium"
                    },
                    new SelectListItem {
                        Value = "Low", Text = "Low"
                    }
                };
                return(View(lMSTask));
            }
            ViewBag.Matter   = new SelectList(db.GetAllMattersForDropDown(), "Id", "Subject");
            ViewBag.Staff    = new SelectList(db.GetAllStaffForDropDown(), "StaffId", "StaffName");
            ViewBag.Priority = new List <SelectListItem> {
                new SelectListItem {
                    Value = "Critical", Text = "Critical"
                },
                new SelectListItem {
                    Value = "High", Text = "High"
                },
                new SelectListItem {
                    Value = "Medium", Text = "Medium"
                },
                new SelectListItem {
                    Value = "Low", Text = "Low"
                }
            };
            return(View(lMSTask));
        }
Ejemplo n.º 5
0
        public async Task <ActionResult> Create([Bind(Include = "Id,GroupName,Description,CreatedBy,CreatedOn,ModifiedBy,ModifiedOn")] AdvocateGroup advocateGroup)
        {
            if (ModelState.IsValid)
            {
                db.AdvocateGroups.Add(advocateGroup);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(advocateGroup));
        }
Ejemplo n.º 6
0
        public async Task<ActionResult> Create([Bind(Include = "ClientId,FirstName,MiddleName,LastName,EmailAddress,PhoneNumber,Address,Town,PostalCode,Website,CreatedBy,CreatedOn,ModifiedBy,ModifiedOn")] Client client)
        {
            if (ModelState.IsValid)
            {
                var user = User.Identity;
                client.CreatedBy = user.Name;
                client.CreatedOn = DateTime.Today.Date;
                db.Clients.Add(client);
                await db.SaveChangesAsync();
                return RedirectToAction("Index");
            }

            return View(client);
        }
Ejemplo n.º 7
0
        public async Task <ActionResult> Create([Bind(Include = "StaffId,Surname,OtherNames,Gender,CreatedBy,CreatedOn,ModifiedBy,ModifiedOn,Type,DOB,DOE,Status,Address,PostalCode,Town,OfficeNo,MobileNo,EmailAddress,NextOfKin,Relationship,KTelephone,NHISNumber,KRA,Bank,Branch,AccountNumber,SecretCode,Password")] Staff staff)
        {
            if (ModelState.IsValid)
            {
                var user = User.Identity;
                staff.CreatedBy = user.Name;
                staff.CreatedOn = DateTime.Today.Date;
                db.Staffs.Add(staff);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(staff));
        }
        public async Task <ActionResult> Create([Bind(Include = "Id,ClientName,SoftwareVersion,ApprovedKey,ValidityFrom,ValidityTo,ApprovedDocument,ApprovedBy,CreatedBy,CreatedOn,ModifiedBy,ModifiedOn")] LicenseTable licenseTable, HttpPostedFileBase file)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    string fileName = string.Empty;
                    string filePath = string.Empty;

                    if (file.ContentLength > 0 && file != null)
                    {
                        filePath = file.FileName;
                        fileName = Path.GetFileName(file.FileName);
                    }
                    else
                    {
                        ViewBag.Error = " please select approved document to continue.";
                        return(View(licenseTable));
                    }
                    var folderPath   = AppDomain.CurrentDomain.BaseDirectory + "/App_Data/LicenseDocs";
                    var fullFilePath = Path.Combine(folderPath, filePath);
                    file.SaveAs(fullFilePath);

                    licenseTable.ApprovedDocument = fileName;
                    licenseTable.IsExpired        = false;
                    licenseTable.IsLicensed       = true;
                    licenseTable.ApprovedKey      = LegalGuideUtility.Encrypt(licenseTable.ApprovedKey);
                    licenseTable.SoftwareVersion  = licenseTable.SoftwareVersion.ToString();
                    licenseTable.CreatedBy        = User.Identity.Name;
                    licenseTable.CreatedOn        = DateTime.Today;
                    db.LicenseTables.Add(licenseTable);
                    await db.SaveChangesAsync();

                    return(RedirectToAction("Index"));
                }
                catch (Exception ex)
                {
                    ViewBag.Error = "Can't Save License info please check and try again." + ex.Message;
                }
            }
            else
            {
                ViewBag.Error = "Can't Save License info, Some fields are missing";
                return(View(licenseTable));
            }

            return(View(licenseTable));
        }
Ejemplo n.º 9
0
        public async Task <ActionResult> Create([Bind(Include = "Id,Employer,Designation,StartDate,EndDate,Description,Salary,StaffId,CreatedOn,CreatedBy,ModifiedBy,ModifiedOn")] Experience experience)
        {
            if (ModelState.IsValid)
            {
                var user = User.Identity.Name;
                experience.CreatedBy = user;
                experience.CreatedOn = DateTime.Today;
                experience.StaffId   = LegalGuideUtility.StaffId;

                db.Experiences.Add(experience);
                await db.SaveChangesAsync();

                return(RedirectToAction("Create", "Educations"));
            }

            //ViewBag.StaffId = new SelectList(db.Staffs, "StaffId", "FirstName", experience.StaffId);
            return(View(experience));
        }
Ejemplo n.º 10
0
        public async Task <ActionResult> Create([Bind(Include = "DocumentId,MatterNumber,DocName,AssignedDate,Tags,Description,CreatedBy,DateCreated,ModifiedBy,DateModified,DocPath")] Document document, HttpPostedFileBase fileBase)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    string fileName = string.Empty;
                    string filePath = string.Empty;

                    if (fileBase.ContentLength > 0 && fileBase != null)
                    {
                        filePath = fileBase.FileName;
                        fileName = Path.GetFileName(fileBase.FileName);
                    }
                    var folderPath = AppDomain.CurrentDomain.BaseDirectory + "/App_Data/Docs";
                    var docPath    = Path.Combine(folderPath, filePath);

                    var user = User.Identity;
                    document.CreatedBy   = user.Name;
                    document.DateCreated = DateTime.Today;
                    document.DocPath     = fileName;


                    db.Documents.Add(document);
                    await db.SaveChangesAsync();

                    return(RedirectToAction("Index"));
                }
                else
                {
                    ViewBag.Error = "Can't add Document. Fill in the required Fields. ";
                    //ViewBag.FileNumber = new SelectList(db.Files, "FileNumber", "FileName", document.FileNumber);
                    //ViewBag.MatterNumber = new SelectList(db.Matters, "MatterNumber", "Subject");
                    return(View(document));
                }
            }
            catch (Exception ex)
            {
                ViewBag.Error = "Can't add Document. Something went wrong " + ex.Message;
            }


            return(View(document));
        }
Ejemplo n.º 11
0
        public async Task <ActionResult> Create([Bind(Include = "Id,FileNumber,StaffId,StartDate,EndDate,Location,EventName,Address,Description,Completed,CreatedBy,CreatedOn,ModifiedBy,ModifiedOn")] FileEvent fileEvent)
        {
            if (ModelState.IsValid)
            {
                var user = User.Identity.Name;
                fileEvent.CreatedBy = user;
                fileEvent.CreatedOn = DateTime.Today;


                db.FileEvents.Add(fileEvent);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            //ViewBag.FileNumber = new SelectList(db.Files, "FileNumber", "FileName", fileEvent.FileNumber);
            ViewBag.StaffId = new SelectList(db.Staffs, "StaffId", "FirstName", fileEvent.StaffId);
            return(View(fileEvent));
        }
Ejemplo n.º 12
0
        public async Task <ActionResult> Create([Bind(Include = "ClientId,FirstName,MiddleName,LastName,EmailAddress,PhoneNumber,Address,Town,PostalCode,Website,CreatedBy,CreatedOn,ModifiedBy,ModifiedOn,ClientNumber")] Client client)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    if (!IsClientRegistered(client.FirstName, client.LastName, client.EmailAddress))
                    {
                        int    nextId      = GetCurrentId() + 1;
                        string clienName   = client.FirstName;
                        string firstLetter = clienName.Substring(0, 1);
                        string clientId    = firstLetter + nextId.ToString() + "-" + DateTime.Today.ToShortDateString();
                        var    user        = User.Identity;
                        client.CreatedBy    = user.Name;
                        client.CreatedOn    = DateTime.Today;
                        client.ClientNumber = clientId;

                        db.Clients.Add(client);
                        await db.SaveChangesAsync();

                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        ViewBag.Error = "Client Already Exist.";
                        return(View(client));
                    }
                }
                catch (Exception ex)
                {
                    ViewBag.Error = "Error occured while registering this client. Check and try again. " + ex;
                    return(View(client));
                    //throw ex;
                }
                //db.Clients.Add(client);
                // db.SaveChangesAsync();
                //return RedirectToAction("Index");
            }

            return(View(client));
        }
Ejemplo n.º 13
0
        public async Task <ActionResult> Create([Bind(Include = "Id,MatterNumber,DateHeared,CourtName,Location,StaffId,Status,AdvocateArgument,OpponentArgument,AdvocateNote,CreatedBy,CreatedOn,ModifiedBy,ModifiedOn,DateAdjourned,DefenseCounselName")] CourtActivity courtActivity)
        {
            if (ModelState.IsValid)
            {
                var user = User.Identity.Name;
                courtActivity.CreatedBy = user;
                courtActivity.CreatedOn = DateTime.Today;

                var email   = LegalGuideUtility.GetStaffEmailByLoginName(user);
                var staffId = LegalGuideUtility.GetStaffIdByEmail(email);

                //courtActivity.MatterNumber = ViewBag.MatterNumber;
                courtActivity.StaffId = staffId;

                db.CourtActivities.Add(courtActivity);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.Status = new List <SelectListItem> {
                new SelectListItem {
                    Value = "Adjourned", Text = "Adjourned"
                },
                new SelectListItem {
                    Value = "Dismissed", Text = "Dismissed"
                },
                new SelectListItem {
                    Value = "Judgement Delivered", Text = "Judgement Delivered"
                },
                new SelectListItem {
                    Value = "Strike Out", Text = "Strike Out"
                }
            };


            return(View(courtActivity));
        }
        public async Task <ActionResult> Create([Bind(Include = "Id,Name,Description,CertificationType,DateAchieved,Skilled,StaffId,CreatedBy,CreatedOn,ModeifiedBy,ModifiedOn")] Certification certification)
        {
            if (ModelState.IsValid)
            {
                var user = User.Identity.Name;
                certification.CreatedBy = user;
                certification.CreatedOn = DateTime.Today;
                certification.StaffId   = LegalGuideUtility.StaffId; //(string)ViewBag.StaffId;

                db.Certifications.Add(certification);
                await db.SaveChangesAsync();

                return(RedirectToAction("Create", "Dependants"));
            }

            //ViewBag.StaffId = new SelectList(db.Staffs, "StaffId", "FirstName", certification.StaffId);
            ViewBag.Skilled = new List <SelectListItem>
            {
                new SelectListItem {
                    Text = "Advanced", Value = "Advanced"
                },
                new SelectListItem {
                    Text = "Beginner", Value = "Beginner"
                },
                new SelectListItem {
                    Text = "Intermediate", Value = "Intermediate"
                },
                new SelectListItem {
                    Text = "Novice", Value = "Novice"
                },
                new SelectListItem {
                    Text = "Expert", Value = "Expert"
                }
            };
            return(View(certification));
        }
        public async Task <ActionResult> Create([Bind(Include = "Id,School,DateStart,EndDate,Major,DateAwarded,Graduated,Qualification,Description,Grade,StaffId,CreatedBy,CreatedOn,ModifiedBy,ModifiedOn")] Education education)
        {
            if (ModelState.IsValid)
            {
                var user = User.Identity.Name;
                education.CreatedBy = user;
                education.CreatedOn = DateTime.Today;
                education.StaffId   = LegalGuideUtility.StaffId;

                db.Educations.Add(education);
                await db.SaveChangesAsync();

                return(RedirectToAction("Create", "Certifications"));
            }
            ViewBag.Qualification = new List <SelectListItem>
            {
                new SelectListItem {
                    Text = "PhD", Value = "PhD"
                },
                new SelectListItem {
                    Text = "Msc", Value = "Msc"
                },
                new SelectListItem {
                    Text = "Bsc", Value = "Bsc"
                },
                new SelectListItem {
                    Text = "PGD", Value = "PGD"
                },
                new SelectListItem {
                    Text = "NCE", Value = "NCE"
                },
                new SelectListItem {
                    Text = "ND", Value = "ND"
                },
                new SelectListItem {
                    Text = "HND", Value = "HND"
                }
            };
            ViewBag.Grade = new List <SelectListItem>
            {
                new SelectListItem {
                    Text = "First Class", Value = "First Class"
                },
                new SelectListItem {
                    Text = "Second Class Upper", Value = "Second Class Upper"
                },
                new SelectListItem {
                    Text = "Second Class Lower", Value = "Second Class Lower"
                },
                new SelectListItem {
                    Text = "Third Class", Value = "Third Class"
                },
                new SelectListItem {
                    Text = "Pass", Value = "Pass"
                },
                new SelectListItem {
                    Text = "Not Available", Value = "Not Available"
                }
            };

            //ViewBag.StaffId = new SelectList(db.Staffs, "StaffId", "FirstName", education.StaffId);
            return(View(education));
        }
Ejemplo n.º 16
0
        public async Task <ActionResult> Create([Bind(Include = "Id,FirstName,MiddleName,Gender,CreatedBy,CreatedOn,ModifiedBy,ModifiedOn,LastName,DOB,DOE,Status,Address,MaritalStatus,ImagePath,OfficeNo,MobileNo,EmailAddress,PersonalEmail,Relationship,KTelephone,NKEmail,NKAddress,Bank,AccountNumber,NKFullName,Password,StaffId,LineManagerId,Department,Designation,YearCallToBar,Location,AdvocateGroupId,NationalIdentityNumber,BloodGroup")] Staff staff, HttpPostedFileBase file)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    //StaffImages

                    string fileName = string.Empty;
                    string filePath = string.Empty;

                    if (file.ContentLength > 0 && file != null)
                    {
                        filePath = file.FileName;
                        fileName = Path.GetFileName(file.FileName);
                    }
                    else
                    {
                        ViewBag.Error = " please select image to continue.";
                        return(View(staff));
                    }
                    var folderPath   = AppDomain.CurrentDomain.BaseDirectory + "/App_Data/StaffImages";
                    var fullFilePath = Path.Combine(folderPath, filePath);

                    var staffId = string.Empty;
                    var user    = User.Identity.Name;
                    staff.CreatedBy           = user;
                    staff.CreatedOn           = DateTime.Today;
                    staffId                   = staff.StaffId.ToUpper();
                    LegalGuideUtility.StaffId = staffId;

                    staff.ImagePath       = fileName;
                    staff.Status          = true;
                    staff.AdvocateGroupId = 0;

                    db.Staffs.Add(staff);
                    await db.SaveChangesAsync();

                    return(RedirectToAction("Create", "Experiences"));
                }
                catch (Exception ex)
                {
                    ViewBag.Error = "Can't Save Profile please check and try again." + ex.Message;
                }
            }
            else
            {
                ViewBag.Error  = "Can't Save Profile, Some fields are missing";
                ViewBag.Gender = new List <SelectListItem> {
                    new SelectListItem {
                        Text = "Male", Value = "M"
                    },
                    new SelectListItem {
                        Text = "Female", Value = "F"
                    }
                };
                ViewBag.Marital = new List <SelectListItem> {
                    new SelectListItem {
                        Text = "Divorced", Value = "Divorced"
                    },
                    new SelectListItem {
                        Text = "Married", Value = "Married"
                    },
                    new SelectListItem {
                        Text = "Single", Value = "Single"
                    },
                    new SelectListItem {
                        Text = "Separated", Value = "Separated"
                    },
                    new SelectListItem {
                        Text = "Maried With Children", Value = "Maried With Children"
                    },
                    new SelectListItem {
                        Text = "Single With Children", Value = "Single With Children"
                    }
                };
                ViewBag.BloodGroup = new List <SelectListItem> {
                    new SelectListItem {
                        Text = "A", Value = "A"
                    },
                    new SelectListItem {
                        Text = "A-", Value = "A-"
                    },
                    new SelectListItem {
                        Text = "B", Value = "B"
                    },
                    new SelectListItem {
                        Text = "B-", Value = "B-"
                    },
                    new SelectListItem {
                        Text = "AB", Value = "AB"
                    },
                    new SelectListItem {
                        Text = "AB-", Value = "AB-"
                    },
                    new SelectListItem {
                        Text = "O", Value = "O"
                    },
                    new SelectListItem {
                        Text = "O-", Value = "O-"
                    },
                };
                return(View(staff));
            }
            ViewBag.Gender = new List <SelectListItem> {
                new SelectListItem {
                    Text = "Male", Value = "M"
                },
                new SelectListItem {
                    Text = "Female", Value = "F"
                }
            };
            ViewBag.Marital = new List <SelectListItem> {
                new SelectListItem {
                    Text = "Divorced", Value = "Divorced"
                },
                new SelectListItem {
                    Text = "Married", Value = "Married"
                },
                new SelectListItem {
                    Text = "Single", Value = "Single"
                },
                new SelectListItem {
                    Text = "Separated", Value = "Separated"
                },
                new SelectListItem {
                    Text = "Maried With Children", Value = "Maried With Children"
                },
                new SelectListItem {
                    Text = "Single With Children", Value = "Single With Children"
                }
            };
            ViewBag.BloodGroup = new List <SelectListItem> {
                new SelectListItem {
                    Text = "A", Value = "A"
                },
                new SelectListItem {
                    Text = "A-", Value = "A-"
                },
                new SelectListItem {
                    Text = "B", Value = "B"
                },
                new SelectListItem {
                    Text = "B-", Value = "B-"
                },
                new SelectListItem {
                    Text = "AB", Value = "AB"
                },
                new SelectListItem {
                    Text = "AB-", Value = "AB-"
                },
                new SelectListItem {
                    Text = "O", Value = "O"
                },
                new SelectListItem {
                    Text = "O-", Value = "O-"
                },
            };
            return(View(staff));
        }
        public async Task <ActionResult> Create([Bind(Include = "Subject,Description,AreaOfPractice,ClientId,LineManagerId,ArrivalDate,FiledOn,DueDate,MatterNumber,Priority,MatterStage,RequestedBy,MatterValue,EstimatedEffort,CreatedBy,CreatedOn,ModifiedBy,ModifiedOn,CaseNumber")] Matter matter)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var nextId = GetCurrentId() + 1;

                    var matterId = "CASE-" + nextId + "-" + DateTime.Today.ToShortDateString();

                    var user = User.Identity.Name;
                    matter.CreatedBy           = user;
                    matter.CreatedOn           = DateTime.Today;
                    matter.CaseNumber          = matterId; //"01_05-03-2019";
                    LegalGuideUtility.MatterId = matter.MatterNumber;
                    //matter.ass

                    db.Matters.Add(matter);
                    await db.SaveChangesAsync();

                    return(RedirectToAction("Index"));
                }
                catch (Exception)
                {
                    ViewBag.Error = "Can't Add Matter, Error Occured. Please Contact IT Department.";
                }
            }
            else
            {
                ViewBag.Error    = "Fill in the required fields to continue";
                ViewBag.Priority = new List <SelectListItem> {
                    new SelectListItem {
                        Value = "Critical", Text = "Critical"
                    },
                    new SelectListItem {
                        Value = "High", Text = "High"
                    },
                    new SelectListItem {
                        Value = "Medium", Text = "Medium"
                    },
                    new SelectListItem {
                        Value = "Low", Text = "Low"
                    }
                };
                ViewBag.Stage = new List <SelectListItem> {
                    new SelectListItem {
                        Value = "Discovery", Text = "Discovery"
                    },
                    new SelectListItem {
                        Value = "Trial", Text = "Trial"
                    },
                    new SelectListItem {
                        Value = "Apeal", Text = "Apeal"
                    },
                    new SelectListItem {
                        Value = "Motions", Text = "Motions"
                    },
                    new SelectListItem {
                        Value = "Closed", Text = "Closed"
                    },
                    new SelectListItem {
                        Value = "Pleading", Text = "Pleading"
                    }
                };
                ViewBag.PracticeArea = new List <SelectListItem> {
                    new SelectListItem {
                        Value = "None", Text = "None"
                    },
                    new SelectListItem {
                        Value = "Acquisition", Text = "Acquisition"
                    },
                    new SelectListItem {
                        Value = "Administrative", Text = "Administrative"
                    },
                    new SelectListItem {
                        Value = "Audit", Text = "Audit"
                    },
                    new SelectListItem {
                        Value = "Civil", Text = "Civil"
                    },
                    new SelectListItem {
                        Value = "Commercial", Text = "Commercial"
                    },
                    new SelectListItem {
                        Value = "Consultation", Text = "Consultation"
                    },
                    new SelectListItem {
                        Value = "Corporate", Text = "Corporate"
                    },
                    new SelectListItem {
                        Value = "Criminal", Text = "Criminal"
                    },
                    new SelectListItem {
                        Value = "Dispute", Text = "Dispute"
                    },
                    new SelectListItem {
                        Value = "Due Deligence", Text = "Due Deligence"
                    },
                    new SelectListItem {
                        Value = "Labour", Text = "Labour"
                    },
                    new SelectListItem {
                        Value = "Real Estate", Text = "Real Estate"
                    },
                    new SelectListItem {
                        Value = "Sharia", Text = "Sharia"
                    },
                    new SelectListItem {
                        Value = "Agreement", Text = "Agreement"
                    }
                };
                ViewBag.ClientId = new SelectList(db.Clients, "ClientId", "FirstName", matter.ClientId);
                return(View(matter));
            }
            ViewBag.Priority = new List <SelectListItem> {
                new SelectListItem {
                    Value = "Critical", Text = "Critical"
                },
                new SelectListItem {
                    Value = "High", Text = "High"
                },
                new SelectListItem {
                    Value = "Medium", Text = "Medium"
                },
                new SelectListItem {
                    Value = "Low", Text = "Low"
                }
            };
            ViewBag.Stage = new List <SelectListItem> {
                new SelectListItem {
                    Value = "Discovery", Text = "Discovery"
                },
                new SelectListItem {
                    Value = "Trial", Text = "Trial"
                },
                new SelectListItem {
                    Value = "Apeal", Text = "Apeal"
                },
                new SelectListItem {
                    Value = "Motions", Text = "Motions"
                },
                new SelectListItem {
                    Value = "Closed", Text = "Closed"
                },
                new SelectListItem {
                    Value = "Pleading", Text = "Pleading"
                }
            };
            ViewBag.PracticeArea = new List <SelectListItem> {
                new SelectListItem {
                    Value = "None", Text = "None"
                },
                new SelectListItem {
                    Value = "Acquisition", Text = "Acquisition"
                },
                new SelectListItem {
                    Value = "Administrative", Text = "Administrative"
                },
                new SelectListItem {
                    Value = "Audit", Text = "Audit"
                },
                new SelectListItem {
                    Value = "Civil", Text = "Civil"
                },
                new SelectListItem {
                    Value = "Commercial", Text = "Commercial"
                },
                new SelectListItem {
                    Value = "Consultation", Text = "Consultation"
                },
                new SelectListItem {
                    Value = "Corporate", Text = "Corporate"
                },
                new SelectListItem {
                    Value = "Criminal", Text = "Criminal"
                },
                new SelectListItem {
                    Value = "Dispute", Text = "Dispute"
                },
                new SelectListItem {
                    Value = "Due Deligence", Text = "Due Deligence"
                },
                new SelectListItem {
                    Value = "Labour", Text = "Labour"
                },
                new SelectListItem {
                    Value = "Real Estate", Text = "Real Estate"
                },
                new SelectListItem {
                    Value = "Sharia", Text = "Sharia"
                },
                new SelectListItem {
                    Value = "Agreement", Text = "Agreement"
                }
            };
            ViewBag.ClientId = new SelectList(db.Clients, "ClientId", "FirstName", matter.ClientId);
            return(View(matter));
        }
Ejemplo n.º 18
0
        public async Task <ActionResult> Create([Bind(Include = "Id,Name,ShortName,CompanyLegalType,CompanyGroup,Nationality,Address,City,State,Country,Website,PhoneNumber,MobileNumber,EmailAddress,CompanyLawyer,Capital,Currency,CreatedBy,CreatedOn,ModifiedBy,ModifiedOn")] Company company)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var user = User.Identity.Name;
                    company.CreatedBy = user;
                    company.CreatedOn = DateTime.Today;

                    db.Companies.Add(company);
                    await db.SaveChangesAsync();

                    return(RedirectToAction("Index"));
                }
                catch (Exception)
                {
                    ViewBag.Error = "Can't Add Company, Error Occured. Please Contact IT Department.";
                }
            }
            else
            {
                ViewBag.Error     = "Fill in the required fields to continue";
                ViewBag.LegalType = new List <SelectListItem>
                {
                    new SelectListItem {
                        Value = "Criminal", Text = "Criminal"
                    },
                    new SelectListItem {
                        Value = "Civil", Text = "Civil"
                    }
                };
                ViewBag.Countries = new List <SelectListItem>
                {
                    new SelectListItem {
                        Value = "Algeria", Text = "Algeria"
                    },
                    new SelectListItem {
                        Value = "Benin", Text = "Benin"
                    },
                    new SelectListItem {
                        Value = "Cameroon", Text = "Cameroon"
                    },
                    new SelectListItem {
                        Value = "Djibouti", Text = "Djibouti"
                    },
                    new SelectListItem {
                        Value = "Egypt", Text = "Egypt"
                    },
                    new SelectListItem {
                        Value = "Ghana", Text = "Ghana"
                    },
                    new SelectListItem {
                        Value = "Kenya", Text = "Kenya"
                    },
                    new SelectListItem {
                        Value = "Liberia", Text = "Liberia"
                    },
                    new SelectListItem {
                        Value = "Mali", Text = "Mali"
                    },
                    new SelectListItem {
                        Value = "Nigeria", Text = "Nigeria"
                    },
                    new SelectListItem {
                        Value = "Rwanda", Text = "Rwanda"
                    },
                    new SelectListItem {
                        Value = "South Africa", Text = "South Africa"
                    },
                    new SelectListItem {
                        Value = "Tanzania", Text = "Tanzania"
                    },
                    new SelectListItem {
                        Value = "Uganda", Text = "Uganda"
                    },
                    new SelectListItem {
                        Value = "Zimbabwe", Text = "Zimbabwe"
                    },
                };
                return(View(company));
            }
            ViewBag.LegalType = new List <SelectListItem>
            {
                new SelectListItem {
                    Value = "Criminal", Text = "Criminal"
                },
                new SelectListItem {
                    Value = "Civil", Text = "Civil"
                }
            };
            ViewBag.Countries = new List <SelectListItem>
            {
                new SelectListItem {
                    Value = "Algeria", Text = "Algeria"
                },
                new SelectListItem {
                    Value = "Benin", Text = "Benin"
                },
                new SelectListItem {
                    Value = "Cameroon", Text = "Cameroon"
                },
                new SelectListItem {
                    Value = "Djibouti", Text = "Djibouti"
                },
                new SelectListItem {
                    Value = "Egypt", Text = "Egypt"
                },
                new SelectListItem {
                    Value = "Ghana", Text = "Ghana"
                },
                new SelectListItem {
                    Value = "Kenya", Text = "Kenya"
                },
                new SelectListItem {
                    Value = "Liberia", Text = "Liberia"
                },
                new SelectListItem {
                    Value = "Mali", Text = "Mali"
                },
                new SelectListItem {
                    Value = "Nigeria", Text = "Nigeria"
                },
                new SelectListItem {
                    Value = "Rwanda", Text = "Rwanda"
                },
                new SelectListItem {
                    Value = "South Africa", Text = "South Africa"
                },
                new SelectListItem {
                    Value = "Tanzania", Text = "Tanzania"
                },
                new SelectListItem {
                    Value = "Uganda", Text = "Uganda"
                },
                new SelectListItem {
                    Value = "Zimbabwe", Text = "Zimbabwe"
                },
            };
            return(View(company));
        }