예제 #1
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        foreach (Jury jury in JuryList.GetJuryList())
        {
            bool is2014 = isAttendedEvent(jury, "2014");
            bool is2015 = isAttendedEvent(jury, "2015");
            bool is2016 = isAttendedEvent(jury, "2016");
            bool is2017 = isAttendedEvent(jury, "2017");

            string remarks2014 = string.Empty;
            string remarks2015 = string.Empty;
            string remarks2016 = string.Empty;
            string remarks2017 = string.Empty;

            try
            {
                remarks2014 = jury.EffieExpYear.Split('|')[0].Split('#')[1];
            }
            catch { }

            try
            {
                remarks2015 = jury.EffieExpYear.Split('|')[1].Split('#')[1];
            }
            catch { }

            try
            {
                remarks2016 = jury.EffieExpYear.Split('|')[2].Split('#')[1];
            }
            catch { }

            try
            {
                remarks2017 = jury.EffieExpYear.Split('|')[3].Split('#')[1];
            }
            catch { }

            string effieExpereinceYears = string.Empty;

            effieExpereinceYears += (is2014 ? "2014" : "") + "#" + remarks2014 + "|";
            effieExpereinceYears += (is2015 ? "2015" : "") + "#" + remarks2015 + "|";
            effieExpereinceYears += (is2016 ? "2016" : "") + "#" + remarks2016 + "|";
            effieExpereinceYears += (is2017 ? "2017" : "") + "#" + remarks2017 + "|";

            jury.EffieExpYear = effieExpereinceYears;

            if (jury.IsValid)
            {
                jury.Save();
            }
        }
    }
예제 #2
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        JuryList JuryLists = JuryList.GetJuryList("", "");

        foreach (Jury jury in JuryLists)
        {
            List <CompanyHistory> companies = CompanyHistoryList.GetCompanyHistoryList(jury.Id).OrderByDescending(x => x.DateCreated).ToList();
            if (companies.Count > 0)
            { //EDIT HERE
                int            count = 1;
                CompanyHistory CurrCompanyHistory = null;
                //EDIT DATE CREATED
                foreach (CompanyHistory com in companies)
                {
                    if (count == 1)
                    {
                        //NEW COMPANY HISTORY
                        CompanyHistory compnyHistroy = CompanyHistory.NewCompanyHistory();
                        SaveCompanyHistory(jury, compnyHistroy, com.DateCreatedString);
                    }
                    else
                    {
                        SaveCompanyHistory(jury, CurrCompanyHistory, com.DateCreatedString);
                    }

                    if (count != companies.Count || companies.Count == 1)
                    {
                        CurrCompanyHistory = com;
                    }

                    count++;
                }

                //FOR LATEST COMPANY HISTORY
                SaveCompanyHistory(jury, CurrCompanyHistory, jury.DateCreatedString);
            }
            else
            {   //NEW COMPANY HISTORY
                CompanyHistory compnyHistroy = CompanyHistory.NewCompanyHistory();
                SaveCompanyHistory(jury, compnyHistroy, "Empty");
            }
        }
    }
예제 #3
0
    public void ReadExcelData(XLWorkbook workBook)
    {
        JuryList jurylsit = JuryList.GetJuryList();

        if (workBook.Worksheets.Count > 0)
        {
            int sheetNo = 1;

            foreach (IXLWorksheet sh in workBook.Worksheets)
            {
                var dataRange = sh.RangeUsed();
                int skiprows  = 1;

                if (dataRange != null)
                {
                    foreach (var row in dataRange.Rows())
                    {
                        if (skiprows >= 2 && sheetNo == 1)
                        {
                            if (ValidateRow(row))
                            {
                                Jury jury = null;

                                string serialNo = RemoveControlChars(row.Cell(3).GetString());

                                try
                                {
                                    jury = jurylsit.Where(m => m.SerialNo.Equals(serialNo)).Single();
                                }
                                catch { }

                                if (jury == null)
                                {
                                    jury = Jury.NewJury();
                                }

                                if (jury.IsNew)
                                {
                                    jury.Type            = RemoveControlChars(row.Cell(2).GetString());
                                    jury.Salutation      = RemoveControlChars(row.Cell(4).GetString());
                                    jury.FirstName       = RemoveControlChars(row.Cell(5).GetString());
                                    jury.LastName        = RemoveControlChars(row.Cell(6).GetString());
                                    jury.Designation     = RemoveControlChars(row.Cell(7).GetString());
                                    jury.Company         = RemoveControlChars(row.Cell(8).GetString());
                                    jury.Network         = RemoveControlChars(row.Cell(9).GetString());
                                    jury.HoldingCompany  = RemoveControlChars(row.Cell(10).GetString());
                                    jury.Email           = RemoveControlChars(row.Cell(11).GetString());
                                    jury.Contact         = RemoveControlChars(row.Cell(12).GetString());
                                    jury.Mobile          = RemoveControlChars(row.Cell(13).GetString());
                                    jury.PAName          = RemoveControlChars(row.Cell(14).GetString());
                                    jury.PAEmail         = RemoveControlChars(row.Cell(16).GetString());
                                    jury.PATel           = RemoveControlChars(row.Cell(15).GetString());
                                    jury.Country         = RemoveControlChars(row.Cell(17).GetString());
                                    jury.EffieExpProgram = RemoveControlChars(row.Cell(18).GetString());
                                    jury.Source          = RemoveControlChars(row.Cell(19).GetString());

                                    string effieExpereinceYears = string.Empty;

                                    effieExpereinceYears += ((RemoveControlChars(row.Cell(25).GetString()).Equals("1") || RemoveControlChars(row.Cell(26).GetString()).Equals("1")) ? "2014" : "") + "#" + RemoveControlChars(row.Cell(27).GetString()) + "|";
                                    effieExpereinceYears += "|";
                                    effieExpereinceYears += "|";

                                    jury.EffieExpYear = effieExpereinceYears;
                                    jury.Remarks      = RemoveControlChars(row.Cell(28).GetString());

                                    jury.SerialNo          = GeneralFunction.GetNewJuryId();
                                    jury.DateCreatedString = DateTime.Now.ToString();
                                    jury.Password          = Guid.NewGuid().ToString().Substring(0, 6);
                                }
                                else
                                {
                                    bool is2014 = jury.EffieExpYear.IndexOf("2014") != -1;
                                    bool is2015 = jury.EffieExpYear.IndexOf("2015") != -1;
                                    bool is2016 = jury.EffieExpYear.IndexOf("2016") != -1;

                                    string remarks2014 = string.Empty;
                                    string remarks2015 = string.Empty;
                                    string remarks2016 = string.Empty;

                                    try
                                    {
                                        remarks2014 = jury.EffieExpYear.Split('|')[0].Split('#')[1];
                                    }
                                    catch { }

                                    try
                                    {
                                        remarks2015 = jury.EffieExpYear.Split('|')[1].Split('#')[1];
                                    }
                                    catch { }

                                    try
                                    {
                                        remarks2016 = jury.EffieExpYear.Split('|')[2].Split('#')[1];
                                    }
                                    catch { }

                                    string effieExpereinceYears = string.Empty;

                                    effieExpereinceYears += ((RemoveControlChars(row.Cell(25).GetString()).Equals("1") || RemoveControlChars(row.Cell(26).GetString()).Equals("1")) ? "2014" : "") + "#" + RemoveControlChars(row.Cell(27).GetString()) + "|";
                                    effieExpereinceYears += (is2015 ? "2015" : "") + "#" + remarks2015 + "|";
                                    effieExpereinceYears += (is2016 ? "2016" : "") + "#" + remarks2016 + "|";

                                    jury.EffieExpYear = effieExpereinceYears;
                                }

                                if (jury.IsValid)
                                {
                                    jury = jury.Save();
                                }

                                Invitation juryInv = Invitation.NewInvitation();
                                juryInv.JuryId           = jury.Id;
                                juryInv.IsRound1Invited  = RemoveControlChars(row.Cell(20).GetString()).Equals("1");
                                juryInv.IsRound2Invited  = RemoveControlChars(row.Cell(21).GetString()).Equals("1");
                                juryInv.IsDeclined       = RemoveControlChars(row.Cell(22).GetString()).Equals("1");
                                juryInv.IsRound1Accepted = RemoveControlChars(row.Cell(23).GetString()).Equals("1");
                                juryInv.IsRound2Accepted = RemoveControlChars(row.Cell(24).GetString()).Equals("1");
                                juryInv.IsRound1Assigned = RemoveControlChars(row.Cell(25).GetString()).Equals("1");
                                juryInv.IsRound2Assigned = RemoveControlChars(row.Cell(26).GetString()).Equals("1");

                                juryInv.EventCode = "2014";

                                if (juryInv.IsValid)
                                {
                                    juryInv.Save();
                                }

                                if (!IsSameCompanyDetails(jury, row))
                                {
                                    SaveCompanyHistory(jury, row);
                                }
                            }
                        }

                        skiprows++;
                    }
                }
                sheetNo++;
            }
        }
        else
        {
            lbError.Text += "The Sheet has invalid/not enough data.<br/>Please check your file";
        }
    }
예제 #4
0
    private void BindGrid(bool needRebind)
    {
        JuryList list = JuryList.GetJuryList();

        string status        = (string)ViewState["TabFilterValue"];
        string advanceSearch = (string)ViewState["AdvanceSearch"];

        List <Jury> flist = new List <Jury>();

        if (advanceSearch == "1")
        {
            foreach (Jury item in list)
            {
                if (
                    (ddlDelete.SelectedValue == "" || (ddlDelete.SelectedValue != "" && item.IsToDelete.ToString() == ddlDelete.SelectedValue)) &&
                    (ddlType.SelectedValue == "" || (ddlType.SelectedValue != "" && item.Type == ddlType.SelectedValue)) &&
                    (ddlNetwork.SelectedValue == "" || (ddlNetwork.SelectedValue != "" && item.Network == ddlNetwork.SelectedValue)) &&
                    (ddlHoldingCompany.SelectedValue == "" || (ddlHoldingCompany.SelectedValue != "" && item.HoldingCompany == ddlHoldingCompany.SelectedValue)) &&
                    (ddlCountry.SelectedValue == "" || (ddlCountry.SelectedValue != "" && item.Country == ddlCountry.SelectedValue)) &&
                    (
                        (txtSearch.Text.Trim() == "" || (txtSearch.Text.Trim() != "" && (ddlSearch.SelectedValue == "" || ddlSearch.SelectedValue == "judgeId") && item.SerialNo.ToUpper().IndexOf(txtSearch.Text.Trim().ToUpper()) != -1)) ||
                        (txtSearch.Text.Trim() == "" || (txtSearch.Text.Trim() != "" && (ddlSearch.SelectedValue == "" || ddlSearch.SelectedValue == "name") && (item.FirstName.ToUpper().IndexOf(txtSearch.Text.Trim().ToUpper()) != -1 || item.LastName.ToUpper().IndexOf(txtSearch.Text.Trim().ToUpper()) != -1))) ||
                        (txtSearch.Text.Trim() == "" || (txtSearch.Text.Trim() != "" && (ddlSearch.SelectedValue == "" || ddlSearch.SelectedValue == "title") && item.Designation.ToUpper().IndexOf(txtSearch.Text.Trim().ToUpper()) != -1)) ||
                        (txtSearch.Text.Trim() == "" || (txtSearch.Text.Trim() != "" && (ddlSearch.SelectedValue == "" || ddlSearch.SelectedValue == "company") && item.Company.ToUpper().IndexOf(txtSearch.Text.Trim().ToUpper()) != -1))
                    )
                    )
                {
                    flist.Add(item);
                }
            }
        }
        else
        {
            if (status != null)
            {
                if (status.Equals("Current"))
                {
                    flist = list.Where(m => !m.IsToDelete).ToList();
                }
                else if (status.Equals("Deleted"))
                {
                    flist = list.Where(m => m.IsToDelete).ToList();
                }
                else
                {
                    flist = list.ToList();
                }
            }
        }

        // Sort
        flist = flist.OrderBy(p => p.SerialNo).ToList();

        radGridJury.DataSource = flist;
        if (needRebind)
        {
            radGridJury.Rebind();
        }

        GeneralFunction.SetReportDataCache(flist);
    }
예제 #5
0
    private void BindGrid(bool needRebind)
    {
        string invitationYear = !String.IsNullOrEmpty(GetHighLightedYearTab()) ? GetHighLightedYearTab() : GeneralFunction.GetEffieExperienceYears().Last().ToString();  // By Default, get latest year invitation list when page loads

        HighLightYearTab(invitationYear);

        InvitationList invList = InvitationList.GetInvitationList(Guid.Empty, invitationYear);

        JuryList juryList = JuryList.GetJuryList();

        var filteredJuryList = (from jury in juryList
                                join inv in invList on jury.Id equals inv.JuryId
                                where inv.IsDeclined == false
                                select jury).ToList();


        List <Jury> list = new List <Jury>();

        //foreach (Jury jury in filteredJuryList)
        //{
        //    string photo = ConfigurationManager.AppSettings["storagePhysicalPath"] + "JuryPhoto\\" + jury.Id.ToString() + ".jpg";
        //    string profile = ConfigurationManager.AppSettings["storagePhysicalPath"] + "JuryProfile\\" + jury.SerialNo.ToString() + ".doc";
        //    string profile1 = ConfigurationManager.AppSettings["storagePhysicalPath"] + "JuryProfile\\" + jury.SerialNo.ToString() + ".docx";

        //    if (File.Exists(photo) || File.Exists(profile) || File.Exists(profile1))
        //        list.Add(jury);
        //}

        string advanceSearch = (string)ViewState["AdvanceSearch"];

        List <Jury> flist = new List <Jury>();

        if (advanceSearch == "1")
        {
            foreach (Jury item in filteredJuryList)
            {
                if ((ddlType.SelectedValue == "" || (ddlType.SelectedValue != "" && item.Type == ddlType.SelectedValue)) && (
                        (txtSearch.Text.Trim() == "" || (txtSearch.Text.Trim() != "" && (ddlSearch.SelectedValue == "" || ddlSearch.SelectedValue == "judgeId") && item.SerialNo.ToUpper().IndexOf(txtSearch.Text.Trim().ToUpper()) != -1)) ||
                        (txtSearch.Text.Trim() == "" || (txtSearch.Text.Trim() != "" && (ddlSearch.SelectedValue == "" || ddlSearch.SelectedValue == "name") && (item.FirstName.ToUpper().IndexOf(txtSearch.Text.Trim().ToUpper()) != -1 || item.LastName.ToUpper().IndexOf(txtSearch.Text.Trim().ToUpper()) != -1))) ||
                        (txtSearch.Text.Trim() == "" || (txtSearch.Text.Trim() != "" && (ddlSearch.SelectedValue == "" || ddlSearch.SelectedValue == "title") && item.Designation.ToUpper().IndexOf(txtSearch.Text.Trim().ToUpper()) != -1)) ||
                        (txtSearch.Text.Trim() == "" || (txtSearch.Text.Trim() != "" && (ddlSearch.SelectedValue == "" || ddlSearch.SelectedValue == "company") && item.Company.ToUpper().IndexOf(txtSearch.Text.Trim().ToUpper()) != -1)))
                    )
                {
                    bool isFilterPhoto = ddlUploadPhoto.SelectedValue.Equals("1");
                    bool isFilterBio   = ddlUploadBio.SelectedValue.Equals("1");

                    bool isFilterPhotoNo = ddlUploadPhoto.SelectedValue.Equals("0");
                    bool isFilterBioNo   = ddlUploadBio.SelectedValue.Equals("0");

                    string photo    = ConfigurationManager.AppSettings["storagePhysicalPath"] + "JuryPhoto\\" + item.Id.ToString() + ".jpg";
                    string profile  = ConfigurationManager.AppSettings["storagePhysicalPath"] + "JuryProfile\\" + item.SerialNo.ToString() + ".doc";
                    string profile1 = ConfigurationManager.AppSettings["storagePhysicalPath"] + "JuryProfile\\" + item.SerialNo.ToString() + ".docx";

                    bool isToAdd = false;

                    if (isFilterPhoto || isFilterBio)
                    {
                        if (isFilterPhoto)
                        {
                            if (File.Exists(photo))
                            {
                                isToAdd = true;
                            }
                        }

                        if (isFilterBio)
                        {
                            if (File.Exists(profile) || File.Exists(profile1))
                            {
                                isToAdd = true;
                            }
                        }
                    }
                    else if (isFilterPhotoNo || isFilterBioNo)
                    {
                        if (isFilterPhotoNo)
                        {
                            if (!File.Exists(photo))
                            {
                                isToAdd = true;
                            }
                        }

                        if (isFilterBioNo)
                        {
                            if (!File.Exists(profile) && !File.Exists(profile1))
                            {
                                isToAdd = true;
                            }
                        }
                    }
                    else
                    {
                        isToAdd = false;
                        flist.Add(item);
                    }

                    if (isToAdd)
                    {
                        flist.Add(item);
                    }
                }
            }
        }
        else
        {
            foreach (Jury jury in filteredJuryList)
            {
                flist.Add(jury);
            }
        }

        // Sort
        flist = flist.OrderBy(p => p.SerialNo).ToList();

        radGridJury.DataSource = flist;
        if (needRebind)
        {
            radGridJury.Rebind();
        }

        GeneralFunction.SetReportDataCache(flist);
    }