private void AddNewRecord() { Categories objData = new Categories(); objData.AddNew(); objData.Title = uiTextBoxArName.Text; if (uiFileUploadPicturePath.HasFile) { uiFileUploadPicturePath.SaveAs(Server.MapPath("~/UploadedFiles/Cats/" + uiFileUploadPicturePath.FileName)); objData.IconPath = "/UploadedFiles/Cats/" + uiFileUploadPicturePath.FileName; } objData.TypeID = 2; objData.Save(); }
protected void uiGridViewCategories_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditCategory") { Categories objData = new Categories(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); uiTextBoxArName.Text = objData.Title; uiPanelViewCategories.Visible = false; uiPanelEdit.Visible = true; CurrentCategory = objData; } else if (e.CommandName == "DeleteCategory") { Categories objData = new Categories(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); objData.MarkAsDeleted(); objData.Save(); CurrentCategory = null; BindData(); } }
private void AddNewRecord() { Categories objData = new Categories(); objData.AddNew(); objData.Title = uiTextBoxArName.Text; if (uiFileUploadPicturePath.HasFile) { uiFileUploadPicturePath.SaveAs(Server.MapPath("~/UploadedFiles/Cats/" + uiFileUploadPicturePath.FileName)); objData.IconPath = "/UploadedFiles/Cats/" + uiFileUploadPicturePath.FileName; } objData.TypeID = 4; objData.PageID = Convert.ToInt32(uiDropDownListPages.SelectedValue); objData.Save(); }