コード例 #1
0
ファイル: AddJob.aspx.cs プロジェクト: ranukhandelwal/EC
        public void AddFeed(short state)
        {
            Feed feed = new Feed();
            Utility Util = new Utility();
            feed.Author = "Administrator";
            foreach (sCategory cat in constant.FeedCategory)
            {
                if(cat.Name == "JOBS")
                    feed.CategoryID = cat.ID;
            }

            feed.Title = Util.FormatTextForInput(Request.Form[JobTitle.UniqueID]);
            feed.Link = constant.JobsPageBase + Util.FormatTextForInput(Request.Form[JobLink.UniqueID]);

            string tmp = "";
            GenerateSummary(ref tmp);
            testsummary.Text = tmp;
            feed.Summary = tmp;
            //feed.
            GenerateDetails(ref tmp);
            testdetails.Text = tmp;
            feed.Description = tmp;

            feed.isValid = state;
            feed.DisplayIn = "-1";

            SummaryPreview.Visible = true;
            DetailPreview.Visible = true;

            if ((state == 1) || (state == 2))
            {
                FeedRepository feedrep = new FeedRepository();
                if (feedrep.isFeedLinkDuplicate(feed.Link, feed.CategoryID) == 0)
                {
                    feedrep.Add(feed);
                }
                else
                {
                    lblWarningMessage.Visible = true;
                    lblWarningMessage.Text = "Error!! FeedLink is Duplicate";
                }
                feedrep = null;
            }

            Util = null;
            feed = null;
        }
コード例 #2
0
ファイル: adminlogin.aspx.cs プロジェクト: ranukhandelwal/EC
    public void ProcessLogin(Object s, EventArgs e)
    {
        //Instantiate validation
        Utility Util = new Utility();

        string Username;
        string Userpass;

           #region Input Validations
        //Validate username and password both are empty.
        if (Request.Form["uname"].Trim() == "" && Request.Form["password"].Trim() == "")
        {
            lblerror.Text = "Please enter a username and a password.";
            return;
        }
        if (Request.Form["uname"].Trim() == "")
        {
            lblerror.Text = "Please enter a username.";
            return;
        }
        if (Request.Form["password"].Trim() == "")
        {
            lblerror.Text = "Please enter a password.";
            return;
        }
          #endregion

        //Retreive value from the request.form property and filter dirty character.
        Username = Util.FormatTextForInput(Request.Form["uname"]);
        Userpass = Util.FormatTextForInput(Request.Form["password"]);

        //Do final login process with validation
        ProcessLoginCheck(Username, Userpass);

        Util = null;
    }
コード例 #3
0
    public void Add_User(object s, EventArgs e)
    {
        Utility Util = new Utility();

        if (Page.IsValid)
        {

            UserRepository User = new UserRepository();

            User.UserName = Util.FormatTextForInput(Request.Form[Username.UniqueID]);
            User.Password = Encryption.Encrypt(Util.FormatTextForInput(Request.Form[Password1.UniqueID]));
            User.Email1 = Util.FormatTextForInput(Request.Form[Email.UniqueID]);
            User.FirstName = Util.FormatTextForInput(Request.Form[Firstname.UniqueID]);
            User.LastName = Util.FormatTextForInput(Request.Form[Lastname.UniqueID]);
            User.SetSex = Request.Form[RadioButtonSex.UniqueID];
            User.CityID = 1;
            User.StateID = 8;
            User.CountryID = 18;
            /*User.CityID = Int16.Parse(Request.Form[City.UniqueID]);
            User.StateID = Int16.Parse(Request.Form[State.UniqueID]);
            User.CountryID = Int16.Parse(Request.Form[Cntry.UniqueID]);*/
            User.DOB = DateTime.Parse(Date1.CalendarDateString);
            if (Int32.Parse(Request.Form[Newsletter.UniqueID]) == 1)
            {
                User.canEmailSend = true;
            }
            else
                User.canEmailSend = false;

            User.ECPreference = "";
            for (int i = 0; i < ExamCategoryList.Items.Count; i++)
            {
                if (ExamCategoryList.Items[i].Selected)
                {
                    if (User.ECPreference.Length > 0)
                        User.ECPreference += ",";
                    User.ECPreference += ExamCategoryList.Items[i].Value;
                }
            }
            User.Mobile = Util.FormatTextForInput(Request.Form[Mobile.UniqueID]);
            User.Address = Util.FormatTextForInput(Request.Form[Address.UniqueID]);
            //User.ContactMe = Int32.Parse(Util.FormatTextForInput(Request.Form[ContactMe.UniqueID]));
            User.Website = Util.FormatTextForInput(Request.Form[Website.UniqueID]);
            User.AboutMe = Util.FormatTextForInput(Request.Form[AboutMe.UniqueID]);
            //User.GUID = Guid.NewGuid().ToString("N");

            //Prevent username and email duplication. Ensure that all username and email in the database are unique.
            //This initialize the value.
            UserNameAndEmailValidation.Param(User.UserName, User.Email1);

            #region Form Input Validation
            //Handles validation of username and email. This prevent duplication.
            if (!UserNameAndEmailValidation.IsValid)
            {
                lbvalenght.Text = UserNameAndEmailValidation.ErrMsg;
                lbvalenght.Visible = true;
                txtsecfield.Text = "";
                return;
            }

            if (!Validator.IsValidUserName(User.UserName))
            {
                lbvalenght.Text = "<br>Error: Username must be at least 6 characters long and 15 characters maximun, and should only contain AlphaNumeric.";
                lbvalenght.Visible = true;
                txtsecfield.Text = "";
                return;
            }

            //Let's decrypt the password for validation.
            if (!Validator.IsValidPassword(Encryption.Decrypt(User.Password)))
            {
                lbvalenght.Text = "<br>Error: Password must be at least 6 characters long and 12 characters maximun, and should only contain AlphaNumeric.";
                lbvalenght.Visible = true;
                txtsecfield.Text = "";
                return;
            }

            //Let's decrypt the password for validation.
            if (Util.FormatTextForInput(Request.Form[Password1.UniqueID]) != Util.FormatTextForInput(Request.Form[Password2.UniqueID]))
            {
                lbvalenght.Text = "<br>Error: Password did not matach. Please re-enter a password and make sure they both match.";
                lbvalenght.Visible = true;
                txtsecfield.Text = "";
                return;
            }

            if (!Validator.IsValidEmail(User.Email1))
            {
                lbvalenght.Text = "<br>Error: Invalid email address. Email address must be a valid format.";
                lbvalenght.Visible = true;
                txtsecfield.Text = "";
                return;
            }

            if (!Validator.IsValidName(User.FirstName))
            {
                lbvalenght.Text = "<br>Error: Firstname should be alphabet and not contain illegal characters.";
                lbvalenght.Visible = true;
                txtsecfield.Text = "";
                return;
            }

            if (!Validator.IsValidName(User.LastName))
            {
                lbvalenght.Text = "<br>Error: Firstname should be alphabet and not contain illegal characters.";
                lbvalenght.Visible = true;
                txtsecfield.Text = "";
                return;
            }

            if (User.CountryID == null)
            {
                lbvalenght.Text = "<br>Error: You must select a country.";
                lbvalenght.Visible = true;
                txtsecfield.Text = "";
                return;
            }

            if (User.AboutMe.Length > 500)
            {
                lbvalenght.Text = "<br>Error: About me text is too long. Maximum of 500 characters.";
                lbvalenght.Visible = true;
                txtsecfield.Text = "";
                return;
            }

            if (User.Website.Length > 75)
            {
                lbvalenght.Text = "<br>Error: Website URL is too long. Maximum of 75 characters.";
                lbvalenght.Visible = true;
                txtsecfield.Text = "";
                return;
            }

            if (Request.Form[txtsecfield.UniqueID] != this.securecode)
            {
                lbvalenght.Text = "<br>Error: Security Code Does not Match.";
                lbvalenght.Visible = true;
                txtsecfield.Text = "";
                return;
            }

            #endregion

            if (UserImageFileUpload.HasFile)
            {
                int FileSize = UserImageFileUpload.PostedFile.ContentLength;
                string contentType = UserImageFileUpload.PostedFile.ContentType;

                //File type validation
                if (!contentType.Equals("image/gif") &&
                    !contentType.Equals("image/jpeg") &&
                    !contentType.Equals("image/jpg") &&
                    !contentType.Equals("image/png"))
                {
                    lbvalenght.Text = "<br>File format is invalid. Only gif, jpg, jpeg or png files are allowed.";
                    lbvalenght.Visible = true;
                    return;
                }
                // File size validation
                if (FileSize > constant.UserImageMaxSize)
                {
                    lbvalenght.Text = "<br>File size exceed the maximun allowed 60000 bytes";
                    lbvalenght.Visible = true;
                    return;

                }
            }

            //ImageUploadManager.UploadUserImage(User, PlaceHolder1, GetUserImage.ImagePathForUserPhoto, constant.UserImageMaxSize);

            if (User.Add(User) != 0)
            {
                JSLiteral.Text = "Error occured while processing your submit.";
                return;
            }

            //EmailAccountActivationLink(User);

            //Create login session variable. During registration we never create login in cookies as we have not asked his permission
            CookieLoginHelper.CreateLoginSession(Util.FormatTextForInput(Request.Form[Username.UniqueID]), Util.FormatTextForInput(Request.Form[Password1.UniqueID]));

            User = null;

            Response.Redirect("/User/" + Util.FormatTextForInput(Request.Form[Username.UniqueID]));
        }
        else
        {

            JSLiteral.Text = Util.JSAlert("Invalid security code. Make sure you type it correctly.");
            return;

            lblinvalidsecode.Text = "Invalid security code. Make sure you type it correctly.";
            lblinvalidsecode.Visible = true;

        }

        Util = null;
    }
コード例 #4
0
ファイル: AddJob.aspx.cs プロジェクト: ranukhandelwal/EC
        public void GenerateDetails(ref string detailtags)
        {
            Utility Util = new Utility();
            detailtags = "<div class=\"jobDetail unit\">" + "<ul> <li>";
            string tmp = "";
            GenerateTableTags(ref tmp, tbldtl);
            if (tmp.Length != 0)
            {
                detailtags += "<h5>" + Util.FormatTextForInput(Request.Form[DetailTbl.UniqueID]) + "</h5>";
                detailtags += tmp;
                detailtags += "<br />";
            }

            tmp = "";
            GenerateTableTags(ref tmp, tbldtl2);
            if (tmp.Length != 0)
            {
                detailtags += "<h5>" + Util.FormatTextForInput(Request.Form[Detail2Tbl.UniqueID]) + "</h5>";
                detailtags += tmp;
                detailtags += "<br />";
            }

            detailtags += "<p><h5>How To Apply: </h5>" + Util.FormatTextForInput(Request.Form[HowToApply.UniqueID]) + "</p>";
            detailtags += "<br />";

            tmp = "";
            GenerateTableTags(ref tmp, tblimpdate);
            if (tmp.Length != 0)
            {
                detailtags += "<h5>" + Util.FormatTextForInput(Request.Form[ImpDatesTbl.UniqueID]) + "</h5>";
                detailtags += tmp;
                detailtags += "<br />";
            }

            detailtags += "<p><h5>How To Prepare: </h5>" + Util.FormatTextForInput(Request.Form[HowToPrepare.UniqueID]) + "</p>";
            detailtags += "<br />";

            tmp = "";
            GenerateTableTags(ref tmp, tblpaidtest);
            if (tmp.Length != 0)
            {
                detailtags += "<h5>" + Util.FormatTextForInput(Request.Form[PaidTestTbl.UniqueID]) + "</h5>";
                detailtags += tmp;
                detailtags += "<br />";
            }

            tmp = "";
            GenerateTableTags(ref tmp, tblfreetest);
            if (tmp.Length != 0)
            {
                detailtags += "<h5>" + Util.FormatTextForInput(Request.Form[FreeTestTbl.UniqueID]) + "</h5>";
                detailtags += tmp;
                detailtags += "<br />";
            }

            detailtags +=
                "</li></ul>";
        }
コード例 #5
0
ファイル: AddJob.aspx.cs プロジェクト: ranukhandelwal/EC
        public void GenerateSummary(ref string summarytags)
        {
            Utility Util = new Utility();
            summarytags = "<div class=\"jobDetail unit\">" +
                    "<table width=\"80%\" border=\"0\"><tr><td align=\"left\"><img src=" + "\"" + Util.FormatTextForInput(Request.Form[logoimg.UniqueID]) + "\"" + "runat=\"server\"" + "/ ><td align=\"right\">" + Util.FormatTextForInput(Request.Form[LastDate.UniqueID]) + "</tr></table> <br /><br /><br />" +
                    "<ul> <li> <table width=\"80%\"> " +
                    "<tr> <td class=\"txt\" width=\"40%\" align=\"left\"><b>Eligibility: </b>" + "<td class=\"txt\" width=\"60%\" align=\"left\">" + Util.FormatTextForInput(Request.Form[Eligiblity.UniqueID]) +
                    "<tr> <td class=\"txt\" width=\"40%\" align=\"left\"><b>Location: </b>" + "<td class=\"txt\" width=\"60%\" align=\"left\">" + Util.FormatTextForInput(Request.Form[Location.UniqueID]) +
                    "<tr> <td class=\"txt\" width=\"40%\" align=\"left\"><b>Job Category: </b>" + "<td class=\"txt\" width=\"60%\" align=\"left\">" + Util.FormatTextForInput(Request.Form[JobCategory.UniqueID]) +
                    "<tr> <td class=\"txt\" width=\"40%\" align=\"left\"><b>Last Date: </b>" + "<td class=\"txt\" width=\"60%\" align=\"left\">" + Util.FormatTextForInput(Request.Form[LastDate.UniqueID]) +
                    "<tr> <td class=\"txt\" width=\"40%\" align=\"left\"><b>Job Type: </b>" + "<td class=\"txt\" width=\"60%\" align=\"left\">" + Util.FormatTextForInput(Request.Form[JobType.UniqueID]) +
                    "<tr> <td class=\"txt\" width=\"40%\" align=\"left\"><b>Hiring Process: </b>" + "<td class=\"txt\" width=\"60%\" align=\"left\">" + Util.FormatTextForInput(Request.Form[HiringProcess.UniqueID]) +
                    "</table>";

            string tmp = "";
            GenerateTableTags(ref tmp, tblsmmry);
            if (tmp.Length != 0)
            {
                summarytags += "<br />";
                summarytags += "<h5>" + Util.FormatTextForInput(Request.Form[SummaryTbl.UniqueID]) + "</h5>";
                summarytags += tmp;
            }

            summarytags += "</li></ul></div>";
        }