Ejemplo n.º 1
0
    protected void radGridTemplateHistory_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
        {
            EmailSent emailsent = (EmailSent)e.Item.DataItem;

            if (emailsent != null)
            {
                Jury jury = Jury.GetJury(emailsent.JuryId);


                if (jury != null)
                {
                    Label lblType = (Label)e.Item.FindControl("lblType");
                    lblType.Text = jury.Type;

                    LinkButton lnkBtnJuryId = (LinkButton)e.Item.FindControl("lnkBtnJuryId");
                    lnkBtnJuryId.Text            = jury.SerialNo;
                    lnkBtnJuryId.CommandArgument = jury.Id.ToString();

                    HyperLink lnk = (HyperLink)e.Item.FindControl("lnkJuryName");
                    lnk.Text        = jury.FirstName + " " + jury.LastName;
                    lnk.NavigateUrl = "mailto:" + jury.Email;
                }

                Label lblEmailTemplate = (Label)e.Item.FindControl("lblEmailTemplate");
                lblEmailTemplate.Text = emailsent.TemplateName;
            }
        }
    }
Ejemplo n.º 2
0
    public void PopulateForm()
    {
        if (inv != null)
        {
            lblEventYear.Text = inv.EventCode;

            Jury jury = Jury.GetJury(inv.JuryId);

            lblJuryId.Text  = jury.SerialNo;
            lblName.Text    = jury.FirstName + " " + jury.LastName;
            lblCompany.Text = jury.Company;
            lblEmail.Text   = jury.Email;
            lblCountry.Text = jury.Country;

            chkInvRound1.Checked = inv.IsRound1Invited;
            chkInvRound2.Checked = inv.IsRound2Invited;

            //if (inv.IsLocked)
            {
                chkAccptRound1.Checked = inv.IsRound1Accepted;
                chkAccptRound2.Checked = inv.IsRound2Accepted;

                chkDecline.Checked = inv.IsDeclined;
            }

            chkShortListedRound1.Checked = inv.IsRound1Shortlisted;
            chkShortListedRound2.Checked = inv.IsRound2Shortlisted;

            chkAssignRound1.Checked = inv.IsRound1Assigned;
            chkAssignRound2.Checked = inv.IsRound2Assigned;
        }
    }
Ejemplo n.º 3
0
        public decimal?CalculateMark(Article a)
        {
            var all = Jury.Select(j => a.Marks.Where(m => m.User == j).SingleOrDefault())
                      .Where(m => m != null)
                      .Select(m => m.Marks)
                      .ToArray();

            if (all.Length == 0)
            {
                return(null);
            }
            var config = ReadMarksConfig();

            decimal result;
            var     parts = all.Select(m => config.GetValues(m)).ToArray();

            if (Flags.HasFlag(EditathonFlags.ConsensualVote))
            {
                var p = parts.Aggregate((p1, p2) => p1 != null && p1.SequenceEqual(p2) ? p1 : null);
                if (p == null)
                {
                    return(null);
                }
                result = p.Values.Sum(v => v.Value);
            }
            else
            {
                result = parts.Average(p => p.Values.Sum(v => v.Value));
            }

            return(Math.Round(result, 2));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Post([FromBody] Jury jury)
        {
            _context.Jurys.Add(jury);
            await _context.SaveChangesAsync();

            return(Ok());
        }
Ejemplo n.º 5
0
        public Jury GetJuryById(Guid juryId)
        {
            string sqlJury = String.Format("SELECT * FROM Juries WHERE Id='{0}'", juryId);

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                SqlCommand    command = new SqlCommand(sqlJury, connection);
                SqlDataReader reader  = command.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Jury jury = new Jury();
                        jury.ID   = Guid.Parse((string)reader["id"]);
                        jury.Name = (string)reader["name"];
                        jury.Info = (string)reader["info"];
                        jury.Logo = (string)reader["logo"];
                        reader.Close();

                        return(jury);
                    }
                }

                reader.Close();
                return(null);
            }
        }
Ejemplo n.º 6
0
        public IEnumerable <Jury> GetAllJury()
        {
            string sqlExpression = "SELECT * FROM Juries";

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                SqlCommand    command = new SqlCommand(sqlExpression, connection);
                SqlDataReader reader  = command.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Jury jury = new Jury();
                        jury.ID   = Guid.Parse((string)reader["id"]);
                        jury.Name = (string)reader["name"];
                        jury.Info = (string)reader["info"];
                        jury.Logo = (string)reader["logo"];
                        yield return(jury);
                    }
                }

                reader.Close();
            }
        }
Ejemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            //jury = Jury.GetJury(new Guid(Request.QueryString["juryId"]));
            if (Request.QueryString["juryId"] != null && Request.QueryString["juryId"] != "")
            {
                jury = Jury.GetJury(IptechLib.Validation.GetValueGuid(Request.QueryString["juryId"], true));
            }
        }
        catch { }

        if (jury == null)
        {
            Security.RedirectToAccessDeniedPage();
        }

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

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

        if (GeneralFunction.IsProfileUpdateDateCutOff())
        {
            Response.Redirect("../Jury/Thankyou.aspx");
        }
    }
Ejemplo n.º 8
0
        private void dismissJury(Player curPlayer)
        {
            Jury jury = chooseJuryChoice(game.Board.Juries, curPlayer, "Select Jury to Dismiss");

            FileLogger.Instance.Log(curPlayer + " dismissed " + jury);

            game.Board.RemoveJury(jury);
        }
Ejemplo n.º 9
0
 public JuryVM() : base()
 {
     TheJury      = new Jury();
     TheItem      = TheJury;
     lstRecoursVM = new ObservableCollection <RecoursVM>();
     IsNew        = true;
     create1erRecours();
 }
Ejemplo n.º 10
0
    public static int SendTemplateEmail(Jury jury, Guid tempalteId)
    {
        int rtnValue = 0;
        //string emailformat = ReadEmailTemplate(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EmailTemplate\\InvitationEmailRound1.htm");

        EmailTemplate emailtempalte = EmailTemplate.GetEmailTemplate(tempalteId);

        if (emailtempalte != null)
        {
            string emailformat = emailtempalte.Body;
            string emailCC     = string.Empty;


            if (jury != null)
            {
                emailformat = emailformat.Replace("#NAME#", jury.FirstName);

                emailformat = emailformat.Replace("#LINKAPPROVE#", System.Configuration.ConfigurationSettings.AppSettings["WebURL"] + "Thankyou.aspx?jId=" + GeneralFunction.StringEncryption(jury.Id.ToString()) + "&rounds=" + GeneralFunction.StringEncryption("1|2") + "&request=" + GeneralFunction.StringEncryption("yes") + "");
                emailformat = emailformat.Replace("#LINKAPPROVER1#", System.Configuration.ConfigurationSettings.AppSettings["WebURL"] + "Thankyou.aspx?jId=" + GeneralFunction.StringEncryption(jury.Id.ToString()) + "&rounds=" + GeneralFunction.StringEncryption("1|") + "&request=" + GeneralFunction.StringEncryption("yes") + "");
                emailformat = emailformat.Replace("#LINKAPPROVER2#", System.Configuration.ConfigurationSettings.AppSettings["WebURL"] + "Thankyou.aspx?jId=" + GeneralFunction.StringEncryption(jury.Id.ToString()) + "&rounds=" + GeneralFunction.StringEncryption("2|") + "&request=" + GeneralFunction.StringEncryption("yes") + "");
                emailformat = emailformat.Replace("#LINKREJECT#", System.Configuration.ConfigurationSettings.AppSettings["WebURL"] + "Thankyou.aspx?jId=" + GeneralFunction.StringEncryption(jury.Id.ToString()) + "&rounds=" + GeneralFunction.StringEncryption("1|2") + "&request=" + GeneralFunction.StringEncryption("no") + "");

                emailformat = emailformat.Replace("#JURYLOGINURL#", System.Configuration.ConfigurationSettings.AppSettings["WebURLEffie"] + "Jury/Login.aspx");

                emailformat = emailformat.Replace("#LOGINID#", jury.SerialNo);
                emailformat = emailformat.Replace("#PASSWORD#", jury.Password);

                if (emailformat.IndexOf("#PROFILELINK#") != -1)
                {
                    jury.IsProfileUpdated = false;
                }

                jury.Save();

                string updateProfileLink = ConfigurationSettings.AppSettings["WebURL"] + "Jury/Profile.aspx?juryId=" + IptechLib.Crypto.StringEncryption(jury.Id.ToString());

                emailformat = emailformat.Replace("#PROFILELINK#", "<a href='" + updateProfileLink + "'>this link</a>");


                if (!String.IsNullOrEmpty(jury.PAEmail.Trim()))
                {
                    string pattern = @"^[a-z][a-z|0-9|]*([_][a-z|0-9]+)*([.][a-z|0-9]+([_][a-z|0-9]+)*)?@[a-z][a-z|0-9|]*\.([a-z][a-z|0-9]*(\.[a-z][a-z|0-9]*)?)$";
                    Match  match   = Regex.Match(jury.PAEmail.Trim(), pattern, RegexOptions.IgnoreCase);

                    if (match.Success && tempalteId != new Guid("714b1944-3fab-41c7-b353-cedeec28924f") && tempalteId != new Guid("e0cc09ee-30e1-44b7-83b1-48834a6fbbb9"))
                    {
                        emailCC = jury.PAEmail;
                    }
                }

                //Disable PAEmail
                emailCC = "";

                rtnValue = SendMail(jury.Email, System.Configuration.ConfigurationSettings.AppSettings["AdminEmail"], emailCC, "", emailtempalte.Subject, emailformat, true, null, null);
            }
        }
        return(rtnValue);
    }
Ejemplo n.º 11
0
    protected override void init()
    {
        jury      = (Jury)GameManager.Instance.Game.Board.Juries[Idx];
        SelectKey = jury;

        ownedJuryAspectElements.ForEach(e => e.InitJuryAspect(jury));
        swayTrackElement.InitSwayTrack(jury);

        updateUI();
    }
Ejemplo n.º 12
0
 public JuryVM(GestVAEcls.Jury pJury) : base(pJury)
 {
     TheJury      = pJury;
     lstRecoursVM = new ObservableCollection <RecoursVM>();
     foreach (var item in TheJury.lstRecours)
     {
         RecoursVM oRecours = new RecoursVM(item);
         lstRecoursVM.Add(oRecours);
     }
     IsNew = false;
 }
Ejemplo n.º 13
0
    public bool IsSameCompanyDetails(Jury jury, ClosedXML.Excel.IXLRangeRow CurrentRow)
    {
        if ((jury.Type != RemoveControlChars(CurrentRow.Cell(2).GetString())) || (!jury.Designation.Trim().ToUpper().Equals(RemoveControlChars(CurrentRow.Cell(7).GetString()).ToUpper())) || (!jury.Company.Trim().ToUpper().Equals(RemoveControlChars(CurrentRow.Cell(8).GetString()).ToUpper())) ||
            (!jury.Country.Trim().ToUpper().Equals(RemoveControlChars(CurrentRow.Cell(17).GetString()).Trim().ToUpper())) || (!jury.Network.Trim().ToUpper().Equals(RemoveControlChars(CurrentRow.Cell(9).GetString()).Trim().ToUpper())) ||
            (!jury.HoldingCompany.Trim().ToUpper().Equals(RemoveControlChars(CurrentRow.Cell(10).GetString()).Trim().ToUpper())))
        {
            return(false);
        }


        return(true);
    }
Ejemplo n.º 14
0
        public void AddJury(Jury jury)
        {
            string sqlAddJury = String.Format("INSERT INTO Juries (Id, UserId, Name, UserPic, Info) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}')",
                                              jury.ID, jury.UserID, jury.Name, jury.Logo, jury.Info);

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                SqlCommand command = new SqlCommand(sqlAddJury, connection);
                command.ExecuteNonQuery();
            }
        }
Ejemplo n.º 15
0
        public async Task <IActionResult> Put(int id, [FromBody] Jury jury)
        {
            var dbJury = _context.Jurys.FirstOrDefault(x => x.ID == id);

            dbJury.Teacher1 = jury.Teacher1;
            dbJury.Teacher2 = jury.Teacher2;
            dbJury.Teacher3 = jury.Teacher3;

            _context.Jurys.Update(dbJury);
            await _context.SaveChangesAsync();

            return(Ok());
        }
Ejemplo n.º 16
0
 public virtual void Commit()
 {
     foreach (JuryVM item in lstJuryVM)
     {
         Jury obj = (Jury)item.TheItem;
         if (item.IsNew)
         {
             TheLivret.lstJurys.Add(obj);
             item.IsNew = false;
         }
         item.Commit();
     }
 }
Ejemplo n.º 17
0
    public static int SendInvitationTemplateEmail(Invitation inv, Guid tempalteId)
    {
        int rtnValue = 0;
        //string emailformat = ReadEmailTemplate(System.Configuration.ConfigurationSettings.AppSettings["storagePhysicalPath"] + "EmailTemplate\\InvitationEmailRound1.htm");

        EmailTemplate emailtempalte = EmailTemplate.GetEmailTemplate(tempalteId);

        if (emailtempalte != null)
        {
            string emailformat = emailtempalte.Body;
            string emailCC     = string.Empty;

            Jury jury = Jury.GetJury(inv.JuryId);

            if (jury != null)
            {
                emailformat = emailformat.Replace("#NAME#", jury.FirstName);

                emailformat = emailformat.Replace("#LINKAPPROVE#", System.Configuration.ConfigurationSettings.AppSettings["WebURL"] + "Thankyou.aspx?jId=" + GeneralFunction.StringEncryption(jury.Id.ToString()) + "&rounds=" + GeneralFunction.StringEncryption("1|2") + "&request=" + GeneralFunction.StringEncryption("yes") + "");
                emailformat = emailformat.Replace("#LINKAPPROVER1#", System.Configuration.ConfigurationSettings.AppSettings["WebURL"] + "Thankyou.aspx?jId=" + GeneralFunction.StringEncryption(jury.Id.ToString()) + "&rounds=" + GeneralFunction.StringEncryption("1|") + "&request=" + GeneralFunction.StringEncryption("yes") + "");
                emailformat = emailformat.Replace("#LINKAPPROVER2#", System.Configuration.ConfigurationSettings.AppSettings["WebURL"] + "Thankyou.aspx?jId=" + GeneralFunction.StringEncryption(jury.Id.ToString()) + "&rounds=" + GeneralFunction.StringEncryption("2|") + "&request=" + GeneralFunction.StringEncryption("yes") + "");
                emailformat = emailformat.Replace("#LINKREJECT#", System.Configuration.ConfigurationSettings.AppSettings["WebURL"] + "Thankyou.aspx?jId=" + GeneralFunction.StringEncryption(jury.Id.ToString()) + "&rounds=" + GeneralFunction.StringEncryption("1|2") + "&request=" + GeneralFunction.StringEncryption("no") + "");

                if (emailformat.IndexOf("#PROFILELINK#") != -1)
                {
                    jury.IsProfileUpdated = false;
                }

                jury.Save();

                emailformat = emailformat.Replace("#PROFILELINK#", System.Configuration.ConfigurationSettings.AppSettings["WebURL"] + "Jury/Profile.aspx?juryId=" + IptechLib.Crypto.StringEncryption(jury.Id.ToString()));

                emailformat = emailformat.Replace("#EMAILTRACKER#", System.Configuration.ConfigurationSettings.AppSettings["WebURL"] + "EmailTracking.aspx?invId=" + IptechLib.Crypto.StringEncryption(inv.Id.ToString()));

                if (!String.IsNullOrEmpty(jury.PAEmail.Trim()))
                {
                    string pattern = @"^[a-z][a-z|0-9|]*([_][a-z|0-9]+)*([.][a-z|0-9]+([_][a-z|0-9]+)*)?@[a-z][a-z|0-9|]*\.([a-z][a-z|0-9]*(\.[a-z][a-z|0-9]*)?)$";
                    Match  match   = Regex.Match(jury.PAEmail.Trim(), pattern, RegexOptions.IgnoreCase);

                    if (match.Success)
                    {
                        emailCC = jury.PAEmail;
                    }
                }

                rtnValue = SendMail(jury.Email, System.Configuration.ConfigurationSettings.AppSettings["AdminEmail"], emailCC, "", emailtempalte.Subject, emailformat, true, null, null);
            }
        }
        return(rtnValue);
    }
Ejemplo n.º 18
0
    public void SaveCompanyHistory(Jury jury, CompanyHistory compnyHistroy, string DateCreated = "")
    {
        if (!string.IsNullOrEmpty(DateCreated) && !compnyHistroy.IsNew)
        {
            compnyHistroy.DateCreatedString = DateCreated;
        }
        else
        {
            compnyHistroy.JuryId      = jury.Id;
            compnyHistroy.Type        = jury.Type;
            compnyHistroy.Designation = jury.Designation;
            compnyHistroy.Company     = jury.Company;
            compnyHistroy.Address1    = jury.Address1;
            compnyHistroy.Address2    = jury.Address2;
            compnyHistroy.City        = jury.City;
            compnyHistroy.Postal      = jury.Postal;
            compnyHistroy.Country     = jury.Country;

            if (DateCreated == "Empty")
            {
                compnyHistroy.DateCreatedString = jury.DateCreatedString;
            }
            else if (!string.IsNullOrEmpty(DateCreated))
            {
                compnyHistroy.DateCreatedString = DateCreated;
            }

            compnyHistroy.CompanyType      = jury.CompanyType;
            compnyHistroy.CompanyTypeOther = jury.CompanyTypeOther;

            compnyHistroy.Network = jury.Network;
            if (compnyHistroy.Network == "Others")
            {
                compnyHistroy.NetworkOthers = jury.NetworkOthers.Trim();
            }

            compnyHistroy.HoldingCompany = jury.HoldingCompany;
            if (compnyHistroy.HoldingCompany == "Others")
            {
                compnyHistroy.HoldingCompanyOthers = jury.HoldingCompanyOthers.Trim();
            }
        }

        compnyHistroy.Save();

        string msg = "JURY ID : " + jury.Id + " || CompnyHistroy ID : " + compnyHistroy.Id + " || IsNew : " + compnyHistroy.IsNew + " || DateCreated : " + DateCreated + "<br>";

        Response.Write(msg);
    }
Ejemplo n.º 19
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;
        }
    }
Ejemplo n.º 20
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        Invitation inv = SaveForm();

        if (inv != null)
        {
            Jury jury = Jury.GetJury(inv.JuryId);

            if (jury != null)
            {
                jury.EffieExpYear       = Jury.GetEffieExperienceYears(jury, inv);
                jury.DateModifiedString = DateTime.Now.ToString();
                jury.Save();
            }

            Response.Redirect(GeneralFunction.GetRedirect("../Main/InvitationList.aspx"));
        }
    }
Ejemplo n.º 21
0
    public static bool isAttendedEvent(Jury jury, string eventCode)
    {
        bool isAttended = false;

        Invitation inv = null;

        try
        {
            inv = InvitationList.GetInvitationList(jury.Id, eventCode).Single();
        }
        catch { }

        if (inv != null)
        {
            isAttended = inv.IsRound1Assigned || inv.IsRound2Assigned;
        }

        return(isAttended);
    }
Ejemplo n.º 22
0
        public Guid AddJury(string email, string pass, string juryName)
        {
            User user = new User();

            user.EMail = email;
            user.Pass  = pass;
            user.Role  = UserRoles.Jury;
            user.ID    = Guid.NewGuid();

            _usersDal.AddUser(user);

            Jury jury = new Jury();

            jury.ID     = Guid.NewGuid();
            jury.UserID = user.ID;
            jury.Name   = juryName;
            jury.Info   = "";

            _juryDal.AddJury(jury);
            return(jury.ID);
        }
Ejemplo n.º 23
0
    public void GenerateEmails(Guid templateId)
    {
        string evetnYear = string.Empty;

        try
        {
            evetnYear = Gen_GeneralUseValueList.GetGen_GeneralUseValueList("EventCode")[0].Value;
        }
        catch { }

        lblError.Text = string.Empty;
        int counter = 0;

        foreach (GridDataItem item in radGridJury.Items)
        {
            CheckBox    chkbox = (CheckBox)item.FindControl("chkbox");
            HiddenField hdfId  = (HiddenField)item.FindControl("hdfId");

            if (chkbox.Checked)
            {
                Jury jury = Jury.GetJury(new Guid(hdfId.Value.ToString()));
                Email.SendTemplateEmail(jury, templateId);
                GeneralFunction.SaveEmailSentLog(jury, templateId, evetnYear);

                chkbox.Checked = false;
                counter++;
            }
        }

        if (counter == 0)
        {
            lblError.Text = "Please select atleat one jury to send email.<br/>";
        }
        else
        {
            lblError.Text = "Email sent to " + (counter).ToString() + " Jury(s).<br/>";
        }
    }
Ejemplo n.º 24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        juryIdString  = Request.QueryString["jId"];
        rounds        = Request.QueryString["rounds"];
        requestString = Request.QueryString["request"];

        if (GeneralFunction.IsInvitationDateCutOff())
        {
            pnlDeadline.Visible = true;
        }
        else
        {
            if (juryIdString != null && rounds != null && requestString != null)
            {
                if (GeneralFunction.ValidateGuid(GeneralFunction.GetValueGuid(juryIdString, true).ToString()))
                {
                    juryId = GeneralFunction.GetValueGuid(juryIdString, true);

                    jury = Jury.GetJury(juryId);

                    if (!IsPostBack)
                    {
                        LoadForm();
                        PopulateForm(jury);
                    }
                }
                else
                {
                    return;
                }
            }
            else
            {
                return;
            }
        }
    }
Ejemplo n.º 25
0
    public void SaveCompanyHistory(Jury jury, ClosedXML.Excel.IXLRangeRow CurrentRow)
    {
        CompanyHistory compnyHistroy = CompanyHistory.NewCompanyHistory();

        compnyHistroy.JuryId      = jury.Id;
        compnyHistroy.Type        = RemoveControlChars(CurrentRow.Cell(2).GetString());
        compnyHistroy.Designation = RemoveControlChars(CurrentRow.Cell(7).GetString());
        compnyHistroy.Company     = RemoveControlChars(CurrentRow.Cell(8).GetString());

        compnyHistroy.Country            = RemoveControlChars(CurrentRow.Cell(17).GetString());
        compnyHistroy.DateModifiedString = DateTime.Now.ToString();
        compnyHistroy.Network            = RemoveControlChars(CurrentRow.Cell(9).GetString());
        compnyHistroy.HoldingCompany     = RemoveControlChars(CurrentRow.Cell(10).GetString());

        if (compnyHistroy.IsNew)
        {
            compnyHistroy.DateCreatedString = DateTime.Now.AddYears(-3).ToString();
        }

        if (compnyHistroy.IsValid)
        {
            compnyHistroy.Save();
        }
    }
Ejemplo n.º 26
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);
    }
Ejemplo n.º 27
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";
        }
    }
Ejemplo n.º 28
0
        public void Commit()
        {
            foreach (DiplomeCandVM item in lstDiplomesCandVMs)
            {
                if (item.IsDeleted)
                {
                    if (!item.IsNew)
                    {
                        _ctx.DiplomeCands.Remove(item.TheDiplomeCand);
                    }
                }
            }
            if (_ctx.Entry <Candidat>(TheCandidat).State == System.Data.Entity.EntityState.Detached)
            {
                _ctx.Candidats.Add(TheCandidat);
            }
            if (_ctx.Entry <Candidat>(TheCandidat).State == System.Data.Entity.EntityState.Deleted)
            {
                _ctx.Candidats.Remove(TheCandidat);
            }
            foreach (LivretVMBase item in lstLivrets)
            {
                if (item.IsDeleted)
                {
                    if (!item.IsNew)
                    {
                        //Suppression Manuelle des Jurys
                        while (item.TheLivret.lstJurys.Count > 0)
                        {
                            Jury oJ = item.TheLivret.lstJurys[0];
                            _ctx.Juries.Remove(oJ);
                        }
                        // Suppression des enregistrements de Livrets
                        if (item.Typestr == Livret1.TYPELIVRET)
                        {
                            _ctx.Livret1.Remove((Livret1)item.TheLivret);
                        }
                        if (item.Typestr == Livret2.TYPELIVRET)
                        {
                            _ctx.Livret2.Remove((Livret2)item.TheLivret);
                        }
                    }
                    item.IsDeleted = false;
                    item.IsNew     = false;
                }
                else
                {
                    if (item is Livret1VM)
                    {
                        if (item.IsNew)
                        {
                            TheCandidat.lstLivrets1.Add((Livret1)item.TheLivret);
                            item.IsNew = false;
                        }
                    }
                    if (item is Livret2VM)
                    {
                        if (item.IsNew)
                        {
                            TheCandidat.lstLivrets2.Add((Livret2)item.TheLivret);
                            item.IsNew = false;
                        }
                    }

                    item.Commit();
                }
            }
        }
Ejemplo n.º 29
0
 public void InitSwayTrack(Jury jury)
 {
     swayTrack = jury.SwayTrack;
     SelectKey = swayTrack;
     updateUI();
 }
Ejemplo n.º 30
0
    private void PopulateForm(Jury jury)
    {
        if (jury != null)
        {
            InvitationList inv = InvitationList.GetInvitationList(jury.Id, Gen_GeneralUseValueList.GetGen_GeneralUseValueList("EventCode")[0].Value);

            if (inv.Count > 0)
            {
                if (!inv[0].IsLocked)
                {
                    string[] roundsArray = null;
                    try
                    {
                        roundsArray = GeneralFunction.StringDecryption(rounds).ToString().Trim().Split('|').ToArray();
                    }
                    catch
                    {
                    }

                    string evetnYear = string.Empty;
                    try
                    {
                        evetnYear = Gen_GeneralUseValueList.GetGen_GeneralUseValueList("EventCode")[0].Value;
                    }
                    catch { }

                    if (roundsArray != null)
                    {
                        if (GeneralFunction.StringDecryption(requestString).Trim().ToLower().Equals("yes"))
                        {
                            foreach (string round in roundsArray)
                            {
                                if (!String.IsNullOrEmpty(round))
                                {
                                    if (Convert.ToInt32(round) == 1)
                                    {
                                        inv[0].IsRound1Accepted = true;
                                    }
                                    if (Convert.ToInt32(round) == 2)
                                    {
                                        inv[0].IsRound2Accepted = true;
                                    }
                                }
                            }

                            EmailTemplate updateProfileTemplate = EmailTemplate.GetEmailTemplate(new Guid(Gen_GeneralUseValueList.GetGen_GeneralUseValueList("DefaultUpdateProfileTemplateId")[0].Value));
                            if (updateProfileTemplate != null)
                            {
                                Email.SendTemplateEmail(jury, updateProfileTemplate.Id);
                                GeneralFunction.SaveEmailSentLog(jury, updateProfileTemplate.Id, evetnYear);
                            }

                            pnlSuccess.Visible = true;
                        }
                        else
                        {
                            foreach (string round in roundsArray)
                            {
                                if (!String.IsNullOrEmpty(round))
                                {
                                    if (Convert.ToInt32(round) == 1)
                                    {
                                        inv[0].IsRound1Accepted = false;
                                    }
                                    if (Convert.ToInt32(round) == 2)
                                    {
                                        inv[0].IsRound2Accepted = false;
                                    }
                                }
                            }

                            pnlReject.Visible = true;
                        }

                        inv[0].IsLocked   = true; //Only one time Jury can give his response
                        inv[0].IsDeclined = GeneralFunction.StringDecryption(requestString).Trim().ToLower().Equals("no");

                        inv[0].Save();
                    }
                }
                else
                {
                    pnlLock.Visible = true;
                }
            }
        }
    }