Example #1
0
        public static void updateOrder(string layplug, string layid, string thuTu, string ilist)
        {
            UserFunction itemUpdate = UserFunctionDal.SelectById(Convert.ToInt32(layplug));

            itemUpdate.LAY_ID = Convert.ToInt32(layid);
            itemUpdate.ThuTu  = Convert.ToInt32(thuTu);
            itemUpdate        = UserFunctionDal.Update(itemUpdate);
            UserFunctionDal.UpdateReorder(ilist);
        }
Example #2
0
        public static string updatePlug(string layplug, string ilist, string plugtype)
        {
            XmlDocument doc  = new XmlDocument();
            XmlNode     node = doc.ImportNode(PlugHelper.RenderXml(toList(ilist), plugtype), true);

            doc.AppendChild(node);
            UserFunction itemUpdate = UserFunctionDal.SelectById(Convert.ToInt32(layplug));

            itemUpdate.Doc = linh.common.Lib.GetXmlString(doc);
            itemUpdate     = UserFunctionDal.Update(itemUpdate);
            return(PlugHelper.RenderHtml(doc));
        }
Example #3
0
        protected override void Render(HtmlTextWriter writer)
        {
            StringBuilder       sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;
            string subAct          = Request["subAct"];

            switch (subAct)
            {
            case "menu":
                //List<Function> MenuList = getTree(FunctionDal.SelectByUser(Security.Username));
                //List<jgridRow> ListRow = new List<jgridRow>();
                //foreach (Function fn in MenuList)
                //{
                //    if (fn.Loai != 3)
                //    {
                //        ListRow.Add(new jgridRow(fn.ID.ToString(), new string[] { fn.ID.ToString(), fn.Ten, fn.Url, fn.Level.ToString(), fn.PID.ToString(), fn.Level == 1 ? "false" : "true", "false" }));
                //    }
                //}
                //jgrid grid = new jgrid("1", "1", MenuList.Count.ToString(), ListRow);
                //sb.Append(JavaScriptConvert.SerializeObject(grid));
                sb.AppendFormat(getTop(getTree(FunctionDal.SelectByUser(Security.Username, "0"))));
                break;

            case "desk":
                sb.AppendFormat(@"<script src=""{0}"" type=""text/javascript""></script>"
                                , cs.GetWebResourceUrl(typeof(Class1), "docsoft.plugin.plugManager.admin.js"));
                sb.AppendFormat(@"<div id=""desktopMdl-content-head"">
                    <a href=""javascript:;"" id=""desktopMdl-content-head-showbtn"">
                    <span id=""desktopMdl-content-head-showbtn-title"" class=""ui-widget-content ui-corner-top"">
                    Thêm Module
                    </span>
                    <span id=""desktopMdl-content-head-showbtn-box"">
                        <span class=""ui-widget-content ui-corner-all"" id=""desktopMdl-content-head-showbtn-boxPnl"">
                            <span class=""ui-widget-content ui-corner-all"" id=""desktopMdl-content-head-showbtn-boxPnl-content"">");

                FunctionCollection UFC = FunctionDal.SelectByUser(Security.Username, "1");
                foreach (Function ufcItem in UFC)
                {
                    sb.AppendFormat(@"<span onclick=""myModule.add('{0}','{1}')"" class=""desktopMdl-content-head-showbtn-boxPnl-content-item""><span onclick=""myModule.add('{0}','{1}')"" class=""desktopMdl-content-button-add"">Add</span>{2}</span>", ufcItem.ID, ufcItem.Url, ufcItem.Ten);
                }
                sb.AppendFormat(@"</span>
                        </span>
                    </span>
                    </a>");
                Member mMember = MemberDal.SelectAllByUserName(Security.Username);

                sb.AppendFormat(@"<b id=""desktopMdl-content-head-title"">Phiên làm việc: {0} <span id=""desktopMdl-content-head-date"">{1}</span></b>
                </div>", mMember.Ten.ToString(), string.Format("{0:dd/MM/yyyy}", DateTime.Now));
                sb.AppendFormat(@"<div id=""desktopMdl-content-body"">");
                sb.Append("</div>");
                break;

            case "Update":
                if (!string.IsNullOrEmpty(Request["layplug"]))
                {
                    string      layplug = Request["layplug"];
                    XmlDocument doc     = new XmlDocument();
                    XmlNode     node    = doc.ImportNode(PlugHelper.RenderXml(toList(Request["iList"]), Request["plugtype"]), true);
                    doc.AppendChild(node);
                    UserFunction itemUpdate = UserFunctionDal.SelectById(Convert.ToInt32(layplug));
                    itemUpdate.Doc = linh.common.Lib.GetXmlString(doc);
                    itemUpdate     = UserFunctionDal.Update(itemUpdate);
                    sb.Append(PlugHelper.RenderHtml(doc));
                }
                break;

            case "ReOrder":
                if (!string.IsNullOrEmpty(Request["NewZoneIndex"]))
                {
                    string       layplug    = Request["layplug"];
                    string       layid      = Request["NewZoneIndex"];
                    UserFunction itemUpdate = UserFunctionDal.SelectById(Convert.ToInt32(layplug));
                    itemUpdate.LAY_ID = Convert.ToInt32(layid);
                    itemUpdate.ThuTu  = Convert.ToInt32(Request["NewModuleIndex"]);
                    itemUpdate        = UserFunctionDal.Update(itemUpdate);
                    UserFunctionDal.UpdateReorder(Request["NewZoneOrderList"]);
                }
                break;

            case "Remove":
                if (!string.IsNullOrEmpty(Request["layplug"]))
                {
                    string       layplug    = Request["layplug"];
                    UserFunction itemRemove = UserFunctionDal.SelectById(Convert.ToInt32(layplug));
                    UserFunctionDal.DeleteById(itemRemove.ID);
                }
                break;

            case "Add":
                string _FN_ID    = Request["FN_ID"];
                string _Url      = Request["Url"];
                string _LayID    = Request["LayID"];
                string _DocValue = "";
                try
                {
                    XmlDocument doc  = new XmlDocument();
                    XmlNode     node = doc.ImportNode(PlugHelper.RenderXml(_Url), true);
                    doc.AppendChild(node);
                    _DocValue = linh.common.Lib.GetXmlString(doc);
                    UserFunction ItemSave = new UserFunction();
                    ItemSave.FN_ID    = Convert.ToInt32(_FN_ID);
                    ItemSave.FN_Url   = _Url;
                    ItemSave.LAY_ID   = Convert.ToInt32(_LayID);
                    ItemSave.NgayTao  = DateTime.Now;
                    ItemSave.NguoiTao = Security.Username;
                    ItemSave.Username = Security.Username;
                    ItemSave.ThuTu    = 1;
                    ItemSave.RowId    = Guid.NewGuid();
                    ItemSave.Doc      = _DocValue;
                    ItemSave          = UserFunctionDal.Insert(ItemSave);

                    sb.Append(PlugHelper.RenderHtml(doc.LastChild, ItemSave.ID));
                }
                catch (Exception ex)
                {
                }
                break;

            default:
                break;
            }
            sb.AppendFormat(@"<script src=""{0}"" type=""text/javascript""></script>"
                            , cs.GetWebResourceUrl(typeof(Class1), "docsoft.plugin.plugManager.admin.js"));
            writer.Write(sb.ToString());
            base.Render(writer);
        }