コード例 #1
0
        public ActionResult SingalR(Contact1 c)
        {
            pickpackDBEntities dc = new pickpackDBEntities();

            c.AddedOn = DateTime.Now;
            dc.Contact1.Add(c);
            dc.SaveChanges();
            return(View());
        }
コード例 #2
0
ファイル: Bugzilla32148.cs プロジェクト: tytok/maui
        async Task ReadFromDbAsync(Expression <Func <Contact1, bool> > searchExpression = null)
        {
            await Task.Run(() =>
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    // If we want to filter the data, GetItems by expression
                    IList <Contact1> contactEntities = new List <Contact1>();
                    List <ContactViewModel1> data    = new List <ContactViewModel1>();

                    if (contactEntities == null || contactEntities.Count == 0)
                    {
                        // Fill with dummy contacts
                        for (int i = 0; i < 20; i++)
                        {
                            Contact1 contact = new Contact1()
                            {
                                FirstName = "Contact" + i,
                                LastName  = "LastName",
                                Company   = "Company" + i
                            };
                            contactEntities.Add(contact);
                        }
                    }

                    // Create Contact items for the listView
                    foreach (Contact1 contact in contactEntities)
                    {
                        ContactViewModel1 contactItem = new ContactViewModel1()
                        {
                            FirstName = contact.FirstName,
                            LastName  = contact.LastName,
                            FullName  = contact.FirstName + " " + contact.LastName,
                            Company   = contact.Company,
                        };

                        data.Add(contactItem);
                    }

                    // Sort, order and group the contacts
                    var contacts = from contact in data
                                   orderby contact.LastName, contact.FirstName
                    group contact by contact.FirstNameSort into contactGroup
                    select new Grouping1 <string, ContactViewModel1>(contactGroup.Key, contactGroup);

                    // Create a new collection of groups
                    var grouppedContacts = new ObservableCollection <Grouping1 <string, ContactViewModel1> >(contacts);

                    _contactsListView.ItemsSource = grouppedContacts;
                });
            });
        }
コード例 #3
0
        /// <summary>
        /// Provides add capabilities to database table
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddNewContactButton_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(FirstNameAddTextBox.Text) && !string.IsNullOrWhiteSpace(LastNameAddTextBox.Text))
            {
                var contact = new Contact1()
                {
                    FirstName = FirstNameAddTextBox.Text,
                    LastName  = LastNameAddTextBox.Text
                };

                _context.Add(contact);
                _context.SaveChanges();
                _bindingListContacts.Add(contact);

                CurrentContactButton.Enabled       = true;
                UpdateCurrentContactButton.Enabled = true;
                DeleteContactButton.Enabled        = true;
            }
            else
            {
                MessageBox.Show("Requires both first and last name to add a new contact");
            }
        }
コード例 #4
0
        /// <summary>
        /// Main code activity function
        /// </summary>
        /// <param name="executionContext"></param>
        /// <param name="crmWorkflowContext"></param>
        public override void ExecuteCRMWorkFlowActivity(CodeActivityContext executionContext, LocalWorkflowContext crmWorkflowContext)
        {
            if (crmWorkflowContext == null)
            {
                throw new ArgumentNullException(nameof(crmWorkflowContext));
            }

            TracingService = executionContext.GetExtension <ITracingService>();
            Service        = crmWorkflowContext.OrganizationService;

            // 1. Validation
            var account     = this.Account.Get(executionContext);
            int contactRole = this.ContactRole.Get(executionContext);

            if (account == null)
            {
                TracingService.Trace("Account parameter not set.");

                return;
            }

            if (contactRole < 1)
            {
                TracingService.Trace("Contact Role parameter not set.");
                return;
            }

            TracingService.Trace("Getting Contacts for Account {0} and Contact Role : {1}", account.Id, contactRole);

            // 2. Processing - Query CRM for contacts of a given role and linked to the given account
            DataAccessContact dataAccess = new DataAccessContact(this.Service, this.TracingService);

            EntityReference [] contactEntityReferences = dataAccess.GetAccountContacts(account.Id, (Contact_AccountRoleCode)contactRole);

            // 3. Return contacts found
            if (contactEntityReferences == null)
            {
                // No contacts
                return;
            }

            int contactCount = 0;

            if (contactEntityReferences.Length > contactCount)
            {
                Contact1.Set(executionContext, contactEntityReferences[contactCount++]);
            }

            if (contactEntityReferences.Length > contactCount)
            {
                Contact2.Set(executionContext, contactEntityReferences[contactCount++]);
            }

            if (contactEntityReferences.Length > contactCount)
            {
                Contact3.Set(executionContext, contactEntityReferences[contactCount++]);
            }

            if (contactEntityReferences.Length > contactCount)
            {
                Contact4.Set(executionContext, contactEntityReferences[contactCount++]);
            }

            if (contactEntityReferences.Length > contactCount)
            {
                Contact5.Set(executionContext, contactEntityReferences[contactCount++]);
            }

            if (contactEntityReferences.Length > contactCount)
            {
                Contact6.Set(executionContext, contactEntityReferences[contactCount++]);
            }

            if (contactEntityReferences.Length > contactCount)
            {
                Contact7.Set(executionContext, contactEntityReferences[contactCount++]);
            }

            if (contactEntityReferences.Length > contactCount)
            {
                Contact8.Set(executionContext, contactEntityReferences[contactCount++]);
            }

            if (contactEntityReferences.Length > contactCount)
            {
                Contact9.Set(executionContext, contactEntityReferences[contactCount++]);
            }

            if (contactEntityReferences.Length > contactCount)
            {
                Contact10.Set(executionContext, contactEntityReferences[contactCount++]);
            }

            if (contactEntityReferences.Length > contactCount)
            {
                Contact11.Set(executionContext, contactEntityReferences[contactCount++]);
            }

            if (contactEntityReferences.Length > contactCount)
            {
                Contact12.Set(executionContext, contactEntityReferences[contactCount++]);
            }

            if (contactEntityReferences.Length > contactCount)
            {
                Contact13.Set(executionContext, contactEntityReferences[contactCount++]);
            }

            if (contactEntityReferences.Length > contactCount)
            {
                Contact14.Set(executionContext, contactEntityReferences[contactCount++]);
            }
            if (contactEntityReferences.Length > contactCount)
            {
                Contact15.Set(executionContext, contactEntityReferences[contactCount]);
            }
        }
コード例 #5
0
        public void Add(Student student)
        {
            lock (student)
            {
                if (Count == StudentId.Length)
                {
                    var newLength  = StudentId.Length + 1000;
                    var _StudentId = new string[newLength];
                    StudentId.CopyTo(_StudentId);
                    StudentId = _StudentId;
                    var _IndexNumber = new string[newLength];
                    IndexNumber.CopyTo(_IndexNumber);
                    IndexNumber = _IndexNumber;
                    var _ReferenceNumber = new string[newLength];
                    ReferenceNumber.CopyTo(_ReferenceNumber);
                    ReferenceNumber = _ReferenceNumber;
                    var _Surname = new string[newLength];
                    Surname.CopyTo(_Surname);
                    Surname = _Surname;
                    var _Othernames = new string[newLength];
                    Othernames.CopyTo(_Othernames);
                    Othernames = _Othernames;
                    var _Title = new string[newLength];
                    Title.CopyTo(_Title);
                    Title = _Title;
                    var _Gender = new string[newLength];
                    Gender.CopyTo(_Gender);
                    Gender = _Gender;
                    var _MaritalStatus = new string[newLength];
                    MaritalStatus.CopyTo(_MaritalStatus);
                    MaritalStatus = _MaritalStatus;
                    var _DateofBirth = new string[newLength];
                    DateofBirth.CopyTo(_DateofBirth);
                    DateofBirth = _DateofBirth;
                    var _Disability = new bool[newLength];
                    Disability.CopyTo(_Disability);
                    Disability = _Disability;
                    var _Country = new string[newLength];
                    Country.CopyTo(_Country);
                    Country = _Country;
                    var _Region = new string[newLength];
                    Region.CopyTo(_Region);
                    Region = _Region;
                    var _HomeTown = new string[newLength];
                    HomeTown.CopyTo(_HomeTown);
                    HomeTown = _HomeTown;
                    var _Address1 = new string[newLength];
                    Address1.CopyTo(_Address1);
                    Address1 = _Address1;
                    var _Address2 = new string[newLength];
                    Address2.CopyTo(_Address2);
                    Address2 = _Address2;
                    var _Contact1 = new string[newLength];
                    Contact1.CopyTo(_Contact1);
                    Contact1 = _Contact1;
                    var _Contact2 = new string[newLength];
                    Contact2.CopyTo(_Contact2);
                    Contact2 = _Contact2;
                    var _PersonalEmail = new string[newLength];
                    PersonalEmail.CopyTo(_PersonalEmail);
                    PersonalEmail = _PersonalEmail;
                    var _UniversityEmail = new string[newLength];
                    UniversityEmail.CopyTo(_UniversityEmail);
                    UniversityEmail = _UniversityEmail;
                    var _ResidentialStatus = new string[newLength];
                    ResidentialStatus.CopyTo(_ResidentialStatus);
                    ResidentialStatus = _ResidentialStatus;
                    var _ProgramOfStudy = new string[newLength];
                    ProgramOfStudy.CopyTo(_ProgramOfStudy);
                    ProgramOfStudy = _ProgramOfStudy;
                    var _Specialization = new string[newLength];
                    Specialization.CopyTo(_Specialization);
                    Specialization = _Specialization;
                    var _ProgramStatus = new string[newLength];
                    ProgramStatus.CopyTo(_ProgramStatus);
                    ProgramStatus = _ProgramStatus;
                    var _Level = new string[newLength];
                    Level.CopyTo(_Level);
                    Level = _Level;
                    var _StudentType = new string[newLength];
                    StudentType.CopyTo(_StudentType);
                    StudentType = _StudentType;
                    var _EnrollmentOption = new string[newLength];
                    EnrollmentOption.CopyTo(_EnrollmentOption);
                    EnrollmentOption = _EnrollmentOption;
                    var _RegistrationStatus = new string[newLength];
                    RegistrationStatus.CopyTo(_RegistrationStatus);
                    RegistrationStatus = _RegistrationStatus;
                    var _DateOfEntry = new System.DateTime[newLength];
                    DateOfEntry.CopyTo(_DateOfEntry);
                    DateOfEntry = _DateOfEntry;
                    var _DateOfCompletion = new System.DateTime[newLength];
                    DateOfCompletion.CopyTo(_DateOfCompletion);
                    DateOfCompletion = _DateOfCompletion;
                    var _Results = new StudentResultDM[newLength];;
                    Results.CopyTo(_Results);
                    Results = _Results;
                    var _RegisteredCourses = new RegisteredCourseDM[newLength];
                    RegisteredCourses.CopyTo(_RegisteredCourses);
                    RegisteredCourses = _RegisteredCourses;
                    var _EmergencyContact = new EmergencyContactDM[newLength];
                    EmergencyContact.CopyTo(_EmergencyContact);
                    EmergencyContact = _EmergencyContact;
                    var _Owning = new bool[newLength];
                    //Owning.CopyTo(_Owning);
                    //Owning = _Owning;
                    //var _FeesBalance = new string[newLength];
                    //FeesBalance.CopyTo(_FeesBalance);
                    //FeesBalance = _FeesBalance;
                    var _PamentOption = new string[newLength];
                    PamentOption.CopyTo(_PamentOption);
                    PamentOption = _PamentOption;
                    var _DepartmentId = new string[newLength];
                    DepartmentId.CopyTo(_DepartmentId);
                    DepartmentId = _DepartmentId;
                    var _State = new int[newLength];
                    State.CopyTo(_State);
                    State = _State;
                }
                StudentId.Span[Count]          = student.StudentId;
                IndexNumber.Span[Count]        = student.IndexNumber;
                ReferenceNumber.Span[Count]    = student.ReferenceNumber;
                Surname.Span[Count]            = student.Surname;
                Othernames.Span[Count]         = student.Othernames;
                Title.Span[Count]              = student.Title;
                Gender.Span[Count]             = student.Gender;
                MaritalStatus.Span[Count]      = student.MaritalStatus;
                DateofBirth.Span[Count]        = student.DateofBirth;
                Disability.Span[Count]         = student.Disability;
                Country.Span[Count]            = student.Country;
                Region.Span[Count]             = student.Region;
                HomeTown.Span[Count]           = student.HomeTown;
                Address1.Span[Count]           = student.Address1;
                Address2.Span[Count]           = student.Address2;
                Contact1.Span[Count]           = student.Contact1;
                Contact2.Span[Count]           = student.Contact2;
                PersonalEmail.Span[Count]      = student.PersonalEmail;
                UniversityEmail.Span[Count]    = student.UniversityEmail;
                ResidentialStatus.Span[Count]  = student.ResidentialStatus;
                ProgramOfStudy.Span[Count]     = student.ProgramOfStudy;
                Specialization.Span[Count]     = student.Specialization;
                ProgramStatus.Span[Count]      = student.ProgramStatus;
                Level.Span[Count]              = student.Level;
                StudentType.Span[Count]        = student.StudentType;
                EnrollmentOption.Span[Count]   = student.EnrollmentOption;
                RegistrationStatus.Span[Count] = student.RegistrationStatus;
                DateOfEntry.Span[Count]        = student.DateOfEntry;
                DateOfCompletion.Span[Count]   = student.DateOfCompletion;

                //Owning.Span[Count] = student.Owning;
                //FeesBalance.Span[Count] = student.FeesBalance;
                PamentOption.Span[Count] = student.PamentOption;
                DepartmentId.Span[Count] = student.DepartmentId;
                State.Span[Count]++;
                Count++;

                Results.Span[Count] = new StudentResultDM(length);
                if (student.Results?.Count > 0)
                {
                    foreach (var t in student.Results)
                    {
                        Results.Span[Count].Add(t);
                    }
                }

                EmergencyContact.Span[Count] = new EmergencyContactDM(length);
                if (student.EmergencyContact?.Count > 0)
                {
                    foreach (var t in student.EmergencyContact)
                    {
                        EmergencyContact.Span[Count].Add(t);
                    }
                }

                RegisteredCourses.Span[Count] = new RegisteredCourseDM(length);
                if (student.RegisteredCourses?.Count > 0)
                {
                    foreach (var t in student.RegisteredCourses)
                    {
                        RegisteredCourses.Span[Count].Add(t);
                    }
                }
            }
        }
コード例 #6
0
        public void ProcessRequest(HttpContext context)
        {
            ManagementService managementservice = new ManagementService();
            ScopeServices     scopeservices     = new ScopeServices();

            managementservice.SQLConnection = ConnectDb.SQLConnection;
            UserProfile contactProfile = new UserProfile();
            Project     project        = new Project();
            User        contactUser    = new User();
            long        userId;
            string      FirstName; string LastName;
            string      Email;
            string      Contact1; string Contact2; string Contact3;
            string      Address;
            string      Suburb; int SuburbId; string City; int CityId;
            string      PostCode; string Region; int RegionId;
            string      Country; int CountryId;
            string      ProjectName; string ClaimNumber; string EstimatedTime;
            string      StartDate = ""; string ScopeDate = "";
            string      AssessmentDate = ""; string QuotationDate = "";
            string      FinishDate = ""; string ProjectGroupName;
            int         ProjectGroupId; int Priority; string Hazard; int status;

            try { userId = Convert.ToInt32(context.Request.QueryString["userId"]); }
            catch { userId = 0; }
            try { FirstName = context.Request.QueryString["FirstName"]; }
            catch { FirstName = ""; }
            try { LastName = context.Request.QueryString["LastName"]; }
            catch { LastName = ""; }
            try { Email = context.Request.QueryString["Email"]; }
            catch { Email = ""; }
            try { Contact1 = context.Request.QueryString["Contact1"]; }
            catch { Contact1 = ""; }
            try { Contact2 = context.Request.QueryString["Contact2"]; }
            catch { Contact2 = ""; }
            try { Contact3 = context.Request.QueryString["Contact3"]; }
            catch { Contact3 = ""; }
            try { Address = context.Request.QueryString["Address"]; }
            catch { Address = ""; }
            try { Suburb = context.Request.QueryString["Suburb"]; }
            catch { Suburb = ""; }
            try { SuburbId = Convert.ToInt32(context.Request.QueryString["SuburbId"]); }
            catch { SuburbId = 0; }
            try { City = context.Request.QueryString["City"]; }
            catch { City = ""; }
            try { CityId = Convert.ToInt32(context.Request.QueryString["CityId"]); }
            catch { CityId = 0; }
            try { PostCode = context.Request.QueryString["PostCode"]; }
            catch { PostCode = ""; }
            try { Region = context.Request.QueryString["Region"]; }
            catch { Region = ""; }
            try { RegionId = Convert.ToInt32(context.Request.QueryString["RegionId"]); }
            catch { RegionId = 0; }
            try { Country = context.Request.QueryString["Country"]; }
            catch { Country = ""; }
            try { CountryId = Convert.ToInt32(context.Request.QueryString["CountryId"]); }
            catch { CountryId = 0; }
            try { ProjectName = context.Request.QueryString["ProjectName"]; }
            catch { ProjectName = ""; }
            try { ClaimNumber = context.Request.QueryString["ClaimNumber"]; }
            catch { ClaimNumber = ""; }
            try { EstimatedTime = context.Request.QueryString["EstimatedTime"]; }
            catch { EstimatedTime = ""; }
            try { StartDate = context.Request.QueryString["StartDate"]; }
            catch { }
            try { ScopeDate = context.Request.QueryString["ScopeDate"]; }
            catch { }
            try { AssessmentDate = context.Request.QueryString["AssessmentDate"]; }
            catch { }
            try { QuotationDate = context.Request.QueryString["QuotationDate"]; }
            catch { }
            try { FinishDate = context.Request.QueryString["FinishDate"]; }
            catch { }
            try { ProjectGroupName = context.Request.QueryString["ProjectGroupName"]; }
            catch { ProjectGroupName = ""; }
            try { ProjectGroupId = Convert.ToInt32(context.Request.QueryString["ProjectGroupId"]); }
            catch { ProjectGroupId = 0; }
            try { Priority = Convert.ToInt32(context.Request.QueryString["Priority"]); }
            catch { Priority = 0; }
            try { Hazard = context.Request.QueryString["Hazard"]; }
            catch { Hazard = ""; }
            try { status = Convert.ToInt32(context.Request.QueryString["status"]); }
            catch { status = 0; }

            contactUser.Email = Email.Trim();
            contactUser.Type  = 0;
            userId            = managementservice.CreateUser(contactUser, userId);

            long userProfileId;

            contactProfile.UserId        = userId;
            contactProfile.FirstName     = FirstName.Trim();
            contactProfile.LastName      = LastName.Trim();
            contactProfile.Contact1      = Contact1.Trim();
            contactProfile.Contact2      = Contact2.Trim();
            contactProfile.Contact3      = Contact3.Trim();
            contactProfile.Email         = Email.Trim();
            userProfileId                = managementservice.CreateUserProfile(contactProfile);
            contactProfile.UserProfileId = userProfileId;

            VoucherCodeFunctions cVoucherCode = new VoucherCodeFunctions();
            String strIdentifier = String.Format("{0}{1}", userProfileId, cVoucherCode.GenerateVoucherCodeGuid(16));

            contactProfile.Identifier = strIdentifier;

            managementservice.UpdateUserProfileIdentifier(contactProfile);
            string filename = DateTime.UtcNow.ToString("yyyyMMddHHmmss");
            string fname = "", virtualpath = "";

            System.Text.StringBuilder str = new System.Text.StringBuilder();
            try
            {
                if (context.Request.Files.Count > 0)
                {
                    HttpFileCollection files = context.Request.Files;

                    string myactualfilename = "";
                    for (int i = 0; i < files.Count; i++)
                    {
                        HttpPostedFile file = files[i];
                        myactualfilename = file.FileName;
                        var p = file.FileName.Split('.');

                        var    extention = myactualfilename.Split('.');
                        string ext       = extention[extention.Length - 1];
                        filename = filename + '.' + ext;
                        string projectpath = "http://koreprojects.com";
                        string folderPath  = context.Server.MapPath(projectpath + "/Images/" + contactProfile.Identifier);
                        if (!System.IO.Directory.Exists(folderPath))
                        {
                            System.IO.Directory.CreateDirectory(folderPath);
                        }
                        fname = context.Server.MapPath(projectpath + "/Images/" + contactProfile.Identifier + "/" + filename);

                        file.SaveAs(fname);
                        //context.Response.Write(filename);
                    }
                }
            }
            catch
            {
                //context.Response.Write("un");
            }
            if (filename != String.Empty)
            {
                contactProfile.PersonalPhoto = filename;
            }

            managementservice.UpdateUserProfile(contactProfile);

            project.ContactId      = userId;
            project.ProjectOwnerId = managementservice.GetProjectOwnerByContactId(userId).ProjectOwnerId;
            project.Address        = Address.Trim();
            project.Suburb         = Suburb;
            if (Suburb != string.Empty)
            {
                project.SuburbID = SuburbId;
            }

            project.City = City;
            if (City != string.Empty)
            {
                project.CityID = CityId;
            }
            project.Region = Region;
            if (RegionId > 0)
            {
                project.RegionID = RegionId;
            }
            project.Country = Country;
            if (CountryId > 0)
            {
                project.CountryID = CountryId;
            }
            project.Name           = ProjectName.Trim();
            project.EQCClaimNumber = ClaimNumber.Trim();
            project.EstimatedTime  = EstimatedTime.Trim();

            project.StartDate = Convert.ToDateTime(StartDate);

            project.ScopeDate = Convert.ToDateTime(ScopeDate);

            project.ProjectStatusId = 0;
            if (ProjectGroupId > 0)
            {
                project.GroupID   = ProjectGroupId;
                project.GroupName = ProjectGroupName;
            }
            else
            {
                project.GroupID   = 0;
                project.GroupName = String.Empty;
            }

            project.AssessmentDate = Convert.ToDateTime(AssessmentDate);
            project.QuotationDate  = Convert.ToDateTime(QuotationDate);
            project.FinishDate     = Convert.ToDateTime(FinishDate);
            project.Priority       = Priority;
            project.Hazard         = Hazard.Trim();

            long newProjectId;

            newProjectId      = managementservice.CreateProject(project);
            project.ProjectId = newProjectId;

            UserProjectStatusValue userProjectStatusValue = new UserProjectStatusValue();

            userProjectStatusValue.ProjectId = project.ProjectId;
            userProjectStatusValue.UserId    = userId;
            userProjectStatusValue.UserProjectStatusValue = status;
            managementservice.CreateUserProjectStatusValue(userProjectStatusValue);
            int projectCredit             = 0;

            try
            {
                DataSet dsUserAccount = new DataSet();
                dsUserAccount = managementservice.GetUserAccountByUserID(userId);
                if (dsUserAccount.Tables[0].Rows.Count > 0)
                {
                    projectCredit = int.Parse(dsUserAccount.Tables[0].Rows[0]["ProjectCredit"].ToString());
                }

                if (projectCredit > 0)
                {
                    managementservice.UpdateUserAccount(userId, projectCredit - 1);
                    managementservice.CreateUserTransaction(userId, String.Format("Create Project", project.Name), 0, 0, -1, projectCredit - 1);
                }
            }
            catch (Exception w)
            { }

            context.Response.ContentType = "image/jpg";
            context.Response.AddHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
        }
コード例 #7
0
ファイル: EmployeeService.cs プロジェクト: KuldipBhuva/TDMS
        public List <EmpAllItem> GetALLDetails(int FID, int cid)
        {
            //     Mapper.Initialize(cfg =>
            //    {
            //        cfg.CreateMap<EmployeeContact, EmpContactItem>();
            //        cfg.CreateMap<EmployeePassport, EmpPassportItem>();
            //        cfg.CreateMap<EmployeeRelative, EmpRelativeItem>();
            //    });
            //     List<EmpAllItem> a = new List<EmpAllItem>();
            //     return a ;
            EmpContactItem      ContactItem  = new EmpContactItem();
            EmpPassportItem     PassportItem = new EmpPassportItem();
            List <EmployeeItem> a            = new List <EmployeeItem>();


            var ab = (from Emp in DbContext.employee_master
                      join Contact in DbContext.EmployeeContacts on Emp.id equals Contact.EmpId into Contact1
                      from C in Contact1.DefaultIfEmpty()
                      join Passport in DbContext.EmployeePassports on Emp.id equals Passport.EmpId into Passport1
                      from P in Passport1.DefaultIfEmpty()
                      join Relative in DbContext.EmployeeRelatives on Emp.id equals Relative.EmpId into Relative1
                      from R in Relative1.DefaultIfEmpty()
                      join Company in DbContext.Company_master on Emp.Compid equals Company.id into Company1
                      from Companys in Company1.DefaultIfEmpty()
                      join Branch in DbContext.Branch_master on Emp.Branchid equals Branch.id into BranchMst
                      from Branchs in BranchMst.DefaultIfEmpty()
                      //where Emp.Compid == (Compid == 0 ? Emp.Compid : Compid)
                      where Emp.WorkingStatus == (FID == 0 ? Emp.WorkingStatus : FID) && Emp.Compid == (cid == 0 ? Emp.Compid : cid)
                      select new EmpAllItem
            {
                //EmpContactItem = new EmpContactItem()
                //{
                //    Area = C.Area,
                //    City = C.City,
                //},
                EmployeeItem = new EmployeeItem()
                {
                    Empno = Emp.Empno,
                    Empname = Emp.Empname,
                    Mobile = Emp.Mobile,
                    id = Emp.id,
                    JobTitle = Emp.JobTitle
                },
                //EmpPassportItem = new EmpPassportItem()
                //{
                //    PassportNo = P.PassportNo

                //},
                //EmpRelativeItem = new EmpRelativeItem()
                //{
                //    RName = R.RName,
                //    RAddress = R.RAddress
                //},
                CompanyItem = new CompanyItem()
                {
                    CompName = Companys.CompName,
                },
                BranchItem = new BranchItem()
                {
                    BranchName = Branchs.BranchName
                }

                //Company = Companys.CompName
            }

                      ).Distinct().ToList();


            return(ab);
            //
        }