Exemple #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["juryId"] != null && Request.QueryString["juryId"] != "")
        {
            jury = Jury.GetJury(new Guid(Request.QueryString["juryId"]));
        }
        else
        {
            jury = Jury.NewJury();
        }

        itemsToShow = Convert.ToInt32(Gen_GeneralUseValueList.GetGen_GeneralUseValueList("DefaultListToShow")[0].Value);

        if (!IsPostBack)
        {
            LoadForm();
            PopulateForm();
        }

        // view mode
        if (Request.QueryString["v"] != null && Request.QueryString["v"] == "1")
        {
            IptechLib.Forms.ChangeStateControls(this, false);

            filePhoto.Enabled = false;

            btnSubmit.Visible = false;
            btnEdit.Visible   = true;

            btnEdit.Enabled = true;
            btnBack.Enabled = true;
        }
        else
        {
            btnEdit.Enabled           = true;
            lnkChangePassword.Visible = Security.IsRoleSuperAdmin() && !jury.IsNew;
        }

        if (Security.IsRoleReadOnlyAdmin())
        {
            GeneralFunction.DisableAllAction(this, false);
            btnSubmit.Visible            = false;
            btnJurySubmitRemarks.Visible = false;
            filePhoto.Enabled            = false;
        }
    }
Exemple #2
0
    public string ValidateExcelData(XLWorkbook workBook)
    {
        string error          = string.Empty;
        bool   isErrorOccured = false;

        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 = Jury.NewJury();

                                jury.Type        = RemoveControlChars(row.Cell(3).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(8).GetString());
                                jury.Company     = RemoveControlChars(row.Cell(9).GetString());
                                //jury.CompanyType = RemoveControlChars(row.Cell(9).GetString());
                                jury.Network        = RemoveControlChars(row.Cell(10).GetString());
                                jury.HoldingCompany = RemoveControlChars(row.Cell(11).GetString());
                                jury.Email          = RemoveControlChars(row.Cell(12).GetString());
                                jury.Contact        = RemoveControlChars(row.Cell(13).GetString());
                                jury.Mobile         = RemoveControlChars(row.Cell(14).GetString());
                                jury.PAName         = RemoveControlChars(row.Cell(15).GetString());
                                jury.PAEmail        = RemoveControlChars(row.Cell(16).GetString());
                                jury.PATel          = RemoveControlChars(row.Cell(17).GetString());
                                jury.Address1       = RemoveControlChars(row.Cell(18).GetString());
                                jury.Address2       = RemoveControlChars(row.Cell(19).GetString());
                                jury.City           = RemoveControlChars(row.Cell(20).GetString());
                                jury.Postal         = RemoveControlChars(row.Cell(21).GetString());
                                jury.Country        = RemoveControlChars(row.Cell(22).GetString());
                                //jury.MarketExp = RemoveControlChars(row.Cell(23).GetString());
                                //jury.IndustryExp = RemoveControlChars(row.Cell(24).GetString());
                                jury.EffieExp = RemoveControlChars(row.Cell(25).GetString());
                                //jury.OtherJudgingExp = RemoveControlChars(row.Cell(28).GetString());
                                jury.Remarks    = RemoveControlChars(row.Cell(26).GetString());
                                jury.Reference  = RemoveControlChars(row.Cell(27).GetString());
                                jury.Source     = RemoveControlChars(row.Cell(28).GetString());
                                jury.LastUpdate = RemoveControlChars(row.Cell(29).GetString());

                                jury.DateModifiedString = DateTime.Now.ToString();


                                if (!jury.IsValid)
                                {
                                    error         += "Data is not valid in row: " + (row.RowNumber() - 1).ToString() + "[" + jury.BrokenRulesCollection.ToString() + "]";
                                    isErrorOccured = true;
                                    break;
                                }
                            }
                            else
                            {
                                error         += "Data is not valid in row: " + (row.RowNumber() - 1).ToString();
                                isErrorOccured = true;
                                break;
                            }
                        }

                        skiprows++;
                    }
                }
                sheetNo++;

                if (isErrorOccured)
                {
                    break;
                }
            }
        }
        else
        {
            error += "Sheet contains no data.<br/>";
        }

        return(error);
    }
Exemple #3
0
    public void ReadExcelData(XLWorkbook workBook)
    {
        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 = Jury.NewJury();

                                jury.Type        = RemoveControlChars(row.Cell(3).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(8).GetString());
                                jury.Company     = RemoveControlChars(row.Cell(9).GetString());
                                //jury.CompanyType = RemoveControlChars(row.Cell(9).GetString());
                                jury.Network        = RemoveControlChars(row.Cell(10).GetString());
                                jury.HoldingCompany = RemoveControlChars(row.Cell(11).GetString());
                                jury.Email          = RemoveControlChars(row.Cell(12).GetString());
                                jury.Contact        = RemoveControlChars(row.Cell(13).GetString());
                                jury.Mobile         = RemoveControlChars(row.Cell(14).GetString());
                                jury.PAName         = RemoveControlChars(row.Cell(15).GetString());
                                jury.PAEmail        = RemoveControlChars(row.Cell(16).GetString());
                                jury.PATel          = RemoveControlChars(row.Cell(17).GetString());
                                jury.Address1       = RemoveControlChars(row.Cell(18).GetString());
                                jury.Address2       = RemoveControlChars(row.Cell(19).GetString());
                                jury.City           = RemoveControlChars(row.Cell(20).GetString());
                                jury.Postal         = RemoveControlChars(row.Cell(21).GetString());
                                jury.Country        = RemoveControlChars(row.Cell(22).GetString());

                                string effieExpereinceYears = string.Empty;

                                effieExpereinceYears += "#" + RemoveControlChars(row.Cell(25).GetString()) + "|";
                                effieExpereinceYears += "#" + RemoveControlChars(row.Cell(24).GetString()) + "|";
                                effieExpereinceYears += "#" + RemoveControlChars(row.Cell(23).GetString()) + "|";

                                jury.EffieExpYear = effieExpereinceYears;

                                jury.EffieExp = RemoveControlChars(row.Cell(26).GetString());

                                jury.Remarks    = RemoveControlChars(row.Cell(27).GetString());
                                jury.Reference  = RemoveControlChars(row.Cell(28).GetString());
                                jury.Source     = RemoveControlChars(row.Cell(29).GetString());
                                jury.LastUpdate = RemoveControlChars(row.Cell(30).GetString());

                                if (jury.IsNew)
                                {
                                    jury.SerialNo          = GeneralFunction.GetNewJuryId();
                                    jury.DateCreatedString = DateTime.Now.ToString();
                                    jury.Password          = Guid.NewGuid().ToString().Substring(0, 6);
                                }

                                if (jury.IsValid)
                                {
                                    jury = jury.Save();
                                }
                            }
                            //else
                            //    return;
                        }

                        skiprows++;
                    }
                }
                sheetNo++;
            }
        }
        else
        {
            lbError.Text += "The Sheet has invalid/not enough data.<br/>Please check your file";
        }
    }
Exemple #4
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";
        }
    }