示例#1
0
 protected void uiButtonUpdate_Click(object sender, EventArgs e)
 {
     if (CurrentVedio != null)
     {
         BLL.Vedios objData = CurrentVedio;
         objData.ArTitle = uiTextBoxArName.Text;
         objData.EnTitle = uiTextBoxEnName.Text;
         objData.URL = uiTextBoxURL.Text;
         objData.Save();
     }
     else
     {
         Companies objCompany = new Companies();
         objCompany.GetCompanyByUserName(User.Identity.Name);
         BLL.Vedios objData = new BLL.Vedios();
         objData.AddNew();
         objData.ArTitle = uiTextBoxArName.Text;
         objData.EnTitle = uiTextBoxEnName.Text;
         objData.URL = uiTextBoxURL.Text;
         objData.CompanyID = objCompany.CompanyID;
         objData.CreatedDate = DateTime.Now;
         objData.Save();
     }
     uiPanelEdit.Visible = false;
     uiPanelViewVideos.Visible = true;
     Clearfields();
     CurrentVedio = null;
     BindData();
 }
        protected void uiGridViewCompanies_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditCompany")
            {
                Companies objData = new Companies();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                uiTextBoxEnName.Text = objData.EnName;
                uiTextBoxArName.Text = objData.ArName;
                uiTextBoxEnAddress.Text = objData.EnAddress;
                uiTextBoxArAddress.Text = objData.ArAddress;
                uiTextBoxTele.Text = objData.Tele;
                uiTextBoxFax.Text = objData.Fax;
                uiDropDownListCity.SelectedValue = objData.CityID.ToString();
                uiDropDownListCategory.SelectedValue = objData.CategoryID.ToString();
                if (!objData.IsColumnNull("SubCategoryID"))
                {
                    uiDropDownListSubCategory.SelectedValue = objData.SubCategoryID.ToString();
                }
                uiImageLogo.ImageUrl = objData.LogoPath;
                uiLinkButtonResetPassword.Enabled = true;
                uiTextBoxUserName.Text = objData.UserName;
                uiTextBoxPassword.TextMode = TextBoxMode.SingleLine;
                uiTextBoxPassword.Text = Membership.GetUser(objData.UserName).GetPassword();
                uiTextBoxPassword.Enabled = false;
                uiTextBoxUserName.Enabled = false;

                if (!objData.IsColumnNull("PackageTypeID"))
                {
                    uiDropDownListPackages.SelectedValue = objData.PackageTypeID.ToString();
                }
                //  load packjage
                CompanyEnabledOptions options = new CompanyEnabledOptions();
                options.GetCompanyEnabledOptionsByCompanyID(Convert.ToInt32(e.CommandArgument.ToString()));
                for (int i = 0; i < options.RowCount; i++)
                {
                    foreach (ListItem item in uiCheckBoxListPackageOptions.Items)
                    {
                        if (item.Value == options.PackageOptionID.ToString())
                        {
                            item.Selected = options.Enabled;
                            break;
                        }

                    }
                    options.MoveNext();
                }

                uiPanelViewCompanies.Visible = false;
                uiPanelEdit.Visible = true;
                CurrentCompany = objData;
            }
            else if (e.CommandName == "DeleteCompany")
            {

                Companies objData = new Companies();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));

                if (Membership.GetUser(objData.UserName) != null)
                {
                    Membership.DeleteUser(objData.UserName);
                }

                CompanyEnabledOptions options = new CompanyEnabledOptions();
                options.GetCompanyEnabledOptionsByCompanyID(objData.CompanyID);
                options.DeleteAll();
                options.Save();

                Photos pics = new Photos();
                pics.GetPhotosByCompanyID(objData.CompanyID);
                pics.DeleteAll();
                pics.Save();

                BLL.Vedios videos = new BLL.Vedios();
                videos.GetVedioByCompanyID(objData.CompanyID);
                videos.DeleteAll();
                videos.Save();

                objData.MarkAsDeleted();
                objData.Save();

                BindData();
                uiPanelViewCompanies.Visible = true;
                uiPanelEdit.Visible = false;
            }
        }
示例#3
0
        protected void uiGridViewVideos_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditVideo")
            {
                BLL.Vedios objData = new BLL.Vedios();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                uiTextBoxEnName.Text = objData.EnTitle;
                uiTextBoxArName.Text = objData.ArTitle;
                uiTextBoxURL.Text = objData.URL;
                uiPanelViewVideos.Visible = false;
                uiPanelEdit.Visible = true;
                CurrentVedio = objData;
            }
            else if (e.CommandName == "DeleteVideo")
            {
                BLL.Vedios objData = new BLL.Vedios();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                objData.MarkAsDeleted();
                objData.Save();

                BindData();
                uiPanelViewVideos.Visible = true;
                uiPanelEdit.Visible = false;
            }
        }