Exemplo n.º 1
0
        private void Move_Info(MenuInfo source_info, int dest_cid, int dest_pid, int dest_depth, bool getchild, CMenu BLL)
        {
            if (source_info == null) return;
            int offset_depth = source_info.Depth - (dest_depth + 1);

            MenuInfo info_copy = source_info.copy();
            info_copy.Cid = dest_cid;
            info_copy.Pid = dest_pid;
            info_copy.Depth = dest_depth + 1;
            info_copy.Status = CCommon.GetStatus_upt();
            info_copy.Username = CCommon.Get_CurrentUsername();
            info_copy.Timeupdate = DateTime.Now;
            if (BLL.Save(info_copy))
            {
                //BLL.Updatenum(dest_pid.ToString(), Queryparam.Sqlcolumn.Pis, 1);

                List<MenuInfo> listin = null;
                List<MenuInfo> listsub = BLL.Wcmm_Getlist_sub(source_info.Id, listin);
                if (listsub != null && listsub.Count > 0)
                {
                    foreach (MenuInfo info_sub in listsub)
                    {
                        info_sub.Cid = getchild ? dest_cid : source_info.Cid;
                        info_sub.Pid = getchild ? info_sub.Pid : (info_sub.Pid == source_info.Id ? source_info.Pid : info_sub.Pid);
                        info_sub.Depth = getchild ? info_sub.Depth + offset_depth : info_sub.Depth - 1;
                        info_sub.Status = CCommon.GetStatus_upt();
                        info_sub.Username = CCommon.Get_CurrentUsername();
                        info_sub.Timeupdate = DateTime.Now;
                        BLL.Save(info_sub);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private bool Save_Lang(MenuInfo info)
        {
            try
            {
                if (!CFunctions.IsMultiLanguage() || !chkSaveoption_golang.Checked) return false;

                int lang_num = CConstants.LANG_NUM;
                for (int i = 0; i < lang_num; i++)
                {
                    string lang_val = ConfigurationSettings.AppSettings["LANG_" + i];
                    if (lang_val == CCommon.LANG) continue;

                    MenuInfo lang_info = info.copy();
                    lang_info.Id = 0;
                    lang_info.Status = (int)CConstants.State.Status.Waitactive;
                    (new CMenu(lang_val)).Save(lang_info);
                }
                return true;
            }
            catch
            {
                return false;
            }
        }
Exemplo n.º 3
0
        private void Copy_Info(MenuInfo source_info, int dest_cid, int dest_pid, int dest_depth, bool getchild, CMenu BLL)
        {
            if (source_info == null) return;

            MenuInfo info_copy = source_info.copy();
            info_copy.Id = 0;
            info_copy.Cid = dest_cid;
            info_copy.Pid = dest_pid;
            info_copy.Depth = dest_depth + 1;
            info_copy.Status = CCommon.GetStatus_upt();
            info_copy.Username = CCommon.Get_CurrentUsername();
            info_copy.Timeupdate = DateTime.Now;
            info_copy.Orderd = 0;
            info_copy.Pis = getchild ? info_copy.Pis : (info_copy.Pis > 0 ? 1 : 0);
            if (BLL.Save(info_copy))
            {
                //BLL.Updatenum(dest_pid.ToString(), Queryparam.Sqlcolumn.Pis, 1);
                if (getchild)
                {
                    List<MenuInfo> listsub = BLL.Wcmm_Getlist(source_info.Cid, source_info.Id);
                    if (listsub == null || listsub.Count == 0) return;
                    foreach (MenuInfo info_sub in listsub)
                    {
                        this.Copy_Info(info_sub, dest_cid, info_copy.Id, info_copy.Depth, getchild, BLL);
                    }
                }
            }
        }