protected void uiButtonUpdate_Click(object sender, EventArgs e)
        {
            if (CurrentAdsLocation != null)
            {
                AdsLocations objData = CurrentAdsLocation;
                objData.EnTitle = uiTextBoxEnName.Text;
                objData.ArTitle = uiTextBoxArName.Text;
                if (!string.IsNullOrEmpty(uiTextBoxTimeOut.Text))
                    objData.AdsTimeout = Convert.ToInt32(uiTextBoxTimeOut.Text);
                objData.Description = uiTextBoxDesc.Text;
                if(!string.IsNullOrEmpty(uiTextBoxWidth.Text))
                    objData.Width = Convert.ToInt32(uiTextBoxWidth.Text);
                if (!string.IsNullOrEmpty(uiTextBoxHeight.Text))
                    objData.Height = Convert.ToInt32(uiTextBoxHeight.Text);
                if (uiFileUploadAdLocation.HasFile)
                {
                    uiFileUploadAdLocation.SaveAs(Server.MapPath("~/FileUploads/AdsLocations" + uiFileUploadAdLocation.FileName));
                    objData.AdLocationPhoto = "/FileUploads/AdsLocations" + uiFileUploadAdLocation.FileName;
                }
                objData.Save();
            }
            else
            {
                AdsLocations objData = new AdsLocations ();
                objData.AddNew();
                objData.EnTitle = uiTextBoxEnName.Text;
                objData.ArTitle = uiTextBoxArName.Text;
                if (!string.IsNullOrEmpty(uiTextBoxTimeOut.Text))
                    objData.AdsTimeout = Convert.ToInt32(uiTextBoxTimeOut.Text);
                objData.Description = uiTextBoxDesc.Text;
                if (!string.IsNullOrEmpty(uiTextBoxWidth.Text))
                    objData.Width = Convert.ToInt32(uiTextBoxWidth.Text);
                if (!string.IsNullOrEmpty(uiTextBoxHeight.Text))
                    objData.Height = Convert.ToInt32(uiTextBoxHeight.Text);
                if (uiFileUploadAdLocation.HasFile)
                {
                    uiFileUploadAdLocation.SaveAs(Server.MapPath("~/FileUploads/AdsLocations" + uiFileUploadAdLocation.FileName));
                    objData.AdLocationPhoto = "/FileUploads/AdsLocations" + uiFileUploadAdLocation.FileName;
                }
                objData.Save();
            }

            uiPanelEdit.Visible = false;
            uiPanelViewAdsLocations.Visible = true;
            BindData();
            CurrentAdsLocation = null;
            Clearfields();
        }
        protected void uiGridViewAdsLocations_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditLocation")
            {
                AdsLocations objData = new AdsLocations();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                uiTextBoxEnName.Text = objData.EnTitle;
                uiTextBoxArName.Text = objData.ArTitle;

                try
                {
                    uiTextBoxTimeOut.Text = objData.AdsTimeout.ToString();
                }
                catch (Exception ex)
                {
                    uiTextBoxTimeOut.Text = "";
                }
                uiTextBoxDesc.Text = objData.Description;

                try
                {
                    uiTextBoxWidth.Text = objData.Width.ToString();
                }
                catch (Exception ex)
                {
                    uiTextBoxWidth.Text = "";
                }

                try
                {
                    uiTextBoxHeight.Text = objData.Height.ToString();
                }
                catch (Exception ex)
                {
                    uiTextBoxHeight.Text = "";
                }

                CurrentAdsLocation = objData;
                uiPanelViewAdsLocations.Visible = false;
                uiPanelEdit.Visible = true;
            }
            else if (e.CommandName == "DeleteLocation")
            {
                AdsLocations objData = new AdsLocations();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                objData.MarkAsDeleted();
                objData.Save();
            }
        }