protected void Page_Load(object sender, EventArgs e)
        {
            // Deny normal user access
            if (Session["userType"].ToString() == Reference.USR_MEM)
            {
                /* string script = "alert('You do not have access to the page.');";
                 * ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script, true); */

                ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect", "alert('You do not have access to this page'); window.location='" +
                                                    Request.ApplicationPath + "ProfileInfo.aspx';", true);
            }

            if (!IsPostBack)
            {
                if (Session["userType"].ToString() == Reference.USR_ADM)
                {
                    Billboard            BillboardObj = new Billboard();
                    Billboard_Management bDao         = new Billboard_Management();
                    //Company CompanyObj = new Company();
                    // Company_Management CDao = new Company_Management();

                    BillboardObj = bDao.getBillboardByID(Session["BillboardID"].ToString());
                    latitude     = BillboardObj.latitude;
                    longtitude   = BillboardObj.Longtitude;
                    //CompanyObj = CDao.getCompanyByID(Session["CompanyID"].ToString());
                    Database db = new Database();
                    //SqlCommand cmd = new SqlCommand("select CodeValue,CodeDesc from CodeReferece where CodeType=Industry ");
                    //DataTable dt = db.getDataTable(cmd);
                    //CoIndustry.DataSource = dt;
                    //CoIndustry.DataValueField = "CodeValue";
                    //CoIndustry.DataTextField = "CodeDesc";
                    //CoIndustry.DataBind();
                    //CoIndustry.Items.Insert(0, new ListItem("---Select An Industry---", "0"));
                    SqlCommand cmd = new SqlCommand("select CodeValue,CodeDesc from CodeReferece where CodeType='Country' ");
                    DataTable  dt  = db.getDataTable(cmd);
                    BBCountry.DataSource     = dt;
                    BBCountry.DataValueField = "CodeValue";
                    BBCountry.DataTextField  = "CodeDesc";
                    BBCountry.DataBind();
                    BBCountry.Items.Insert(0, new ListItem("---Select A Country---", "0"));


                    BBAddLn1.Text           = BillboardObj.AddressLn1;
                    BBAddLn2.Text           = BillboardObj.AddressLn2;
                    BBCity.Text             = BillboardObj.City;
                    BBCountry.SelectedValue = BillboardObj.Country;
                    BBLatitude.Text         = BillboardObj.latitude;
                    BBLongtitude.Text       = BillboardObj.Longtitude;

                    BBPostalCode.Text = BillboardObj.postalCode;
                }
            }
        }
        protected void updateBtn_Click(object sender, EventArgs e)
        {
            if (BBCountry.SelectedValue == "" || BBAddLn1.Text == "" ||
                BBCity.Text == "" || BBPostalCode.Text == "" || BBLatitude.Text == "" || BBLongtitude.Text == "")
            {
                alertWarning.Visible = true;
                alertSuccess.Visible = false;
            }

            else
            {
                Billboard_Management bDAO = new Billboard_Management();
                //Company_Management cDAO = new Company_Management();
                // string companyName = CoName.Text;
                // string Industry = CoIndustry.SelectedValue;

                string Addr1      = BBAddLn1.Text.ToString();
                string Addr2      = BBAddLn2.Text.ToString();
                string City       = BBCity.Text.ToString();
                string Country    = BBCountry.SelectedItem.Value.ToString();
                string latitude   = BBLatitude.Text.ToString();
                string Longtitude = BBLongtitude.Text.ToString();
                string postalCode = BBPostalCode.Text.ToString();
                string lastUpdBy  = Session["userID"].ToString();
                string lastUpdOn  = DateTime.Now.ToString("MM/dd/yyyy h:mm tt");
                //(string BillboardID, string AddressLn1, string AddressLn2, string City, string Country, string latitude, string Longtitude, string postalCode, string lastUpdBy, string lastUpdOn)
                Boolean insCnt = bDAO.BBInfoUpdate(Session["BillboardID"].ToString(), Addr1, Addr2, City, Country, latitude, Longtitude, postalCode, lastUpdBy, lastUpdOn);
                alertWarning.Visible = false;
                alertSuccess.Visible = true;

                BBAddLn1.Text = String.Empty;
                BBAddLn2.Text = String.Empty;
                BBCountry.SelectedItem.Value = "";
                BBCity.Text         = String.Empty;
                BBPostalCode.Text   = String.Empty;
                BBLatitude.Text     = String.Empty;
                BBLongtitude.Text   = String.Empty;
                Session["BBUpdate"] = 2;
                Response.Redirect("BillboardList.aspx");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Billboard            BillboardObj = new Billboard();
                Billboard_Management bDao         = new Billboard_Management();
                //Company CompanyObj = new Company();
                // Company_Management CDao = new Company_Management();

                BillboardObj = bDao.getBillboardByID(Session["BillboardID"].ToString());
                latitude     = BillboardObj.latitude;
                longtitude   = BillboardObj.Longtitude;
                //CompanyObj = CDao.getCompanyByID(Session["CompanyID"].ToString());
                Database db = new Database();
                //SqlCommand cmd = new SqlCommand("select CodeValue,CodeDesc from CodeReferece where CodeType=Industry ");
                //DataTable dt = db.getDataTable(cmd);
                //CoIndustry.DataSource = dt;
                //CoIndustry.DataValueField = "CodeValue";
                //CoIndustry.DataTextField = "CodeDesc";
                //CoIndustry.DataBind();
                //CoIndustry.Items.Insert(0, new ListItem("---Select An Industry---", "0"));
                SqlCommand cmd = new SqlCommand("select CodeValue,CodeDesc from CodeReferece where CodeType='Country' ");
                DataTable  dt  = db.getDataTable(cmd);
                BBCountry.DataSource     = dt;
                BBCountry.DataValueField = "CodeValue";
                BBCountry.DataTextField  = "CodeDesc";
                BBCountry.DataBind();
                BBCountry.Items.Insert(0, new ListItem("---Select A Country---", "0"));


                BBAddLn1.Text           = BillboardObj.AddressLn1;
                BBAddLn2.Text           = BillboardObj.AddressLn2;
                BBCity.Text             = BillboardObj.City;
                BBCountry.SelectedValue = BillboardObj.Country;
                BBLatitude.Text         = BillboardObj.latitude;
                BBLongtitude.Text       = BillboardObj.Longtitude;

                BBPostalCode.Text = BillboardObj.postalCode;
            }
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Billboard            BillboardObj = new Billboard();
                Billboard_Management bDao         = new Billboard_Management();

                BillboardObj = bDao.getBillboardByID(Session["BillboardID"].ToString());
                latitude     = BillboardObj.latitude;
                longtitude   = BillboardObj.Longtitude;
                this.BindGrid();
            }

            try
            {
                var rowIndex    = 0;
                var hiddenvalue = (string)GridView1.DataKeys[rowIndex]["BillboardCode"];
                BillboardCodelabel.Text = " for " + hiddenvalue.ToString();
            }
            catch (System.ArgumentOutOfRangeException ArgumentOutOfRangeException)
            {
            }
        }
Пример #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Deny normal user access
            if (Session["userType"].ToString() == Reference.USR_MEM)
            {
                /* string script = "alert('You do not have access to the page.');";
                 * ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script, true); */

                ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect", "alert('You do not have access to this page'); window.location='" +
                                                    Request.ApplicationPath + "ProfileInfo.aspx';", true);
            }

            if (!IsPostBack)
            {
                if (Session["userType"].ToString() == Reference.USR_ADM)
                {
                    Billboard            BillboardObj = new Billboard();
                    Billboard_Management bDao         = new Billboard_Management();

                    BillboardObj = bDao.getBillboardByID(Session["BillboardID"].ToString());
                    latitude     = BillboardObj.latitude;
                    longtitude   = BillboardObj.Longtitude;
                    this.BindGrid();
                }
            }

            try
            {
                var rowIndex    = 0;
                var hiddenvalue = (string)GridView1.DataKeys[rowIndex]["BillboardCode"];
                BillboardCodelabel.Text = " for " + hiddenvalue.ToString();
            }
            catch (System.ArgumentOutOfRangeException ArgumentOutOfRangeException)
            {
            }
        }
        protected void btnDelete_Command(object sender, CommandEventArgs e)
        {
            if (e.CommandName == "DeleteBBMessage")
            {
                SqlConnection conn   = null;
                SqlDataReader reader = null;



                // instantiate and open connection
                conn = new
                       SqlConnection(Reference.Constr);
                conn.Open();


                int index = Convert.ToInt32(e.CommandArgument);


                // Retrieve the row that contains the button
                // from the Rows collection.
                GridViewRow row        = GridView1.Rows[index];
                LinkButton  btnButton1 = sender as LinkButton;
                GridViewRow gvRow1     = (GridViewRow)btnButton1.NamingContainer;
                Billboard   bObj       = new Billboard();

                Billboard_Management bDao = new Billboard_Management();



                Label lb_msgId = (Label)gvRow1.FindControl("lb_BillboardID");

                bObj = bDao.getBillboardByID(lb_msgId.Text);
                string     BBCode   = bObj.BillboardCode;
                SqlCommand cmdcount = new SqlCommand("Select count(*) as total from BillboardLocation as b inner join AdvertisementLocation al on b.BillboardID=al.BillboardID inner join Advertisement a2 on" +
                                                     " al.AdvID=a2.AdvID where al.BillboardID=@ID and a2.status=1", conn);
                SqlParameter paramCount = new SqlParameter();
                paramCount.ParameterName = "@ID";
                paramCount.Value         = bObj.BillboardID.ToString();
                cmdcount.Parameters.Add(paramCount);
                SqlDataAdapter sdacount = new SqlDataAdapter();
                DataTable      dt       = new DataTable();
                cmdcount.Connection    = conn;
                sdacount.SelectCommand = cmdcount;
                sdacount.Fill(dt);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    int count = Convert.ToInt32(dt.Rows[i]["total"]);
                    if (count == 0)
                    {
                        Boolean insCnt = bDao.deleteBillboard(lb_msgId.Text);

                        //VIC: never inform if the delete is successful or not?
                        alertSuccess.Visible  = true;
                        DeleteFailure.Visible = false;
                        createSuccess.Visible = false;
                        updateSuccess.Visible = false;
                        msgSuccess.Text       = " Billboard #" + BBCode + " has been deleted successfully!";
                    }
                    else
                    {
                        DeleteFailure.Visible = true;
                        alertSuccess.Visible  = false;
                        createSuccess.Visible = false;
                        updateSuccess.Visible = false;
                        LabelError.Text       = "There are " + count + " Advertisement(s) in Billboard " + BBCode + ".Please delete existing advertisement(s) first before proceeding to delete the Billboard.";
                    }
                }



                Database db = new Database();

                SqlCommand cmd = new SqlCommand("Select * from [BillboardLocation] WHERE Status = 1");
                DataSet    ds  = db.getDataSet(cmd);

                //gvUser.DataSource = ds;
                GridView1.DataBind();
            }
        }
Пример #7
0
        protected void SubmitBtn_Click(object sender, EventArgs e)
        {
            SqlConnection conn   = null;
            SqlDataReader reader = null;



            // instantiate and open connection
            conn = new
                   SqlConnection(Reference.Constr);
            conn.Open();
            String   BillboardCode = BBLocationCode.Text.ToString();
            String   AddressLn1    = BBAddLn1.Text.ToString();
            String   AddressLn2    = BBAddLn2.Text.ToString();
            String   City          = BBCity.Text.ToString();
            String   Country       = (BBCountry.SelectedItem.Value.ToString());
            String   PostalCode    = BBPostalCode.Text.ToString();
            DateTime CreatedOn     = DateTime.Now;
            int      Status        = 1;
            string   latitude      = BBLatitude.Text.ToString();
            int      CreatedBy     = 1;
            string   Longtitude    = BBLongtitude.Text.ToString();

            Billboard_Management bbMgmt = new Billboard_Management();
            //che ee was here
            // Boolean record = bbMgmt.BBcheck(BillboardCode);



            SqlCommand   sCmd  = new SqlCommand("SELECT Count(*) FROM BillboardLocation WHERE BillboardCode=@BCode and status=1", conn);
            SqlParameter param = new SqlParameter();

            param.ParameterName = "@BCode";
            param.Value         = BillboardCode;
            sCmd.Parameters.Add(param);
            Int32 totalcount = Convert.ToInt32(sCmd.ExecuteScalar());


            //if (BBLocationCode.Text == "" || BBAddLn1.Text == "" || BBCity.Text == "" || BBCountry.SelectedValue == "" ||
            //    BBPostalCode.Text == "" || BBLatitude.Text == "" || BBLongtitude.Text == "")
            //{
            //    alertWarning.Visible = true;
            //    alertSuccess.Visible = false;
            //    alertDanger.Visible = false;
            //    warningLocation.Text = "Please enter All Required Fields";

            //}

            //else
            //{
            if (totalcount == 0)
            {
                Boolean result = bbMgmt.BBinsert(BillboardCode, AddressLn1, AddressLn2, City, Country, PostalCode, CreatedOn, Status, latitude, Longtitude, CreatedBy);
                if (result == true)
                {
                    //alertWarning.Visible = false;
                    //alertSuccess.Visible = true;
                    //BBLocationCode.Text = String.Empty;
                    //BBAddLn1.Text = String.Empty;
                    //BBAddLn2.Text = String.Empty;
                    //BBCountry.SelectedValue = "";
                    //BBCity.Text = String.Empty;
                    //BBPostalCode.Text = String.Empty;

                    Session["BBCreate"] = 2;
                    Response.Redirect("BillboardList.aspx");
                }
            }

            else
            {
                alertWarning.Visible = false;
                alertSuccess.Visible = false;
                alertDanger.Visible  = true;
                dangerLocation.Text  = "Billboard Code already exist";
            }

            //}
        }