private DAMenuItem CreateObjectFromPage() { // check DAMenuItem daMenuItem = new DAMenuItem(); // daMenuItem.fMenuItem = fMenuItem.Value.Trim(); daMenuItem.fParentID = Convert.ToInt32(fParentID.Value.Trim()); daMenuItem.fUrl = fUrl.Value.Trim(); daMenuItem.fUrlRewrite = fUrlRewrite.Value.Trim(); daMenuItem.fMenuID = Convert.ToInt32(fMenuID.Value.Trim()); daMenuItem.fPos = Convert.ToInt32(fPos.Value.Trim()); daMenuItem.fActive = fActive.Checked; HttpPostedFile file = inputFile.PostedFile; if (file != null && file.ContentLength > 0) { //Delete old file Utils.DeleteFile(fImg.ImageUrl, Server); daMenuItem.fImg = Utils.UploadImage(file, Server, "~/Media/MenuItem"); } else { daMenuItem.fImg = fImg.ImageUrl.Replace("~", ""); } fImg.ImageUrl = "~" + daMenuItem.fImg; daMenuItem.fCss = fCss.Value.Trim(); // return(daMenuItem); }
override protected int DeleteByID(int pID) { try { DAMenuItem DAMenuItem = new DAMenuItem(); DAMenuItem.USP_MenuItem_Delete(pID); return(1); } catch { return(0); } }
override protected int ExecUpdate() { // Update with ID = this.ID try { DAMenuItem DAMenuItem = CreateObjectFromPage(); DAMenuItem.fID = this.KeyID; DAMenuItem.USP_MenuItem_Update(); return(1); } catch { return(0); } }
// Hiển thị menu private void LoadMenu() { try { DAMenuItem oData = new DAMenuItem(); dt.Load(oData.Client_USP_MenuItem_GetByMenuID(1)); // Lay menu cha //DataTable dtParent = dt.Select("ParentID = 0").CopyToDataTable(); DataView dv = new DataView(dt, "ParentID = 0", "Pos", DataViewRowState.CurrentRows); //rptMenu.DataSource = dv; //rptMenu.DataBind(); } catch { } }
override protected Boolean GetDataComboBox() { try { DAMenu daMenu = new DAMenu(); fMenuID.DataSource = daMenu.USP_Menu_GetDataForComboBox(); fMenuID.DataBind(); DAMenuItem daMenuItem = new DAMenuItem(); fParentID.DataSource = daMenuItem.USP_MenuItem_GetDataForComboBox(this.KeyID); fParentID.DataBind(); return(true); } catch (Exception ex) { ShowErrorMes("Lỗi hệ thống: " + ex.Message); return(false); } }
override protected int ExecInsert() { try { DAMenuItem DAMenuItem = CreateObjectFromPage(); if (this.mode == ActParam.New) { DAMenuItem.fID = DAMenuItem.USP_GetKey(); this.KeyID = DAMenuItem.fID; // --> Update new SessionID for continue edit. } else { DAMenuItem.fID = 0; } DAMenuItem.USP_MenuItem_Insert(); return(1); } catch { return(0); } }
override protected Boolean LoadData() { try { // Load Data For Page. DAMenuItem daMenuItem = new DAMenuItem(); daMenuItem.USP_MenuItem_GetFullID(this.KeyID); // fMenuItem.Value = daMenuItem.fMenuItem.ToString(); fParentID.Value = daMenuItem.fParentID.ToString(); fUrl.Value = daMenuItem.fUrl.ToString(); fUrlRewrite.Value = daMenuItem.fUrlRewrite.ToString(); fMenuID.Value = daMenuItem.fMenuID.ToString(); fPos.Value = daMenuItem.fPos.ToString(); fActive.Checked = daMenuItem.fActive; fImg.ImageUrl = "~" + daMenuItem.fImg.ToString(); fCss.Value = daMenuItem.fCss.ToString(); // // Khi cần enabled cột nào //if (this.KeyID > 0) //{ // if (mode != Act.Clone) // fUserName.Enabled = false; // else // fUserName.Text = ""; //} } catch (Exception e) { ShowErrorMes("Lỗi hệ thống: " + e.ToString()); return(false); } return(true); }