コード例 #1
0
        private List <Attorney> LoadAttorneys()
        {
            List <Attorney> attorney_list = new List <Attorney>();

            for (int i = 0; i < 3; i++)
            {
                Attorney atr = new Attorney();
                atr.Attorney_ID   = i;
                atr.Attorney_Name = "Mohammad Kamran";
                atr.Attorney_Role = "Criminal Attorney";
                attorney_list.Add(atr);

                Attorney atr1 = new Attorney();
                atr1.Attorney_ID   = i;
                atr1.Attorney_Name = "Syeda Iqra Waseem";
                atr1.Attorney_Role = "Law Attorney";
                attorney_list.Add(atr1);

                Attorney atr2 = new Attorney();
                atr2.Attorney_ID   = i;
                atr2.Attorney_Name = "Fizza Fatima Naqvi";
                atr2.Attorney_Role = "Tax Attorney";
                attorney_list.Add(atr2);
            }
            return(attorney_list);
        }
コード例 #2
0
        //#region Validate Entities
        //public override List<MIDAS.GBX.BusinessObjects.BusinessValidation> Validate<T>(T entity)
        //{
        //    BO.AttorneyMaster AttorneyMaster = (BO.AttorneyMaster)(object)entity;
        //    var result = AttorneyMaster.Validate(AttorneyMaster);
        //    return result;
        //}
        //#endregion

        //#region Entity Conversion
        //public override T Convert<T, U>(U entity)
        //{
        //    Attorney attorney = entity as Attorney;

        //    if (entity == null) return default(T);

        //    BO.AttorneyMaster attorneyBO = new BO.AttorneyMaster();
        //    attorneyBO.ID = attorney.Id;

        //    if (attorney.User != null)
        //    {
        //        if (attorney.User.IsDeleted.HasValue == false || (attorney.User.IsDeleted.HasValue == true && attorney.User.IsDeleted.Value == false))
        //        {
        //            BO.User boUser = new BO.User();
        //            using (UserRepository cmp = new UserRepository(_context))
        //            {
        //                boUser = cmp.Convert<BO.User, User>(attorney.User);
        //                attorneyBO.User = boUser;
        //            }
        //        }
        //    }
        //    attorneyBO.IsDeleted = attorney.IsDeleted;
        //    attorneyBO.CreateByUserID = attorney.CreateByUserID;
        //    attorneyBO.UpdateByUserID = attorney.UpdateByUserID;

        //    return (T)(object)attorneyBO;
        //}
        //#endregion

        //#region Get All attornies
        //public override object Get()
        //{
        //    //var acc_ = _context.Attorneys.Include("User").Include("User.AddressInfo").Include("User.ContactInfo").Include("User.UserCompanies").Where(p => p.IsDeleted.HasValue == false || p.IsDeleted == false).ToList<Attorney>();
        //    //if (acc_ == null) return new BO.ErrorObject { ErrorMessage = "No records found for Attorney.", errorObject = "", ErrorLevel = ErrorLevel.Error };

        //    var User = _context.Users.Where(p => p.UserType == 3 && (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false))).Select(p => p.id);

        //    var UserCompany = _context.UserCompanies.Where(p => User.Contains(p.UserID) && (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false))).Select(p => p.CompanyID);

        //    var company = _context.Companies.Where(p => UserCompany.Contains(p.id) && p.CompanyType == 2 && (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false))).ToList();

        //    List<BO.Company> lstCompany = new List<BO.Company>();

        //    if (company == null)
        //    {
        //        return new BO.ErrorObject { ErrorMessage = "No record found for this Attorny.", errorObject = "", ErrorLevel = ErrorLevel.Error };
        //    }
        //    else
        //    {
        //        company.ForEach(item => lstCompany.Add(CompanyConvert<BO.Company, Company>(item)));
        //    }

        //    return lstCompany;
        //}
        //#endregion

        //#region Get By Id
        //public override object Get(int id)
        //{
        //    var acc = _context.Attorneys.Include("User")
        //                                .Include("User.AddressInfo")
        //                                .Include("User.ContactInfo")
        //                                .Include("User.UserCompanies")
        //                                .Where(p => p.Id == id && (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false)))
        //                                .FirstOrDefault<Attorney>();

        //    if (acc == null) return new BO.ErrorObject { ErrorMessage = "No record found for this Attorney.", errorObject = "", ErrorLevel = ErrorLevel.Error };
        //    else
        //    {
        //        BO.AttorneyMaster acc_ = Convert<BO.AttorneyMaster, Attorney>(acc);
        //        return (object)acc_;
        //    }
        //}
        //#endregion

        //#region Get By Company Id
        ////public override object GetByCompanyId(int id)
        ////{
        ////    var acc = _context.Attorneys.Include("User")
        ////                                .Include("User.AddressInfo")
        ////                                .Include("User.ContactInfo")
        ////                                .Include("User.UserCompanies")
        ////                                .Where(p => (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false))
        ////                                          && p.User.UserCompanies.Where(p2 => p2.IsDeleted.HasValue == false || (p2.IsDeleted.HasValue == true && p2.IsDeleted.Value == false))
        ////                                                                 .Any(p2 => p2.CompanyID == id) == true)
        ////                                .ToList<Attorney>();

        ////    List<BO.AttorneyMaster> lstattornies = new List<BO.AttorneyMaster>();
        ////    if (acc == null) return new BO.ErrorObject { ErrorMessage = "No record found for this Company Id.", errorObject = "", ErrorLevel = ErrorLevel.Error };
        ////    else
        ////    {
        ////        acc.ForEach(item => lstattornies.Add(Convert<BO.AttorneyMaster, Attorney>(item)));
        ////    }

        ////    return lstattornies;
        ////}
        //#endregion

        //#region Get All Excluding CompanyId
        //public override object GetAllExcludeCompany(int CompanyId)
        //{
        //    var acc = _context.Attorneys.Include("User")
        //                                .Include("User.AddressInfo")
        //                                .Include("User.ContactInfo")
        //                                .Include("User.UserCompanies")
        //                                .Where(p => (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false))
        //                                          && p.User.UserCompanies.Where(p2 => p2.IsDeleted.HasValue == false || (p2.IsDeleted.HasValue == true && p2.IsDeleted.Value == false))
        //                                                                 .Any(p2 => p2.CompanyID != CompanyId) == true)
        //                                .ToList<Attorney>();

        //    List<BO.AttorneyMaster> lstattornies = new List<BO.AttorneyMaster>();
        //    if (acc == null) return new BO.ErrorObject { ErrorMessage = "No record found for this Company Id.", errorObject = "", ErrorLevel = ErrorLevel.Error };
        //    else
        //    {
        //        acc.ForEach(item => lstattornies.Add(Convert<BO.AttorneyMaster, Attorney>(item)));
        //    }

        //    return lstattornies;
        //}
        //#endregion

        //#region Save Data
        //public override Object Save<T>(T entity)
        //{
        //    BO.AttorneyMaster addAttorneyBO = (BO.AttorneyMaster)(object)entity;
        //    BO.User userBO = addAttorneyBO.User;
        //    BO.AddressInfo addressUserBO = (addAttorneyBO.User != null) ? addAttorneyBO.User.AddressInfo : null;
        //    BO.ContactInfo contactinfoUserBO = (addAttorneyBO.User != null) ? addAttorneyBO.User.ContactInfo : null;
        //    Guid invitationDB_UniqueID = Guid.NewGuid();
        //    Attorney _attny = new Attorney();
        //    bool sendEmail = false;

        //    if (addAttorneyBO.ID != addAttorneyBO.User.ID) return new BO.ErrorObject { errorObject = "", ErrorMessage = "Attorney doesn't match the User.", ErrorLevel = ErrorLevel.Error };

        //    using (var dbContextTransaction = _context.Database.BeginTransaction())
        //    {
        //        bool IsEditMode = false;
        //        IsEditMode = (addAttorneyBO != null && addAttorneyBO.ID > 0) ? true : false;

        //        Company CompanyDB = new Company();
        //        UserCompany UserCompanyDB = new UserCompany();
        //        AddressInfo addressUserDB = new AddressInfo();
        //        ContactInfo contactinfoDB = new ContactInfo();
        //        User userDB = new User();

        //        #region Address Info User
        //        if (addressUserBO != null)
        //        {
        //            bool Add_addressDB = false;
        //            addressUserDB = _context.AddressInfoes.Where(p => p.id == addressUserBO.ID).FirstOrDefault();

        //            if (addressUserDB == null && addressUserBO.ID <= 0)
        //            {
        //                addressUserDB = new AddressInfo();
        //                Add_addressDB = true;
        //            }
        //            else if (addressUserDB == null && addressUserBO.ID > 0)
        //            {
        //                dbContextTransaction.Rollback();
        //                return new BO.ErrorObject { errorObject = "", ErrorMessage = "Address details dosent exists.", ErrorLevel = ErrorLevel.Error };
        //            }

        //            //addressUserDB.id = addressUserBO.ID;
        //            addressUserDB.Name = IsEditMode == true && addressUserBO.Name == null ? addressUserDB.Name : addressUserBO.Name;
        //            addressUserDB.Address1 = IsEditMode == true && addressUserBO.Address1 == null ? addressUserDB.Address1 : addressUserBO.Address1;
        //            addressUserDB.Address2 = IsEditMode == true && addressUserBO.Address2 == null ? addressUserDB.Address2 : addressUserBO.Address2;
        //            addressUserDB.City = IsEditMode == true && addressUserBO.City == null ? addressUserDB.City : addressUserBO.City;
        //            addressUserDB.State = IsEditMode == true && addressUserBO.State == null ? addressUserDB.State : addressUserBO.State;
        //            addressUserDB.ZipCode = IsEditMode == true && addressUserBO.ZipCode == null ? addressUserDB.ZipCode : addressUserBO.ZipCode;
        //            addressUserDB.Country = IsEditMode == true && addressUserBO.Country == null ? addressUserDB.Country : addressUserBO.Country;
        //            //[STATECODE-CHANGE]
        //            //addressUserDB.StateCode = IsEditMode == true && addressUserBO.StateCode == null ? addressUserDB.StateCode : addressUserBO.StateCode;
        //            //[STATECODE-CHANGE]
        //            if (Add_addressDB == true) addressUserDB = _context.AddressInfoes.Add(addressUserDB);
        //            _context.SaveChanges();
        //        }
        //        else
        //        {
        //            if (IsEditMode == false)
        //            {
        //                dbContextTransaction.Rollback();
        //                return new BO.ErrorObject { errorObject = "", ErrorMessage = "Please pass valid address details.", ErrorLevel = ErrorLevel.Error };
        //            }
        //            addressUserDB = null;
        //        }
        //        #endregion

        //        #region Contact Info User
        //        if (contactinfoUserBO != null)
        //        {
        //            bool Add_contactinfoDB = false;
        //            contactinfoDB = _context.ContactInfoes.Where(p => p.id == contactinfoUserBO.ID).FirstOrDefault();

        //            if (contactinfoDB == null && contactinfoUserBO.ID <= 0)
        //            {
        //                contactinfoDB = new ContactInfo();
        //                Add_contactinfoDB = true;
        //            }
        //            else if (contactinfoDB == null && contactinfoUserBO.ID > 0)
        //            {
        //                dbContextTransaction.Rollback();
        //                return new BO.ErrorObject { errorObject = "", ErrorMessage = "Contact details dosent exists.", ErrorLevel = ErrorLevel.Error };
        //            }

        //            //contactinfoDB.id = contactinfoUserBO.ID;
        //            contactinfoDB.Name = IsEditMode == true && contactinfoUserBO.Name == null ? contactinfoDB.Name : contactinfoUserBO.Name;
        //            contactinfoDB.CellPhone = IsEditMode == true && contactinfoUserBO.CellPhone == null ? contactinfoDB.CellPhone : contactinfoUserBO.CellPhone;
        //            contactinfoDB.EmailAddress = IsEditMode == true && contactinfoUserBO.EmailAddress == null ? contactinfoDB.EmailAddress : contactinfoUserBO.EmailAddress;
        //            contactinfoDB.HomePhone = IsEditMode == true && contactinfoUserBO.HomePhone == null ? contactinfoDB.HomePhone : contactinfoUserBO.HomePhone;
        //            contactinfoDB.WorkPhone = IsEditMode == true && contactinfoUserBO.WorkPhone == null ? contactinfoDB.WorkPhone : contactinfoUserBO.WorkPhone;
        //            contactinfoDB.FaxNo = IsEditMode == true && contactinfoUserBO.FaxNo == null ? contactinfoDB.FaxNo : contactinfoUserBO.FaxNo;
        //            contactinfoDB.IsDeleted = IsEditMode == true && contactinfoUserBO.IsDeleted == null ? contactinfoDB.IsDeleted : contactinfoUserBO.IsDeleted;
        //            contactinfoDB.OfficeExtension = IsEditMode == true && contactinfoUserBO.OfficeExtension == null ? contactinfoDB.OfficeExtension : contactinfoUserBO.OfficeExtension;
        //            contactinfoDB.AlternateEmail = IsEditMode == true && contactinfoUserBO.AlternateEmail == null ? contactinfoDB.AlternateEmail : contactinfoUserBO.AlternateEmail;
        //            contactinfoDB.PreferredCommunication = IsEditMode == true && contactinfoUserBO.PreferredCommunication == null ? contactinfoDB.PreferredCommunication : contactinfoUserBO.PreferredCommunication;

        //            if (Add_contactinfoDB == true) contactinfoDB = _context.ContactInfoes.Add(contactinfoDB);
        //            _context.SaveChanges();
        //        }
        //        else
        //        {
        //            if (IsEditMode == false)
        //            {
        //                dbContextTransaction.Rollback();
        //                return new BO.ErrorObject { errorObject = "", ErrorMessage = "Please pass valid address details.", ErrorLevel = ErrorLevel.Error };
        //            }
        //            contactinfoDB = null;
        //        }
        //        #endregion

        //        #region User
        //        if (userBO != null)
        //        {
        //            bool Add_userDB = false;
        //            userDB = _context.Users.Where(p => p.id == userBO.ID).FirstOrDefault();

        //            if (userDB == null && userBO.ID <= 0)
        //            {
        //                userDB = new User();
        //                Add_userDB = true;
        //                sendEmail = true;
        //            }
        //            else if (userDB == null && userBO.ID > 0)
        //            {
        //                dbContextTransaction.Rollback();
        //                return new BO.ErrorObject { errorObject = "", ErrorMessage = "User Name dosent exists.", ErrorLevel = ErrorLevel.Error };
        //            }

        //            if (Add_userDB == true)
        //            {
        //                if (_context.Users.Any(p => p.UserName == userBO.UserName))
        //                {
        //                    dbContextTransaction.Rollback();
        //                    return new BO.ErrorObject { errorObject = "", ErrorMessage = "User Name already exists.", ErrorLevel = ErrorLevel.Error };
        //                }
        //            }

        //            userDB.UserName = Add_userDB == true ? userBO.UserName : userDB.UserName;
        //            userDB.FirstName = IsEditMode == true && userBO.FirstName == null ? userDB.FirstName : userBO.FirstName;
        //            userDB.MiddleName = IsEditMode == true && userBO.MiddleName == null ? userDB.MiddleName : userBO.MiddleName;
        //            userDB.LastName = IsEditMode == true && userBO.LastName == null ? userDB.LastName : userBO.LastName;
        //            userDB.Gender = (IsEditMode == true && userBO.Gender <= 0) ? userDB.Gender : System.Convert.ToByte(userBO.Gender);
        //            userDB.UserType = Add_userDB == true ? System.Convert.ToByte(BO.GBEnums.UserType.Attorney) : userDB.UserType;
        //            userDB.UserStatus = System.Convert.ToByte(userBO.Status);
        //            userDB.ImageLink = IsEditMode == true && userBO.ImageLink == null ? userDB.ImageLink : userBO.ImageLink;
        //            userDB.DateOfBirth = IsEditMode == true && userBO.DateOfBirth == null ? userDB.DateOfBirth : userBO.DateOfBirth;

        //            if (Add_userDB == true && string.IsNullOrEmpty(userBO.Password) == false) userDB.Password = PasswordHash.HashPassword(userBO.Password);

        //            //userDB.AddressId = addressUserDB.id;
        //            userDB.AddressId = (addressUserDB != null && addressUserDB.id > 0) ? addressUserDB.id : userDB.AddressId;
        //            //userDB.ContactInfoId = contactinfoDB.id;
        //            userDB.ContactInfoId = (contactinfoDB != null && contactinfoDB.id > 0) ? contactinfoDB.id : userDB.ContactInfoId;

        //            userDB.C2FactAuthEmailEnabled = System.Convert.ToBoolean(Utility.GetConfigValue("Default2FactEmail"));
        //            userDB.C2FactAuthSMSEnabled = System.Convert.ToBoolean(Utility.GetConfigValue("Default2FactSMS"));

        //            userDB.CreateByUserID = Add_userDB == true ? userBO.CreateByUserID : userDB.CreateByUserID;
        //            userDB.CreateDate = Add_userDB == true ? DateTime.UtcNow : userDB.CreateDate;

        //            userDB.UpdateByUserID = Add_userDB == false ? userBO.UpdateByUserID : userDB.UpdateByUserID;
        //            userDB.UpdateDate = Add_userDB == false ? DateTime.UtcNow : userDB.UpdateDate;

        //            if (Add_userDB == true) userDB = _context.Users.Add(userDB);
        //            _context.SaveChanges();
        //        }
        //        else
        //        {
        //            if (IsEditMode == false)
        //            {
        //                dbContextTransaction.Rollback();
        //                return new BO.ErrorObject { errorObject = "", ErrorMessage = "Please pass valid user details.", ErrorLevel = ErrorLevel.Error };
        //            }
        //            userDB = null;
        //        }
        //        #endregion

        //        #region Attorney
        //        if (addAttorneyBO != null)
        //        {
        //            bool Add_attorneyDB = false;
        //            _attny = _context.Attorneys.Where(p => p.Id == addAttorneyBO.ID).FirstOrDefault();

        //            if (_attny == null && addAttorneyBO.ID <= 0 && IsEditMode == false)
        //            {
        //                _attny = new Attorney();
        //                Add_attorneyDB = true;
        //            }
        //            else if (_attny == null && addAttorneyBO.ID > 0)
        //            {
        //                dbContextTransaction.Rollback();
        //                return new BO.ErrorObject { errorObject = "", ErrorMessage = "Attorney dosent exists.", ErrorLevel = ErrorLevel.Error };
        //            }

        //            _attny.Id = IsEditMode == false ? userDB.id : addAttorneyBO.ID;
        //            _attny.IsDeleted = addAttorneyBO.IsDeleted.HasValue ? addAttorneyBO.IsDeleted : false;

        //            if (Add_attorneyDB == true) _attny = _context.Attorneys.Add(_attny);
        //            _context.SaveChanges();
        //        }
        //        else
        //        {
        //            if (IsEditMode == false)
        //            {
        //                dbContextTransaction.Rollback();
        //                return new BO.ErrorObject { errorObject = "", ErrorMessage = "Please pass valid attorney details.", ErrorLevel = ErrorLevel.Error };
        //            }
        //            _attny = null;
        //        }

        //        _context.SaveChanges();
        //        #endregion

        //        #region User Companies
        //        if (addAttorneyBO.User.UserCompanies != null)
        //        {
        //            bool add_UserCompany = false;

        //            Company companyDB = new Company();

        //            foreach (var userCompany in addAttorneyBO.User.UserCompanies)
        //            {
        //                userCompany.UserId = userDB.id;
        //                UserCompanyDB = _context.UserCompanies.Where(p => p.UserID == userDB.id && p.CompanyID == userCompany.Company.ID && p.IsAccepted==true && (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false)))
        //                                                       .FirstOrDefault<UserCompany>();

        //                if (UserCompanyDB == null)
        //                {
        //                    UserCompanyDB = new UserCompany();
        //                    add_UserCompany = true;
        //                }

        //                UserCompanyDB.CompanyID = userCompany.Company.ID;
        //                UserCompanyDB.UserID = userCompany.UserId;
        //                if (add_UserCompany)
        //                {
        //                    _context.UserCompanies.Add(UserCompanyDB);
        //                }
        //                _context.SaveChanges();
        //            }

        //        }
        //        #endregion

        //        #region Insert Invitation
        //        if (sendEmail == true)
        //        {
        //            Invitation invitationDB = new Invitation();
        //            invitationDB.User = userDB;

        //            invitationDB_UniqueID = Guid.NewGuid();
        //            invitationDB.UniqueID = invitationDB_UniqueID;
        //            invitationDB.CompanyID = UserCompanyDB.CompanyID != 0 ? UserCompanyDB.CompanyID : 0;
        //            invitationDB.CreateDate = DateTime.UtcNow;
        //            invitationDB.CreateByUserID = userDB.id;
        //            _context.Invitations.Add(invitationDB);
        //            _context.SaveChanges();
        //        }
        //        #endregion

        //        dbContextTransaction.Commit();

        //        _attny = _context.Attorneys.Include("User")
        //                                   .Include("User.AddressInfo")
        //                                   .Include("User.ContactInfo")
        //                                   .Include("User.UserCompanies")
        //                                   .Where(p => p.Id == _attny.Id && (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false)))
        //                                   .FirstOrDefault<Attorney>();
        //        #region Send Email
        //        if (sendEmail == true)
        //        {
        //            try
        //            {
        //                string VerificationLink = "<a href='" + Utility.GetConfigValue("VerificationLink") + "/" + invitationDB_UniqueID + "' target='_blank'>" + Utility.GetConfigValue("VerificationLink") + "/" + invitationDB_UniqueID + "</a>";
        //                string Message = "Dear " + userBO.FirstName + ",<br><br>Thanks for registering with us.<br><br> Your user name is:- " + userBO.UserName + "<br><br> Please confirm your account by clicking below link in order to use.<br><br><b>" + VerificationLink + "</b><br><br>Thanks";
        //                BO.Email objEmail = new BO.Email { ToEmail = userBO.UserName, Subject = "User registered", Body = Message };
        //                objEmail.SendMail();

        //            }
        //            catch (Exception ex) { }
        //        }
        //        #endregion

        //        BO.AttorneyMaster res = Convert<BO.AttorneyMaster, Attorney>(_attny);
        //        return (object)res;
        //    }
        //}
        //#endregion

        //#region AssociateAttorneyWithCompany
        //public override object AssociateAttorneyWithCompany(int AttorneyId , int CompanyId)
        //{
        //    bool add_UserCompany = false;
        //    bool sendEmail = false;
        //    Guid invitationDB_UniqueID = Guid.NewGuid();
        //    BO.AttorneyMaster addAttorneyBO = new BO.AttorneyMaster();
        //    BO.User userBO = addAttorneyBO.User;


        //    var company = _context.Companies.Where(p => p.id == CompanyId && (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false))).FirstOrDefault();

        //    if (company == null)
        //    {
        //        return new BO.ErrorObject { ErrorMessage = "No record found for this Company.", errorObject = "", ErrorLevel = ErrorLevel.Error };
        //    }

        //    var attorneys = _context.Attorneys.Where( p => p.Id == AttorneyId && (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false))).FirstOrDefault();

        //    if (attorneys == null)
        //    {
        //        return new BO.ErrorObject { ErrorMessage = "No record found for this Attorney.", errorObject = "", ErrorLevel = ErrorLevel.Error };
        //    }

        //    var userCompany = _context.UserCompanies.Where( p => p.UserID == AttorneyId && p.CompanyID == CompanyId && p.IsAccepted ==true && (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false))).FirstOrDefault();

        //    if (userCompany == null)
        //    {
        //        userCompany = new UserCompany();
        //        add_UserCompany = true;
        //        sendEmail = true;
        //    }

        //    userCompany.CompanyID = CompanyId;
        //    userCompany.UserID = AttorneyId;

        //    if (add_UserCompany)
        //    {
        //        _context.UserCompanies.Add(userCompany);
        //    }

        //    _context.SaveChanges();

        //    var _attny = _context.Attorneys.Include("User")
        //                               .Include("User.AddressInfo")
        //                               .Include("User.ContactInfo")
        //                               .Include("User.UserCompanies")
        //                               .Where(p => p.Id == AttorneyId && (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false)))
        //                               .FirstOrDefault<Attorney>();

        //    #region Send Email
        //    if (sendEmail == true)
        //    {
        //        try
        //        {
        //            string VerificationLink = "<a href='" + Utility.GetConfigValue("VerificationLink") + "/" + invitationDB_UniqueID + "' target='_blank'>" + Utility.GetConfigValue("VerificationLink") + "/" + invitationDB_UniqueID + "</a>";
        //            string Message = "Dear " + _attny.User.FirstName + ",<br><br>Thanks for registering with us.<br><br> Your user name is:- " + _attny.User.UserName + "<br><br> Please confirm your account by clicking below link in order to use.<br><br><b>" + VerificationLink + "</b><br><br>Thanks";
        //            BO.Email objEmail = new BO.Email { ToEmail = _attny.User.UserName, Subject = "User registered", Body = Message };
        //            objEmail.SendMail();

        //        }
        //        catch (Exception ex) { }
        //    }
        //    #endregion

        //    var res = Convert<BO.AttorneyMaster, Attorney>(_attny);
        //    return (object)res;

        //}
        //#endregion

        //#region DisassociateAttorneyWithCompany
        //public override object DisassociateAttorneyWithCompany(int AttorneyId, int CompanyId)
        //{
        //    var company = _context.Companies.Where(p => p.id == CompanyId && (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false))).FirstOrDefault();

        //    if (company == null)
        //    {
        //        return new BO.ErrorObject { ErrorMessage = "No record found for this Company.", errorObject = "", ErrorLevel = ErrorLevel.Error };
        //    }

        //    var attorneys = _context.Attorneys.Where(p => p.Id == AttorneyId && (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false))).FirstOrDefault();

        //    if (attorneys == null)
        //    {
        //        return new BO.ErrorObject { ErrorMessage = "No record found for this Attorney.", errorObject = "", ErrorLevel = ErrorLevel.Error };
        //    }

        //    var userCompany = _context.UserCompanies.Where(p => p.UserID == AttorneyId && p.CompanyID == CompanyId && (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false))).FirstOrDefault();

        //    if (userCompany != null)
        //    {
        //        userCompany.IsDeleted = true;
        //    }

        //    _context.SaveChanges();

        //    var _attny = _context.Attorneys.Include("User")
        //                               .Include("User.AddressInfo")
        //                               .Include("User.ContactInfo")
        //                               .Include("User.UserCompanies")
        //                               .Where(p => p.Id == AttorneyId && (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false)))
        //                               .FirstOrDefault<Attorney>();

        //    var res = Convert<BO.AttorneyMaster, Attorney>(_attny);
        //    return (object)res;

        //}
        //#endregion

        ////AttorneyProvider

        //#region Company Conversion
        //public T CompanyConvert<T, U>(U entity)
        //{
        //    Company company = entity as Company;
        //    if (company == null)
        //        return default(T);

        //    BO.Company boCompany = new BO.Company();

        //    boCompany.ID = company.id;
        //    boCompany.Name = company.Name;
        //    boCompany.TaxID = company.TaxID;
        //    boCompany.Status = (BO.GBEnums.AccountStatus)company.Status;
        //    boCompany.CompanyType = (BO.GBEnums.CompanyType)company.CompanyType;
        //    boCompany.SubsCriptionType = (BO.GBEnums.SubsCriptionType)company.SubscriptionPlanType;
        //    boCompany.RegistrationComplete = company.RegistrationComplete;
        //    boCompany.IsDeleted = company.IsDeleted;
        //    boCompany.CreateByUserID = company.CreateByUserID;
        //    boCompany.UpdateByUserID = company.UpdateByUserID;


        //    return (T)(object)boCompany;
        //}
        //#endregion

        //#region AttorneyProviderConvert
        //public T AttorneyProviderConvert<T, U>(U entity)
        //{

        //    AttorneyProvider attorneyProvider = entity as AttorneyProvider;
        //    if (attorneyProvider == null)
        //        return default(T);

        //    BO.AttorneyProvider boAttorneyProvider = new BO.AttorneyProvider();

        //    boAttorneyProvider.ID = attorneyProvider.Id;
        //    boAttorneyProvider.AttorneyProviderId = attorneyProvider.AttorneyProviderId;
        //    boAttorneyProvider.CompanyId = attorneyProvider.CompanyId;
        //    boAttorneyProvider.IsDeleted = attorneyProvider.IsDeleted;
        //    boAttorneyProvider.CreateByUserID = attorneyProvider.CreateByUserID;
        //    boAttorneyProvider.UpdateByUserID = attorneyProvider.UpdateByUserID;

        //    if (attorneyProvider.Company != null)
        //    {
        //        BO.Company Company = new BO.Company();

        //        if (attorneyProvider.Company.IsDeleted.HasValue == false
        //            || (attorneyProvider.Company.IsDeleted.HasValue == true && attorneyProvider.Company.IsDeleted.Value == false))
        //        {
        //            using (CompanyRepository sr = new CompanyRepository(_context))
        //            {
        //                Company = sr.Convert<BO.Company, Company>(attorneyProvider.Company);
        //                Company.Locations = null;
        //            }
        //        }

        //        boAttorneyProvider.Company = Company;
        //    }

        //    if (attorneyProvider.Company1 != null)
        //    {
        //        BO.Company Company = new BO.Company();

        //        if (attorneyProvider.Company1.IsDeleted.HasValue == false
        //            || (attorneyProvider.Company1.IsDeleted.HasValue == true && attorneyProvider.Company1.IsDeleted.Value == false))
        //        {
        //            using (CompanyRepository sr = new CompanyRepository(_context))
        //            {
        //                Company = sr.Convert<BO.Company, Company>(attorneyProvider.Company1);
        //                Company.Locations = null;
        //            }
        //        }

        //        boAttorneyProvider.AtorneyProvider = Company;
        //    }

        //    return (T)(object)boAttorneyProvider;
        //}
        //#endregion

        //#region Associate Attorney Provider With Company
        //public override object AssociateAttorneyProviderWithCompany(int AttorneyProviderId, int CompanyId)
        //{
        //    Company CompanyDB = _context.Companies.Where(p => p.id == CompanyId
        //                                           && (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false)))
        //                                           .FirstOrDefault();

        //    if (CompanyDB == null)
        //    {
        //        return new BO.ErrorObject { ErrorMessage = "Company dosent exists.", errorObject = "", ErrorLevel = ErrorLevel.Information };
        //    }

        //    Company AttorneyProviderCompanyDB = _context.Companies.Where(p => p.id == AttorneyProviderId
        //                                                 && (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false)))
        //                                                .FirstOrDefault();

        //    if (AttorneyProviderCompanyDB == null)
        //    {
        //        return new BO.ErrorObject { ErrorMessage = "AttorneyProvider Company dosent exists.", errorObject = "", ErrorLevel = ErrorLevel.Information };
        //    }
        //    else if (AttorneyProviderCompanyDB != null && AttorneyProviderCompanyDB.CompanyType != (int)BO.GBEnums.CompanyType.Attorney)
        //    {
        //        return new BO.ErrorObject { ErrorMessage = "Preferred AttorneyProviderId is not of company type Attorney.", errorObject = "", ErrorLevel = ErrorLevel.Information };
        //    }

        //    var AttorneyProviderDB = _context.AttorneyProviders.Where(p => p.AttorneyProviderId == AttorneyProviderId && p.CompanyId == CompanyId
        //                                                        && (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false)))
        //                                                       .FirstOrDefault();

        //    bool AttorneyProvider = false;
        //    if (AttorneyProviderDB == null)
        //    {
        //        AttorneyProviderDB = new AttorneyProvider();
        //        AttorneyProvider = true;
        //    }

        //    AttorneyProviderDB.AttorneyProviderId = AttorneyProviderId;
        //    AttorneyProviderDB.CompanyId = CompanyId;
        //    AttorneyProviderDB.IsDeleted = false;

        //    if (AttorneyProvider == true)
        //    {
        //        _context.AttorneyProviders.Add(AttorneyProviderDB);
        //    }

        //    _context.SaveChanges();

        //    BO.AttorneyProvider acc_ = AttorneyProviderConvert<BO.AttorneyProvider, AttorneyProvider>(AttorneyProviderDB);

        //    if (acc_ == null)
        //    {
        //        return new BO.ErrorObject { ErrorMessage = "No record found.", errorObject = "", ErrorLevel = ErrorLevel.Error };
        //    }

        //    return (object)acc_;
        //}
        //#endregion

        //#region Get All Attorney Provider Exclude Assigned
        //public override object GetAllAttorneyProviderExcludeAssigned(int CompanyId)
        //{
        //    var AssignedAttorneyProvider = _context.AttorneyProviders.Where(p => p.CompanyId == CompanyId
        //                                                              && (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false)))
        //                                                              .Select(p => p.AttorneyProviderId);

        //    var companies = _context.Companies.Where(p => AssignedAttorneyProvider.Contains(p.id) == false
        //                                       && p.CompanyType == 2
        //                                       && (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false)))
        //                                      .ToList();



        //    List<BO.Company> lstCompany = new List<BO.Company>();

        //    if (companies == null)
        //    {
        //        return new BO.ErrorObject { ErrorMessage = "No record found for this Company Id.", errorObject = "", ErrorLevel = ErrorLevel.Error };
        //    }
        //    else
        //    {
        //        companies.ForEach(item => lstCompany.Add(CompanyConvert<BO.Company, Company>(item)));
        //    }

        //    return lstCompany;
        //}
        //#endregion

        //#region Get Attorney Provider By Company ID
        //public override object GetAttorneyProviderByCompanyId(int CompanyId)
        //{
        //    var AttorenyProvider = _context.AttorneyProviders.Include("Company")
        //                                                     .Include("Company1")
        //                                                     .Where(p => p.CompanyId == CompanyId && (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false)))
        //                                                            .ToList();

        //    List<BO.AttorneyProvider> lstprovider = new List<BO.AttorneyProvider>();

        //    if (AttorenyProvider == null)
        //    {
        //        return new BO.ErrorObject { ErrorMessage = "No record found for this companyId.", errorObject = "", ErrorLevel = ErrorLevel.Error };
        //    }
        //    else
        //    {
        //        AttorenyProvider.ForEach(item => lstprovider.Add(AttorneyProviderConvert<BO.AttorneyProvider, AttorneyProvider>(item)));
        //    }

        //    return lstprovider;
        //}
        //#endregion


        #region Delete By ID
        public override object Delete(int id)
        {
            Attorney attorney = new Attorney();

            using (var dbContextTransaction = _context.Database.BeginTransaction())
            {
                attorney = _context.Attorneys.Include("User").Include("User.AddressInfo").Include("User.ContactInfo").Where(p => p.Id == id && (p.IsDeleted == false || p.IsDeleted == null)).FirstOrDefault();

                if (attorney != null)
                {
                    attorney.IsDeleted                  = true;
                    attorney.User.IsDeleted             = true;
                    attorney.User.AddressInfo.IsDeleted = true;
                    attorney.User.ContactInfo.IsDeleted = true;
                    _context.SaveChanges();
                }
                else
                {
                    dbContextTransaction.Rollback();
                    return(new BO.ErrorObject {
                        errorObject = "", ErrorMessage = "Attorney details dosent exists.", ErrorLevel = ErrorLevel.Error
                    });
                }

                dbContextTransaction.Commit();
            }
            var res = Convert <BO.AttorneyMaster, Attorney>(attorney);

            return((object)res);
        }
コード例 #3
0
        private static VipAttorney GetlVipAttorneyWith(PersonInfo personInfo)
        {
            var attorney    = new Attorney(personInfo);
            var vipAttorney = attorney.CreateVip(1, new Organization("1", 1, 1));

            return(vipAttorney);
        }
コード例 #4
0
        public string savefp_password(string password, string emailId)
        {
            Login user = userlist.FirstOrDefault(x => x.Email == emailId);

            if (password.Length > 6 && user.Email == emailId)
            {
                int id = Int32.Parse(user.Account_Id);
                //update password in tables
                user.Password = password;
                if (user.Account_type == "attorney")
                {
                    Attorney at = attorney.FirstOrDefault(x => x.Attorney_ID == id);
                    at.Attorney_Password = password;
                }
                else if (user.Account_type == "client")
                {
                    Client cl = clientlist.FirstOrDefault(x => x.Client_ID == id);
                    cl.Client_Password = password;
                }
                return("1");
            }
            else
            {
                return("0");
            }
        }
コード例 #5
0
        public bool Attorney_Step1_Validator(Attorney attorney)
        {
            bool check = true;

            if (!ModelState.IsValidField("Attorney_Name"))
            {
                check = false;
            }
            else if (!ModelState.IsValidField("Attorney_Email"))
            {
                check = false;
            }
            else if (!ModelState.IsValidField("Attorney_Password"))
            {
                check = false;
            }
            else if (!ModelState.IsValidField("Attorney_ConfirmPassword"))
            {
                check = false;
            }
            else if (!ModelState.IsValidField("Attorney_City"))
            {
                check = false;
            }
            else if (!ModelState.IsValidField("Attorney_Number"))
            {
                check = false;
            }
            else
            {
                check = true;
            }
            return(check);
        }
コード例 #6
0
        public ActionResult attorney_details(int Id)
        {
            Attorney frnds = new Attorney();

            frnds = attorney.Find(x => x.Attorney_ID == Id);
            return(PartialView(frnds));
        }
コード例 #7
0
        public int InsertAttorney(Attorney attorney)
        {
            db.Attorneys.Add(attorney);
            db.SaveChanges();

            return(attorney.Id);
        }
コード例 #8
0
        public JsonResult ModalCreateSave(Attorney newAtty)
        {
            _context.AddAttorney(newAtty);
            var jsonResult = Json(newAtty);

            return(new JsonResult(jsonResult));
        }
コード例 #9
0
        public ActionResult GetAttorneyByID(int _attorneyID)
        {
            var      _attorneyDetails = _iPaticipantService.getAttorneyByID(_attorneyID);
            Attorney objAttorneyModel = new Attorney();

            objAttorneyModel = Mapper.Map <Attorney>(_attorneyDetails);
            return(Json(objAttorneyModel));
        }
コード例 #10
0
        // POST: api/Attornies
        public IHttpActionResult Post([FromBody] Attorney a)
        {
            a.UserId = "b05c5fcc-f7cf-4111-a77b-cdea8c56cf7b";

            int id = AttorneyRepository.InsertAttorney(a);

            return(Ok(id));
        }
コード例 #11
0
        public PartialViewResult CreatePartial()
        {
            var model = new Attorney
            {
                IsAssigningAttorney = false,
                RecruitmentDate     = DateTime.Today
            };

            return(PartialView("_AttorneyCreate", model));
        }
コード例 #12
0
 public static AttorneyVM GetAttorneyFromModel(Attorney obj)
 {
     return(new AttorneyVM
     {
         AttorneyId = obj.AttorneyId,
         UserName = obj.User.UserName,
         DisplayName = obj.User.DisplayName,
         FirstName = obj.User.FirstName,
         LastName = obj.User.LastName,
         Active = obj.User.Active,
         UserId = obj.UserId
     });
 }
コード例 #13
0
        public bool Accounts_Setting_Verification_Attorney(Attorney attorney)
        {
            bool check = true;

            if (!ModelState.IsValidField("Attorney_Name"))
            {
                check = false;
            }
            else if (!ModelState.IsValidField("Attorney_DOB"))
            {
                check = false;
            }

            else if (!ModelState.IsValidField("Attorney_City"))
            {
                check = false;
            }
            else if (!ModelState.IsValidField("Attorney_Number"))
            {
                check = false;
            }
            else if (!ModelState.IsValidField("Attorney_Education"))
            {
                check = false;
            }
            else if (!ModelState.IsValidField("Attorney_Experience"))
            {
                check = false;
            }
            else if (!ModelState.IsValidField("Attorney_Cases"))
            {
                check = false;
            }
            else if (!ModelState.IsValidField("Attorney_Languages"))
            {
                check = false;
            }
            else if (!ModelState.IsValidField("Attorney_Firm"))
            {
                check = false;
            }
            else if (!ModelState.IsValidField("Attorney_Certification"))
            {
                check = false;
            }
            else
            {
                check = true;
            }
            return(check);
        }
コード例 #14
0
        public ActionResult DeleteConfirmed(int id)
        {
            userID = User.Identity.GetUserId();

            Attorney attorney = db.Attorneys.Find(id);

            if (attorney == null || attorney.UserId != userID)
            {
                return(HttpNotFound());
            }
            db.Attorneys.Remove(attorney);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #15
0
        public JsonResult ban_attorney(int EmployeeId)
        {
            bool     result = false;
            Attorney at     = attorney.Where(x => x.Attorney_ID == EmployeeId).SingleOrDefault();

            if (at != null)
            {
                at.Block = "0";

                result = true;
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
コード例 #16
0
ファイル: AttorneyTest.cs プロジェクト: buyonlinemahi/MMC
        public void updateAttorneys()
        {
            Attorney _attorney = new Attorney
            {
                AttorneyName   = "RajaTara",
                AttPhone       = "9875656345",
                AttorneyFirmID = 2,
                AttorneyID     = 2,
                AttFax         = "6524998786",
                AttEmail       = "*****@*****.**"
            };
            var _id = _attorneyRepository.addAttorney(_attorney);

            Assert.IsTrue(_id > 0, "failed");
        }
コード例 #17
0
        public ActionResult Create([Bind(Include = "Id,FirstName,LastName,AFM,City")] Attorney attorney)
        {
            userID = User.Identity.GetUserId();

            if (ModelState.IsValid)
            {
                AttorneyRepository.InsertAttorney(userID,
                                                  attorney.FirstName,
                                                  attorney.LastName,
                                                  attorney.AFM,
                                                  attorney.City);
                return(RedirectToAction("Index"));
            }

            return(View(attorney));
        }
コード例 #18
0
        public ActionResult Details(int?id)
        {
            userID = User.Identity.GetUserId();

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Attorney attorney = db.Attorneys.Find(id);

            if (attorney == null || attorney.UserId != userID)
            {
                return(HttpNotFound());
            }
            return(View(attorney));
        }
コード例 #19
0
        public int InsertAttorney(string userID,
                                  string FirstName,
                                  string LastName,
                                  string AFM,
                                  string City)
        {
            Attorney attorney = new Attorney
            {
                UserId    = userID,
                FirstName = FirstName,
                LastName  = LastName,
                AFM       = AFM,
                City      = City
            };

            return(InsertAttorney(attorney));
        }
コード例 #20
0
        public ActionResult Edit([Bind(Include = "Id,FirstName,LastName,AFM,City")] Attorney attorney)
        {
            userID = User.Identity.GetUserId();

            Attorney attorneyToEdit = db.Attorneys.Find(attorney.Id);

            if (ModelState.IsValid && attorneyToEdit.UserId == userID)
            {
                attorneyToEdit.FirstName = attorney.FirstName;
                attorneyToEdit.LastName  = attorney.LastName;
                attorneyToEdit.AFM       = attorney.AFM;
                attorneyToEdit.City      = attorney.City;

                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(attorney));
        }
コード例 #21
0
 public IActionResult New(Attorney attorney)
 {
     if (!_usersRepo.VerifyUsername(attorney.User.Username))
     {
         ModelState.AddModelError("uqUsername", "El usuario ingresado ya existe");
     }
     if (!_attorneysRepo.VerifyEmail(attorney.Email))
     {
         ModelState.AddModelError("uqEmail", "El correo ingresado ya existe");
     }
     if (!_attorneysRepo.VerifyNotaryCode(attorney.NotaryCode))
     {
         ModelState.AddModelError("uqNotaryCode", "El código de notario ingresado ya existe");
     }
     //if(attorney.User.Username.Contains(" "))
     //{
     //    ModelState.AddModelError("whiteSpacesUsername", "El nombre de usuario contiene espacios en blanco, favor no incluir espacios en blanco");
     //}
     if (!ModelState.IsValid)
     {
         NewAttorneyViewModel viewModel = new NewAttorneyViewModel
         {
             Departments = _departmentsRepo.Departments.ToList()
         };
         viewModel.Attorney = attorney;
         return(View(viewModel));
     }
     else
     {
         //string guidGenerated = _guidManager.GenerateGuid();
         //string passwordDefault = guidGenerated.Substring(guidGenerated.Length - 12, 12);
         string passwordOriginal = attorney.User.Password;
         string passwordHashed   = _cryptoManager.HashString(attorney.User.Password);
         attorney.User.Password = passwordHashed;
         _attorneysRepo.Save(attorney);
         //Envío de password sin hash al usuario
         string emailBody = $"Se le ha creado un acceso a la aplicación Lexincorp Nicaragua Web, su usuario es {attorney.User.Username} " +
                            $"y su clave de acceso es {passwordOriginal}. \n**Este es un mensaje autogenerado por el sistema, favor no responder**";
         _mailSender.SendMail(attorney.Email, "Usuario web creado para aplicación Lexincorp Nicaragua Web", emailBody);
         TempData["added"] = true;
         return(RedirectToAction("New"));
     }
 }
コード例 #22
0
        public ActionResult attorney()
        {
            Attorney atr = new Attorney {
                Attorney_Name          = "Mohammad Kamran Ali",
                Attorney_Email         = "*****@*****.**",
                Attorney_Country       = "Pakistan",
                Attorney_City          = "Islamabad",
                Attorney_Number        = "+923314859236",
                Attorney_Gender        = "Male",
                Attorney_Role          = "Criminal Attorney",
                Attorney_DOB           = "28 March 1978",
                Attorney_Certification = "Advanced Legal Research",
                Attorney_Firm          = "Pearson Hardman, Cambridge, Massachusetts",
                Attorney_Education     = "Harvard University, Cambridge, Massachusetts",
                Attorney_Experience    = "12",
                Attorney_Cases         = "15",
                Attorney_Languages     = "English, Spanish, French"
            };

            return(View(atr));
        }
コード例 #23
0
 public IActionResult Edit(Attorney attorney)
 {
     TempData.Keep();
     if (!_usersRepo.VerifyUsername(attorney.User.Username) && !_usersRepo.VerifyAttorneyIDAndUsername(attorney.Id, attorney.UserId))
     {
         ModelState.AddModelError("uqUsername", "El usuario ingresado ya existe");
     }
     if (!_attorneysRepo.VerifyEmail(attorney.Email) && !_attorneysRepo.VerifyAttorneyIDAndEmailOwnership(attorney.Id, attorney.Email))
     {
         ModelState.AddModelError("uqEmail", "El correo ingresado ya existe");
     }
     if (!_attorneysRepo.VerifyNotaryCode(attorney.NotaryCode) && !_attorneysRepo.verifyAttorneyIDAndNotaryCodeOwnership(attorney.Id, attorney.NotaryCode))
     {
         ModelState.AddModelError("uqNotaryCode", "El código de notario ingresado ya existe");
     }
     if (!ModelState.IsValid)
     {
         NewAttorneyViewModel viewModel = new NewAttorneyViewModel
         {
             Departments = _departmentsRepo.Departments.ToList()
         };
         viewModel.Attorney = attorney;
         return(View(viewModel));
     }
     else
     {
         bool passwordModified = false;
         if (attorney.User.Password != null && (attorney.User.Password != " " || attorney.User.Password != ""))
         {
             passwordModified = true;
             string passwordOriginal = attorney.User.Password;
             string passwordHashed   = _cryptoManager.HashString(attorney.User.Password);
             attorney.User.Password = passwordHashed;
         }
         _attorneysRepo.Save(attorney, passwordModified);
         _usersRepo.Save(attorney.User);
         TempData["updated"] = true;
         return(RedirectToAction("Admin", new { filter = TempData["filter"] }));
     }
 }
コード例 #24
0
        public string match_password(string password)
        {
            bool   check       = false;
            Login  user        = (Login)Session["User"];
            int    accountid   = 1;
            string Accounttype = "client";

            if (Accounttype == "attorney")
            {
                Attorney at = attorney.FirstOrDefault(x => x.Attorney_ID == accountid);
                if (at.Attorney_Password == password)
                {
                    check = true;
                }
            }
            else if (Accounttype == "client")
            {
                Client cl = clientlist.FirstOrDefault(x => x.Client_ID == accountid);
                if (cl.Client_Password == password)
                {
                    check = true;
                }
            }
            else
            {
                check = false;
            }


            if (check == true)
            {
                return("1");
            }
            else
            {
                return("0");
            }
        }
コード例 #25
0
        public ActionResult SaveAttorneyDetail(Attorney objAttorneyModel)
        {
            var _message = GlobalConst.ConstantChar.StringBlank;

            try
            {
                if (objAttorneyModel.AttorneyID == GlobalConst.ConstantChar.Zero)
                {
                    _iPaticipantService.addAttorney(Mapper.Map <MMCService.PaticipantService.Attorney>(objAttorneyModel));
                    _message = GlobalConst.Message.SaveMessage;
                }
                else
                {
                    _iPaticipantService.updateAttorney(Mapper.Map <MMCService.PaticipantService.Attorney>(objAttorneyModel));
                    _message = GlobalConst.Message.UpdateMessage;
                }
            }
            catch
            {
                _message = GlobalConst.Message.ErrorMessage;
            }
            return(Json(_message));
        }
コード例 #26
0
        private Attorney BuildAttorney(IDbUser dbUser, List <string> blackListedFaxNumbers)
        {
            var attorney = AdUserService.GetUserById(dbUser.AttorneyUserID);

            if (attorney == null)
            {
                return(null);
            }

            var previousAssistant = AdUserService.GetUserById(dbUser.PreviousAssistantUserId);
            var currentAssistant  = AdUserService.GetUserById(dbUser.CurrentAssistantUserId);
            var newAssistant      = AdUserService.GetUserById(attorney.AssistantId);

            var attorneyObject = new Attorney(attorney.UserId, attorney.DisplayName, attorney.Disabled, attorney.Excluded);

            if (dbUser.PreviousAssistantUserId.IsNotEmpty())
            {
                attorneyObject.SetPreviousAssistant(previousAssistant?.UserId ?? dbUser.PreviousAssistantUserId, previousAssistant?.DisplayName ?? "");
            }

            if (dbUser.CurrentAssistantUserId.IsNotEmpty())
            {
                attorneyObject.SetCurrentAssistant(currentAssistant?.UserId ?? dbUser.CurrentAssistantUserId, currentAssistant?.DisplayName ?? "", currentAssistant?.Disabled ?? false);
            }

            if (newAssistant != null)
            {
                attorneyObject.SetNewAssistant(newAssistant.UserId, newAssistant.DisplayName, newAssistant.Disabled);
            }

            attorneyObject.SetFaxNumber(dbUser.PreviousFaxNumber, dbUser.CurrentFaxNumber, blackListedFaxNumbers);
            attorneyObject.SetNewFaxNumber(attorney.FaxNumber, blackListedFaxNumbers);
            attorneyObject.Process();

            return(attorneyObject);
        }
コード例 #27
0
        /* Account Settings Attorney*/
        public ActionResult settings_attorney(string role)
        {
            List <SelectListItem> Country = new List <SelectListItem>()
            {
                new SelectListItem {
                    Text = "Pakistan", Value = "+92"
                },
                new SelectListItem {
                    Text = "America", Value = "+00"
                },
                new SelectListItem {
                    Text = "China", Value = "+77"
                },
            }; ViewBag.Country = Country;

            role = "0";
            if (role.Equals("0"))
            {
                ModelState.AddModelError("Attorney_Role", "please select your role");
            }
            else
            {
                ModelState.AddModelError("Attorney_Role", " ");
            }

            Login    user      = (Login)Session["User"];
            int      accountid = 1;
            Attorney at        = attorney.Find(x => x.Attorney_ID == accountid);
            string   number    = at.Attorney_Number.Substring(3);

            at.Attorney_Number   = number;
            at.Attorney_Password = "";

            ViewBag.LinkText = "reported_accounts";
            return(View(at));
        }
コード例 #28
0
        Attorney GetAttorney()
        {
            if (Detailed.Value && !String.IsNullOrEmpty(AtrNum) && AtrDate.HasValue)
            {
                Attorney ret = new Attorney();
                ret.Number = AtrNum;
                ret.Date   = AtrDate.Value.Value.ToString("dd.MM.yyyy");
                ret.IssuerOrganizationName = AtrOrganization;

                if (!String.IsNullOrEmpty(AtrFirstName.Value) &&
                    !String.IsNullOrEmpty(AtrSurename.Value) &&
                    !String.IsNullOrEmpty(AtrPatronymic.Value))
                {
                    ret.IssuerPerson            = new Official();
                    ret.IssuerPerson.FirstName  = AtrFirstName;
                    ret.IssuerPerson.Surname    = AtrSurename;
                    ret.IssuerPerson.Patronymic = AtrPatronymic;
                    ret.IssuerPerson.JobTitle   = AtrJobTitle;
                    ret.IssuerAdditionalInfo    = AtrAddInfo;
                }
                return(ret);
            }
            return(null);
        }
コード例 #29
0
        public IActionResult Save(Attorney attorney)
        {
            var i = attorney.Id == 0 ? _context.AddAttorney(attorney) : _context.UpdateAttorney(attorney);

            return(RedirectToAction("Details", new { id = attorney.Id }));
        }
コード例 #30
0
        public ActionResult settings_attorney(Attorney at, string role, string ContryName, HttpPostedFileBase imgInp)
        {
            ViewBag.LinkText = "account_Settings";
            List <SelectListItem> Country = new List <SelectListItem>()
            {
                new SelectListItem {
                    Text = "Pakistan", Value = "+92"
                },
                new SelectListItem {
                    Text = "America", Value = "+00"
                },
                new SelectListItem {
                    Text = "China", Value = "+77"
                },
            };

            ViewBag.Country = Country;

            Login    user            = (Login)Session["User"];
            int      accountid       = 1;
            Attorney update_attorney = attorney.Find(x => x.Attorney_ID == accountid);

            if (ContryName == "")
            {
                ContryName = "Pakistan";
                update_attorney.Attorney_Country = "+92";
            }



            update_attorney.Attorney_Number        = update_attorney.Attorney_Country + at.Attorney_Number;
            update_attorney.Attorney_Country       = ContryName;
            update_attorney.Attorney_Role          = role;
            update_attorney.Attorney_Cases         = at.Attorney_Cases;
            update_attorney.Attorney_Certification = at.Attorney_Certification;
            update_attorney.Attorney_City          = at.Attorney_City;
            update_attorney.Attorney_DOB           = at.Attorney_DOB;
            update_attorney.Attorney_Education     = at.Attorney_Education;
            update_attorney.Attorney_Experience    = at.Attorney_Experience;
            update_attorney.Attorney_Firm          = at.Attorney_Firm;
            update_attorney.Attorney_Image         = at.Attorney_Image;
            update_attorney.Attorney_Name          = at.Attorney_Name;
            update_attorney.Attorney_Languages     = at.Attorney_Languages;


            string number = update_attorney.Attorney_Number.Substring(3);

            at.Attorney_Number   = number;
            at.Attorney_Password = "";
            at.Attorney_Email    = update_attorney.Attorney_Email;

            if (Accounts_Setting_Verification_Attorney(at))
            {
                ModelState.Clear();
                if (role.Equals("0"))
                {
                    ModelState.AddModelError("Attorney_Role", "please select your role");
                }
                else
                {
                    ModelState.AddModelError("Attorney_Role", " ");
                    if (imgInp != null)
                    {
                        update_attorney.Attorney_Image = update_attorney.Attorney_Email + Path.GetExtension(imgInp.FileName);
                        imgInp.SaveAs(Server.MapPath("//Content//UserImages//") + update_attorney.Attorney_Image);
                    }
                    TempData["save"] = "<script>alert('update successfully ');</script>";

                    //Update data here
                    return(View(at));
                }
            }

            return(View(at));
        }