public void save(DesignationDto Designation_dto)
        {
            try
            {
                using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required))
                {
                    var DesignationWithSamePosition = _DesignationRepository.getByPosition(Designation_dto.position);
                    if (DesignationWithSamePosition != null)
                    {
                        throw new ItemUsedException("This position is already used.");
                    }
                    Designation Designation          = new Designation();
                    var         designation_position = _DesignationRepository.getAll();

                    _DesignationMaker.copy(ref Designation, Designation_dto);
                    _DesignationRepository.insert(Designation);

                    tx.Complete();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        public ActionResult New()
        {
            DesignationDto d = new DesignationDto();

            ViewBag.designations = d.empDesignationList;
            return(View());
        }
        public void CreateDesignation()
        {
            DesignationServiceClient client = null;

            try
            {
                string         userDesignation = Request.Params["ppUserDesignation"];
                UserDto        currentUser     = (UserDto)Session[Constants.SKCURRENTUSER];
                DesignationDto designation     = new DesignationDto();
                designation.DesignationName = userDesignation;
                designation.CreatedBy       = currentUser.UserId;
                designation.ModifiedBy      = currentUser.UserId;
                client      = new DesignationServiceClient();
                designation = client.Create(designation, currentUser.UserName);
                client.Close();
                if (designation.Response.HasWarning)
                {
                    foreach (BusinessWarning businessWarning in designation.Response.BusinessWarnings)
                    {
                        ViewData["Error"] = "Designation Present";
                    }
                }
                else
                {
                    TempData["GroupSaved"] = "Designation Saved";
                }
            }
            catch (Exception)
            {
                if (client != null && client.State == System.ServiceModel.CommunicationState.Opened)
                {
                    client.Close();
                }
            }
        }
        public ActionResult Details(int id)
        {
            DesignationDto d            = new DesignationDto();
            var            employeeInDb = _context.Employee.SingleOrDefault(e => e.Id == id);

            ViewBag.salaries    = _context.EmployeeSalaries.Where(s => s.EmployeeId == id).Include(m => m.Month).Include(y => y.Year);
            ViewBag.designation = d.empDesignationList.SingleOrDefault(c => c.Id == employeeInDb.DesignationId);

            return(View(employeeInDb));
        }
Exemple #5
0
        public ActionResult Edit(int id)
        {
            DesignationDto d = new DesignationDto();

            ViewBag.designations = d.designationList;

            var teacherInDb = _context.Teachers.SingleOrDefault(t => t.Id == id);

            ViewBag.flag   = 1;
            ViewBag.salary = _context.Salaries.Where(s => s.TeacherId == id).Include(m => m.Month).Include(y => y.Year);
            return(View("New", teacherInDb));
        }
        public ActionResult Edit(int id)
        {
            var employeeInDb = _context.Employee.SingleOrDefault(e => e.Id == id);

            DesignationDto d = new DesignationDto();

            ViewBag.designations = d.empDesignationList;
            ViewBag.flag         = 1;
            ViewBag.salary       = _context.EmployeeSalaries.Where(s => s.EmployeeId == id).Include(m => m.Month).Include(y => y.Year);

            return(View("New", employeeInDb));
        }
        public string Update(DesignationDto dto)
        {
            string message = "";

            try
            {
                int result = _designationRepository.Update(dto.ToEntity());
                message = _messageClass.ShowSuccessMessage(result);
            }
            catch (SqlException ex)
            {
                message = _messageClass.ShowErrorMessage(string.Format("{0} ~ {1}", ex.Number.ToString(), ex.Message));
            }
            return(message);
        }
        public virtual void CreateDesignation()
        {
            var designationdto = new DesignationDto
            {
                DesignationName = "Account Manager",
                CreatedBy       = -1,
                CreatedDate     = DateTime.Now,
                ModifiedBy      = -1,
                ModifiedDate    = DateTime.Now
            };

            this.DesignationInstance = this.DesignationService.Create(designationdto, CurrentUserInstance.UserName);
            Assert.IsFalse(this.DesignationInstance.DesignationId == 0, "User Group Id should have been updated");
            Assert.AreEqual(this.DesignationInstance.DesignationName, designationdto.DesignationName, "designation Name are different");
        }
Exemple #9
0
        public static Designation ToEntity(this DesignationDto dto)
        {
            if (dto == null)
            {
                return(null);
            }

            return(new Designation
            {
                DesignationId = dto.DesignationId,
                DesignationName = dto.DesignationName,
                Status = dto.Status,
                CreatedDate = dto.CreatedDate,
            });
        }
Exemple #10
0
        public IActionResult edit(long Designation_id)
        {
            try
            {
                var            designation = _designationRepository.getById(Designation_id);
                DesignationDto dto         = _mapper.Map <DesignationDto>(designation);

                RouteData.Values.Remove("Designation_id");
                return(View(dto));
            }
            catch (Exception ex)
            {
                AlertHelper.setMessage(this, ex.Message, messageType.error);
                return(RedirectToAction("index"));
            }
        }
Exemple #11
0
 public IActionResult edit(DesignationDto Designation_dto)
 {
     try
     {
         if (ModelState.IsValid)
         {
             _designationService.update(Designation_dto);
             AlertHelper.setMessage(this, "Designation updated successfully.");
             return(RedirectToAction("index"));
         }
     }
     catch (Exception ex)
     {
         AlertHelper.setMessage(this, ex.Message, messageType.error);
     }
     return(View(Designation_dto));
 }
Exemple #12
0
        public virtual void UpdateUser1()
        {
            //var id = 42;
            var userdto = UserService.GetByUserName("Smita");

            #region UserDto

            userdto.Title = "Ms";
            userdto.Name  = "Himali";

            userdto.Email = "*****@*****.**";

            #endregion

            #region UserGroup
            var usergroupDto = new UserGroupDto
            {
                UserGroupId = 4,
            };

            userdto.UserWithUserGroups.Clear();
            userdto.UserWithUserGroups.Add(usergroupDto);

            #endregion

            #region DesignationDto
            DesignationDto designDto = new DesignationDto
            {
                DesignationId = 2
            };
            userdto.UserDesignation = designDto;
            #endregion


            #region userprofileDto

            userdto.UserProfile.Gender     = "Female";
            userdto.UserProfile.BloodGroup = "A+";
            userdto.UserProfile.UserAddress.AddressLine1 = "NIBM";
            userdto.UserProfile.UserAddress.CityVillage.CityVillageId = 2;
            #endregion

            this.UserInstance = this.UserService.Update(userdto, CurrentUserInstance.UserName);

            Assert.IsTrue(this.UserInstance.Name == userdto.Name, "user Updated");
        }
        public override ClientPrimaryContactPerson EntityDtoToEntity(ClientPrimaryContactPersonDto entityDto)
        {
            ClientPrimaryContactPerson clientPrimaryContactPerson = Mapper.Map <ClientPrimaryContactPersonDto, ClientPrimaryContactPerson>(entityDto);

            if (entityDto != null)
            {
                #region ClientPrimaryContactPerson Address
                if (entityDto.ClientPrimaryContactPersonAddress != null)
                {
                    AddressService addressService = new AddressService();
                    clientPrimaryContactPerson.ClientPrimaryContactPersonAddress = addressService.EntityDtoToEntity(entityDto.ClientPrimaryContactPersonAddress);
                }
                #endregion

                #region ClientPrimaryContactPerson Designation
                DesignationService designationservice = new DesignationService();
                if (entityDto.ClientPrimaryContactPersonDesignation != null && entityDto.ClientPrimaryContactPersonDesignation.DesignationId != 0)
                {
                    DesignationDto designationdto = designationservice.GetById(entityDto.ClientPrimaryContactPersonDesignation.DesignationId);
                    clientPrimaryContactPerson.ClientPrimaryContactPersonDesignation = designationservice.EntityDtoToEntity(designationdto);
                }
                else
                {
                    clientPrimaryContactPerson.ClientPrimaryContactPersonDesignation = null;
                }
                #endregion

                #region ClientPrimaryContactPerson ContactDetails
                clientPrimaryContactPerson.ClientPrimaryContacts.Clear();
                if (entityDto.ClientPrimaryContacts != null)
                {
                    foreach (ContactDetailsDto contactdetailsdto in entityDto.ClientPrimaryContacts.Where(x => x.ContactNo != null && x.ContactNo != ""))
                    {
                        ContactDetails usercontactdetails = new Entities.ContactDetails();
                        usercontactdetails = Mapper.Map <ContactDetailsDto, ContactDetails>(contactdetailsdto);
                        clientPrimaryContactPerson.ClientPrimaryContacts.Add(usercontactdetails);
                    }
                }
                #endregion
            }
            return(clientPrimaryContactPerson);
        }
Exemple #14
0
        public ActionResult CreateNewUserDesignation()
        {
            DesignationServiceClient client   = null;
            string           Prefix           = Request.Params["prefix"];
            DesignationModel designationModel = new DesignationModel(Prefix);

            try
            {
                string         userDesignation = Request.Params["ppUserDesignation"];
                UserDto        currentUser     = (UserDto)Session[Constants.SKCURRENTUSER];
                DesignationDto designation     = new DesignationDto();
                designation.DesignationName = userDesignation;
                designation.CreatedBy       = currentUser.UserId;
                designation.ModifiedBy      = currentUser.UserId;
                client = new DesignationServiceClient();
                currentUser.ViewOfUserUserGroupRolePermissions = null;
                designation = client.Create(designation, currentUser.UserName);
                client.Close();
                if (designation.Response.HasWarning)
                {
                    foreach (BusinessWarning businessWarning in designation.Response.BusinessWarnings)
                    {
                        ViewData["Error"] = "Designation Present";
                    }
                }
                else
                {
                    TempData["DesignationId"] = designation.DesignationId.ToString();
                    TempData["GroupSaved"]    = "Designation Saved";
                }
            }
            catch (Exception)
            {
                if (client != null && client.State == System.ServiceModel.CommunicationState.Opened)
                {
                    client.Close();
                }
            }
            return(PartialView("CBPPopupAddDesignation", designationModel));
        }
Exemple #15
0
        public IActionResult add(DesignationDto model, IFormFile file = null)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (file != null)
                    {
                        string fileName = model.name;
                        model.name = _fileHelper.saveImageAndGetFileName(file, fileName);
                    }
                    _designationService.save(model);
                    AlertHelper.setMessage(this, "Designation saved successfully.", messageType.success);
                    return(RedirectToAction("index"));
                }
            }
            catch (Exception ex)
            {
                AlertHelper.setMessage(this, ex.Message, messageType.error);
            }

            return(View(model));
        }
        public void update(DesignationDto Designation_dto)
        {
            try
            {
                using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required))
                {
                    Designation Designation = _DesignationRepository.getById(Designation_dto.Designation_id);

                    if (Designation == null)
                    {
                        throw new ItemNotFoundException($"Designation with ID {Designation_dto.Designation_id} doesnot Exit.");
                    }

                    _DesignationMaker.copy(ref Designation, Designation_dto);
                    _DesignationRepository.update(Designation);
                    tx.Complete();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        public ActionResult AddClientPartnerToSession([ModelBinder(typeof(DevExpressEditorsBinder))] ClientPartnersModel CPmodel)
        {
            ViewData["Error"]   = null;
            TempData["Success"] = null;
            if (Request.QueryString["cpmode"] != null)
            {
                cpmode = Request.QueryString["cpmode"].ToString();
            }
            if (Request.QueryString["partnerid"] != null)
            {
                partnerid = Request.QueryString["partnerid"].ToString();
            }
            string mode = string.Empty;

            if (Request.QueryString["mode"] != null)
            {
                mode = Request.QueryString["mode"].ToString();
            }
            ClientPartnerDetailsDto NewPartnerDto = new ClientPartnerDetailsDto();

            DesignationServiceReference.DesignationServiceClient DesignationClient = null;
            CityVillageServiceReference.CityVillageServiceClient CityClient        = null;

            try
            {
                if (CPmodel.StateDistrictPlacesControlNames != null)
                {
                    for (int i = 0; i < CPmodel.StateDistrictPlacesControlNames.Count; i++)
                    {
                        CPmodel.StateDistrictPlacesControlNames[i].HiddenFieldForCityVillageValue =
                            !String.IsNullOrEmpty(Request.Params[CPmodel.StateDistrictPlacesControlNames[i].PlacesComboName + "_VI"]) ?
                            Convert.ToInt32(Request.Params[CPmodel.StateDistrictPlacesControlNames[i].PlacesComboName + "_VI"]) : 0;
                        CPmodel.StateDistrictPlacesControlNames[i].HiddenFieldForDistrictValue =
                            !String.IsNullOrEmpty(Request.Params[CPmodel.StateDistrictPlacesControlNames[i].DistrictComboName + "_VI"]) ?
                            Convert.ToInt32(Request.Params[CPmodel.StateDistrictPlacesControlNames[i].DistrictComboName + "_VI"]) : 0;
                        CPmodel.StateDistrictPlacesControlNames[i].HiddenFieldForStateValue =
                            !String.IsNullOrEmpty(Request.Params[CPmodel.StateDistrictPlacesControlNames[i].StateComboName + "_VI"]) ?
                            Convert.ToInt32(Request.Params[CPmodel.StateDistrictPlacesControlNames[i].StateComboName + "_VI"]) : 0;
                    }
                }

                if (EditorExtension.GetValue <object>(CPmodel.dOBnAgeModellist[0].txtDOBnAgeName) != null)
                {
                    CPmodel.dOBnAgeModellist[0].BindDate = EditorExtension.GetValue <DateTime>(CPmodel.dOBnAgeModellist[0].txtDOBnAgeName);
                }
                if (ComboBoxExtension.GetValue <object>(CPmodel.designationModel[0].DDLDesignations) != null)
                {
                    CPmodel.designationModel[0].SelectedId = ComboBoxExtension.GetValue <int>(CPmodel.designationModel[0].DDLDesignations);
                }
                if (EditorExtension.GetValue <object>("txtJoiningDate") != null)
                {
                    CPmodel.JoiningDate = EditorExtension.GetValue <DateTime>("txtJoiningDate");
                }
                if (EditorExtension.GetValue <object>("txtRelievingDate") != null)
                {
                    CPmodel.RelievingDate = EditorExtension.GetValue <DateTime>("txtRelievingDate");
                }
                if (EditorExtension.GetValue <object>(CPmodel.dOBnAgeModellist[1].txtDOBnAgeName) != null)
                {
                    CPmodel.dOBnAgeModellist[1].BindDate = EditorExtension.GetValue <DateTime>(CPmodel.dOBnAgeModellist[1].txtDOBnAgeName);
                }

                CheckForAOValidation(CPmodel, mode);

                UserDto CurrentUser = (UserDto)Session[Constants.SKCURRENTUSER];

                if (ModelState.IsValid)
                {
                    #region Client Partner Details

                    NewPartnerDto.PartnerName  = CPmodel.PartnerName;
                    NewPartnerDto.Gender       = CPmodel.Gender;
                    NewPartnerDto.PAN          = CPmodel.PAN;
                    NewPartnerDto.UID          = CPmodel.UID;
                    NewPartnerDto.IsActive     = CPmodel.IsActive;
                    NewPartnerDto.Email1       = CPmodel.Email1;
                    NewPartnerDto.Email2       = CPmodel.Email2;
                    NewPartnerDto.ModifiedBy   = CurrentUser.UserId;
                    NewPartnerDto.ModifiedDate = DateTime.Now;

                    #region Partner Designation
                    DesignationDto designationDto = null;
                    if (CPmodel.designationModel[0].SelectedId > 0)
                    {
                        DesignationClient = new DesignationServiceClient();
                        designationDto    = DesignationClient.GetById(CPmodel.designationModel[0].SelectedId);
                    }
                    if (designationDto != null)
                    {
                        NewPartnerDto.ClientPartnerDesignation = designationDto;
                    }
                    #endregion

                    #region Date fields
                    if (CPmodel.dOBnAgeModellist[0].BindDate != DateTime.MinValue)
                    {
                        NewPartnerDto.DateOfBirth = CPmodel.dOBnAgeModellist[0].BindDate;
                    }
                    if (CPmodel.JoiningDate != DateTime.MinValue)
                    {
                        NewPartnerDto.JoiningDate = CPmodel.JoiningDate;
                    }
                    if (CPmodel.RelievingDate != DateTime.MinValue && CPmodel.RelievingDate != Helper.SetDefaultDate())
                    {
                        NewPartnerDto.RelievingDate = CPmodel.RelievingDate;
                    }

                    #endregion

                    #region Partner Address,City/Village
                    int cityVillageID = 0;
                    if (CPmodel.ClientPartnerAddress != null)
                    {
                        NewPartnerDto.ClientPartnerAddress = CPmodel.ClientPartnerAddress;
                        if (CPmodel.StateDistrictPlacesControlNames[0].HiddenFieldForStateValue > 0)
                        {
                            cityVillageID = ComboBoxExtension.GetValue <int>(CPmodel.StateDistrictPlacesControlNames[0].PlacesComboName);
                            CityClient    = new CityVillageServiceClient();
                            CityVillageDto cityVillageDto = CityClient.GetById(cityVillageID);
                            if (cityVillageDto != null)
                            {
                                NewPartnerDto.ClientPartnerAddress.CityVillage = cityVillageDto;
                            }
                            CityClient.Close();
                        }
                    }
                    #endregion

                    #region Partner Contact Details
                    NewPartnerDto.ClientPartnerContacts = CPmodel.ClientPartnerContacts;
                    if (NewPartnerDto.ClientPartnerContacts != null && NewPartnerDto.ClientPartnerContacts.Count == 1)
                    {
                        if (NewPartnerDto.ClientPartnerContacts[0].ContactNo == null)
                        {
                            NewPartnerDto.ClientPartnerContacts.RemoveAt(0);
                        }
                    }
                    #endregion

                    #endregion

                    #region Gardian Details
                    bool isMinor = false;
                    if (CPmodel.dOBnAgeModellist[0].BindDate != DateTime.MinValue)
                    {
                        isMinor = IsMinor(CPmodel.dOBnAgeModellist[0].BindDate);
                    }
                    if (CPmodel.ClientPartnerGuardian != null && isMinor)
                    {
                        NewPartnerDto.ClientPartnerGuardian = CPmodel.ClientPartnerGuardian;

                        if (CPmodel.dOBnAgeModellist[1].BindDate != DateTime.MinValue)
                        {
                            NewPartnerDto.ClientPartnerGuardian.DateOfBirth = CPmodel.dOBnAgeModellist[1].BindDate;
                        }

                        if (CPmodel.ClientPartnerGuardian.ClientPartnerGuardianAddress != null)
                        {
                            //NewPartnerDto.ClientPartnerGuardian.ClientPartnerGuardianAddress = CPmodel.ClientPartnerGuardian.ClientPartnerGuardianAddress;
                            if (CPmodel.StateDistrictPlacesControlNames[1].HiddenFieldForStateValue > 0)
                            {
                                cityVillageID = ComboBoxExtension.GetValue <int>(CPmodel.StateDistrictPlacesControlNames[1].PlacesComboName);
                                CityClient    = new CityVillageServiceClient();
                                CityVillageDto cityVillageDto = CityClient.GetById(cityVillageID);
                                if (cityVillageDto != null)
                                {
                                    NewPartnerDto.ClientPartnerGuardian.ClientPartnerGuardianAddress.CityVillage = cityVillageDto;
                                }
                                CityClient.Close();
                            }
                        }

                        //NewPartnerDto.ClientPartnerGuardian.ClientPartnerGuardianContacts = CPmodel.ClientPartnerGuardian.ClientPartnerGuardianContacts;
                        if (NewPartnerDto.ClientPartnerGuardian.ClientPartnerGuardianContacts != null && NewPartnerDto.ClientPartnerGuardian.ClientPartnerGuardianContacts.Count == 1)
                        {
                            if (NewPartnerDto.ClientPartnerGuardian.ClientPartnerGuardianContacts[0].ContactNo == null)
                            {
                                NewPartnerDto.ClientPartnerGuardian.ClientPartnerGuardianContacts.RemoveAt(0);
                            }
                        }
                    }
                    #endregion

                    #region Session Part
                    if (Session["AOUploadedImageFileName"] != null)
                    {
                        NewPartnerDto.Image = Session["AOUploadedImageFileName"].ToString();
                    }
                    if (Session["AOGuardianCallbacksImageUpload"] != null)
                    {
                        NewPartnerDto.ClientPartnerGuardian.Image = Session["AOGuardianCallbacksImageUpload"].ToString();
                    }

                    if (Session["ClientPartners"] == null)
                    {
                        Session["ClientPartners"] = new List <ClientPartnerDetailsDto>();
                    }



                    int index = 0;
                    if (!String.IsNullOrEmpty(cpmode) && !String.IsNullOrEmpty(partnerid))
                    {
                        index = ((List <ClientPartnerDetailsDto>)Session["ClientPartners"]).FindIndex(x => x.PartnerId == Convert.ToInt32(partnerid));
                        ((List <ClientPartnerDetailsDto>)Session["ClientPartners"]).RemoveAt(index);
                        ((List <ClientPartnerDetailsDto>)Session["ClientPartners"]).Insert(index, NewPartnerDto);
                    }
                    else
                    {
                        NewPartnerDto.CreatedBy   = CurrentUser.UserId;
                        NewPartnerDto.CreatedDate = DateTime.Now;
                        NewPartnerDto.PartnerId   = (((List <ClientPartnerDetailsDto>)Session["ClientPartners"]).Count) + 1;
                        ((List <ClientPartnerDetailsDto>)Session["ClientPartners"]).Add(NewPartnerDto);
                    }
                    #endregion
                    return(RedirectToAction("ClientRegistrationIndex", "ClientAccount", new { mode = mode }));
                }
                else
                {
                    ViewData["Error"] = "error";
                }
            }
            catch (Exception ex)
            {
                return(View("ErrorPage"));
            }
            return(View("ClientPartnersAdd", CPmodel));
        }
 public DesignationDto Create(DesignationDto designation, string userName)
 {
     return(ExecuteCommand(() => Service.Create(designation, userName)));
 }
Exemple #19
0
 public DesignationDto Create(DesignationDto designation, UserDto userDto)
 {
     return(ExecuteCommand(() => Service.Create(designation, userDto)));
 }
Exemple #20
0
 public DesignationDto Create(DesignationDto designation, UserDto userDto)
 {
     return(ExecuteCommand(proxy => proxy.Create(designation, userDto)));
 }
 public void copy(ref Designation Designation, DesignationDto DesignationDto)
 {
     Designation.Designation_id = DesignationDto.Designation_id;
     Designation.name           = DesignationDto.name;
     Designation.position       = DesignationDto.position;
 }
Exemple #22
0
        public ActionResult Details(int id)
        {
            DesignationDto d           = new DesignationDto();
            var            teacherInDb = _context.Teachers.SingleOrDefault(t => t.Id == id);

            ViewBag.teacherCourses = _context.TeacherCourse.Where(c => c.TeacherId == id).Include(c => c.Course);
            ViewBag.salaries       = _context.Salaries.Where(s => s.TeacherId == id).Include(m => m.Month).Include(y => y.Year);
            ViewBag.designation    = d.designationList.SingleOrDefault(c => c.Id == teacherInDb.DesignationId);

            var records   = _context.TeacherCourse.Where(t => t.TeacherId == id).ToList();
            var timeTable = new List <TeacherTimeTable>();

            foreach (var record in records)
            {
                var      teacherName         = _context.Teachers.SingleOrDefault(t => t.Id == record.TeacherId).Name;
                var      course              = _context.Course.SingleOrDefault(c => c.Id == record.CourseId);
                var      departmentShortName = _context.Departments.SingleOrDefault(de => de.Id == course.DepartmentId).ShortName;
                var      semesterId          = _context.Semester.SingleOrDefault(s => s.Id == course.SemesterId).Id;
                Dtos.Day dayClass            = new Dtos.Day();
                var      days = dayClass.days;
                var      day  = days.SingleOrDefault(da => da.Id == record.DayId);

                //
                var starttime = record.StartTime;
                var ampm      = starttime.Contains("AM") ? "A" : "P";
                var sampm     = starttime.Contains("A") ?
                                starttime.Substring(starttime.IndexOf("A")) :
                                starttime.Substring(starttime.IndexOf("P"));

                var endtime = record.EndTime;
                var eampm   = endtime.Contains("A") ?
                              endtime.Substring(endtime.IndexOf("A")) :
                              endtime.Substring(endtime.IndexOf("P"));

                var starthour   = starttime.Substring(0, starttime.IndexOf(":"));
                var endhour     = endtime.Substring(0, endtime.IndexOf(":"));
                var startminute = "";
                var endminute   = "";
                var flag        = 0;
                for (int i = 0; i < starttime.Length; i++)
                {
                    if (flag == 1)
                    {
                        if (starttime[i] == 'A' || starttime[i] == 'P')
                        {
                            break;
                        }
                        startminute += starttime[i];
                    }
                    if (starttime[i] == ':')
                    {
                        flag = 1;
                    }
                }
                var flag1 = 0;
                for (int i = 0; i < endtime.Length; i++)
                {
                    if (flag1 == 1)
                    {
                        if (endtime[i] == 'A' || endtime[i] == 'P')
                        {
                            break;
                        }
                        endminute += endtime[i];
                    }
                    if (endtime[i] == ':')
                    {
                        flag1 = 1;
                    }
                }

                //8/2/1995 12:00:00 AM
                var      startD    = "8/2/2018 " + starthour + ":" + startminute + ":00 " + sampm;
                var      endD      = "8/2/2018 " + endhour + ":" + endminute + ":00 " + eampm;
                DateTime sdateTime = DateTime.Parse(startD);
                DateTime edateTime = DateTime.Parse(endD);

                //DateTime d1 = DateTime.Parse(sdateTime.ToString("HH:mm:ss tt"));
                //DateTime d2 = DateTime.Parse(edateTime.ToString("HH:mm:ss tt"));

                TimeSpan differencet = edateTime - sdateTime;
                var      difference  = (differencet.Hours * 60) + differencet.Minutes;

                if (difference > 50 && record.DayId != 5)
                {
                    var f = sdateTime;
                    while (f != edateTime)
                    {
                        var stfull = f;
                        f = f.AddMinutes(50);
                        var etfull = f;

                        timeTable.Add(
                            new TeacherTimeTable
                        {
                            Teacher    = teacherName,
                            Section    = record.Section,
                            Semester   = semesterId.ToString(),
                            Department = departmentShortName,
                            Course     = course.Name,
                            Day        = day.Name,
                            Room       = record.Room,
                            StartTime  = stfull.ToString("h:mtt"),
                            EndTime    = etfull.ToString("h:mtt")
                        });
                    }
                }
                else if (difference > 45 && record.DayId == 5)
                {
                    var f = sdateTime;
                    while (f != edateTime)
                    {
                        var stfull = f;
                        f = f.AddMinutes(45);
                        var etfull = f;

                        timeTable.Add(
                            new TeacherTimeTable
                        {
                            Teacher    = teacherName,
                            Section    = record.Section,
                            Semester   = semesterId.ToString(),
                            Department = departmentShortName,
                            Course     = course.Name,
                            Day        = day.Name,
                            Room       = record.Room,
                            StartTime  = stfull.ToString("h:mtt"),
                            EndTime    = etfull.ToString("h:mtt")
                        });
                    }
                }
                //

                else
                {
                    timeTable.Add(new TeacherTimeTable
                    {
                        Teacher    = teacherName,
                        Section    = record.Section,
                        Semester   = semesterId.ToString(),
                        Department = departmentShortName,
                        Course     = course.Name,
                        Day        = day.Name,
                        Room       = record.Room,
                        StartTime  = record.StartTime,
                        EndTime    = record.EndTime
                    });
                }
            }

            foreach (var record in timeTable)
            {
                if (record.Course.Contains("_Lab"))
                {
                    int index = record.Course.IndexOf("_Lab");
                    var n     = record.Course.Remove(index + 4);
                    record.Course = n;
                }
            }

            ViewBag.timeTable = timeTable;
            return(View(teacherInDb));
        }
 public DesignationDto Create(DesignationDto designation, string userName)
 {
     return(ExecuteCommand(proxy => proxy.Create(designation, userName)));
 }
Exemple #24
0
        public virtual void CreateUser()
        {
            #region UserDto
            var userdto = new UserDto
            {
                Title              = "Ms",
                Name               = "Smita",           //"Sujata",
                UserName           = "******",           // "SujataPant",
                MobileNo           = "9499999914",      // "9890969234",
                Email              = "*****@*****.**", //"*****@*****.**",
                CountryCode        = "091",
                MothersMaidenName  = "paro",            // "Anuradha",
                IsActive           = true,
                Password           = "******",
                CreatedBy          = -1,
                IsLockedOut        = false,
                IsOnLine           = false,
                ModifiedBy         = -1,
                LastPassword       = "******",
                SecondLastPassword = "******",
                IsDeleted          = false,
                AllowDelete        = true,
                AllowEdit          = true,
                UserOfClient       = new ClientDto
                {
                    CAId = 1
                }
            };
            #endregion

            #region UserGroup
            var usergroupDto = new UserGroupDto
            {
                UserGroupId = 3,
            };
            userdto.UserWithUserGroups.Add(usergroupDto);

            #endregion

            #region DesignationDto
            DesignationDto designDto = new DesignationDto
            {
                DesignationId = 1
            };
            userdto.UserDesignation = designDto;
            #endregion

            #region UserProfile

            #region userprofileDto
            var userprofiledto = new UserProfileDto
            {
                Gender        = "Female",
                MaritalStatus = "Married",
                UID           = "testuid123",
                PAN           = "agttm6550t",
                PassportNo    = "jh27900",
                PassportPlace = "pune",
                BloodGroup    = "O+",
                PFNo          = "mh/th/2734723",
                CreatedBy     = -1,
                ModifiedBy    = -1,
                Email1        = "*****@*****.**",
                UserAddress   = new AddressDto
                {
                    AddressLine1 = "Navi Peth",
                    AddressLine2 = "b1 c wing c8",
                    PIN          = "411040",
                    CreatedBy    = -1,
                    ModifiedBy   = -1,
                    CityVillage  = new CityVillageDto
                    {
                        CityVillageId = 148
                    }
                }
                ,
                #endregion

                #region User Contact Details
                ContactNos = new List <ContactDetailsDto>
                {
                    new ContactDetailsDto
                    {
                        ContactNoType      = Common.ContactType.OfficeNo,
                        STDCode            = "020",
                        ContactNo          = "27658945",
                        CountryCallingCode = CountryInstance.CallingCode
                    },
                    new ContactDetailsDto
                    {
                        ContactNoType      = Common.ContactType.Fax,
                        STDCode            = "020",
                        ContactNo          = "45646456",
                        CountryCallingCode = CountryInstance.CallingCode
                    }
                }
                ,
                #endregion

                #region User Emergency ContactPerson

                #region UserEmergencyContactPersonDto
                UserEmergencyContactPerson = new UserEmergencyContactPersonDto
                {
                    Name                 = "asha",
                    Email1               = "*****@*****.**",
                    CreatedBy            = -1,
                    ModifiedBy           = -1,
                    ContactPersonAddress = new AddressDto
                    {
                        AddressLine1 = "market yard solapur",
                        PIN          = "413005",
                        CreatedBy    = -1,
                        ModifiedBy   = -1,
                        CityVillage  = new CityVillageDto
                        {
                            CityVillageId = 15
                        }
                    }
                    ,
                    #endregion

                    #region User Emergency Contact Person ContactDetailsDto
                    Contacts = new List <ContactDetailsDto>
                    {
                        new ContactDetailsDto
                        {
                            ContactNoType      = Common.ContactType.MobileNo,
                            STDCode            = "",
                            ContactNo          = "9924088345",
                            CountryCallingCode = CountryInstance.CallingCode
                        }
                    }
                    ,
                    #endregion

                    #region RelationshipDto
                    ContactPersonRelationshipWithUser = new RelationshipDto
                    {
                        RelationshipId = 1
                    }
                    #endregion
                }
            };
            #endregion

            userdto.UserProfile = userprofiledto;
            #endregion

            this.UserInstance = this.UserService.Create(userdto, CurrentUserInstance.UserName);
            Assert.IsFalse(this.UserInstance.UserId == 0, "User Id should have been updated");
            Assert.AreEqual(this.UserInstance.Name, userdto.Name, "First Name are different");
        }