Example #1
0
        protected void btnCheckout_Click(object sender, EventArgs e)
        {
            dataAccess database     = new dataAccess();
            advertiser purchaseUnts = new advertiser();
            Int64      ID           = 0;
            string     insertString = "INSERT INTO jobsdb_UnitOrder (Employer, UnitQty, UnitAmount, Date, Paid, Credited, Active) VALUES ('" + purchaseUnts.getCompanyID(User.Identity.Name) +
                                      "','" + txtTotalUnits.Text.ToString() + "','" + unitAmount + "',GETDATE(),'N','N','Y'); SELECT SCOPE_IDENTITY()";

            ID = database.insertData_ReturnID(insertString);

            Response.Redirect("Order.aspx?OrderID=" + ID);
        }
Example #2
0
        protected void btnPost_Click(object sender, EventArgs e)
        {
            SqlConnection connString = new SqlConnection(ConfigurationManager.ConnectionStrings["ZamJobsConnString"].ConnectionString);

            string     title        = txtJobTitle.Text;
            string     overview     = txtJobOverview.Text;
            string     companyEmail = User.Identity.Name;
            dataAccess advertiser   = new dataAccess();
            advertiser post         = new advertiser();
            string     totalUnits   = post.GetUnitCountByEmail(User.Identity.Name);
            DataTable  IdTbl        = advertiser.getTable("SELECT ID FROM jobsdb_Employer WHERE email = '" + companyEmail + "'");
            Int16      companyID    = Convert.ToInt16(IdTbl.Rows[0]["ID"]);
            Int16      country      = Convert.ToInt16(ddlCountry.SelectedValue);
            Int16      region       = 0;

            if (ddlRegion.SelectedValue != "")
            {
                region = Convert.ToInt16(ddlRegion.SelectedValue);
            }
            Int16 location = 0;

            if (ddlLocation.SelectedValue != "")
            {
                location = Convert.ToInt16(ddlLocation.SelectedValue);
            }
            Int16 type     = Convert.ToInt16(ddlJobType.SelectedValue);
            Int16 category = Convert.ToInt16(ddlCategory.SelectedValue);
            Int16 jobType  = Convert.ToInt16(ddlJobType.SelectedValue);

            Int16  experience         = Convert.ToInt16(ddlWorkExperience.SelectedValue);
            string exerienceComment   = txtWorkExperience.Text;
            Int16  education          = Convert.ToInt16(ddlEducation.SelectedValue);
            string educationComment   = txtEducation.Text;
            string personalAttributes = txtPesonalAttributes.Text;
            string competencies       = txtCompetencies.Text;
            string postDate           = string.Format("{0:yyyy/MM/dd}", DateTime.Today);
            int    unitAmount         = 0;
            string expiryDate         = string.Format("{0:yyyy/MM/dd}", DateTime.Now.AddDays(Convert.ToDouble(ddlAdvertLength.SelectedValue.ToString())));

            if (ddlAdvertLength.SelectedValue.ToString() == "15")
            {
                unitAmount = 1;
            }
            else if (ddlAdvertLength.SelectedValue.ToString() == "30")
            {
                unitAmount = 2;
            }


            // create query string to insert data in database
            string insertString = @"
                        insert into jobsdb_JobPost
                        (Title,Overview,Company,Country,Region,Location,Category,Type,
                        WorkExperience,WorkExperienceComment,EducationLevel,EducationLevelComment,PersonalAttributes,Competencies,PostDate,ExpireDate)
                        values ('" + title + "','" + overview + "','" + companyID + "','" + country + "','" + region + "','" + location +
                                  "','" + category + "','" + type + "','" + experience + "','" + exerienceComment + "','" + education +
                                  "','" + educationComment + "','" + personalAttributes + "','" + competencies + "','" + postDate + "','" + expiryDate + "'); SELECT SCOPE_IDENTITY()";

            try
            {
                bool flag = post.DepleteUnitsByEmail(unitAmount, User.Identity.Name);
                //Redirect user to success page
                if (flag)
                {
                    //SqlCommand cmd = new SqlCommand(insertString, connString);
                    Int64 id = advertiser.insertData_ReturnID(insertString);
                    //connString.Open();
                    // Call ExecuteNonQuery to send command
                    //cmd.ExecuteNonQuery();
                    //connString.Close();
                    Response.Redirect("PostSuccessfull.aspx?PostID=" + id + "&type=n&amt=" + unitAmount.ToString() + "&units=" + totalUnits);
                }
                else
                {
                }
            }
            catch (SqlException)
            {
                Response.Redirect("PostUnsuccessfull.aspx");
            }
        }