protected void uiGridViewCategories_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditCategory") { VedioCategories objData = new VedioCategories(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); uiTextBoxEnName.Text = objData.EnName; uiTextBoxArName.Text = objData.ArName; uiTextBoxEnDesc.Text = objData.EnDescription; uiTextBoxArDesc.Text = objData.ArDescription; uiPanelViewCategories.Visible = false; uiPanelEdit.Visible = true; CurrentCategory = objData; } else if (e.CommandName == "DeleteCategory") { VedioCategories objData = new VedioCategories(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); objData.MarkAsDeleted(); objData.Save(); CurrentCategory = null; BindData(); } }
private void AddNewRecord() { VedioCategories objData = new VedioCategories(); objData.AddNew(); objData.EnName = uiTextBoxEnName.Text; objData.ArName = uiTextBoxArName.Text; objData.EnDescription = uiTextBoxEnDesc.Text; objData.ArDescription = uiTextBoxArDesc.Text; string filepath = ""; if (uiFileUploadLogoPath.HasFile) { uiFileUploadLogoPath.SaveAs(Server.MapPath("~/FileUploads/VedioCategories" + "/" + uiFileUploadLogoPath.FileName)); filepath = "/Fileuploads/VedioCategories" + "/" + uiFileUploadLogoPath.FileName; } if (!string.IsNullOrEmpty(filepath)) { objData.IconPath = filepath; } objData.Save(); }