示例#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);
                    }
                }
            }
        }
示例#2
0
        protected void cmdUpdateorder_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                if (grdView.Rows.Count == 0) return;

                CMenu BLL = new CMenu(CCommon.LANG);
                foreach (GridViewRow row in grdView.Rows)
                {
                    HiddenField txtId = (HiddenField)row.FindControl("txtId");
                    TextBox txtOrderd = (TextBox)row.FindControl("txtOrderd");
                    if (txtId != null && txtOrderd != null)
                    {
                        int id = int.Parse(txtId.Value);
                        int orderd = 0;
                        int.TryParse(txtOrderd.Text, out orderd);
                        BLL.Updatenum(id.ToString(), Queryparam.Sqlcolumn.Orderd, orderd);
                    }
                    lstError = new List<Errorobject>();
                    lstError = Form_GetError(lstError, Errortype.Completed, Definephrase.Saveorderd_completed, "", null);
                    Master.Form_ShowError(lstError);
                }
            }
            catch
            {
                lstError = new List<Errorobject>();
                lstError = Form_GetError(lstError, Errortype.Error, Definephrase.Saveorderd_error, "", null);
                Master.Form_ShowError(lstError);
            }
        }
示例#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);
                    }
                }
            }
        }
示例#4
0
        protected void cmdMoveOk_Click(object sender, EventArgs e)
        {
            try
            {
                string iidstr = txtIidstr.Value;
                int dest_cid = int.Parse(ddlMovecid.SelectedValue);
                int dest_pid = int.Parse(ddlMovepid.SelectedValue);
                bool getchild = chkMoveoption_getchild.Checked;

                lstError = new List<Errorobject>();
                if (CFunctions.IsNullOrEmpty(iidstr) || dest_cid == 0)
                {
                    lstError = Form_GetError(lstError, Errortype.Error, Definephrase.Move_error, "", null);
                    Master.Form_ShowError(lstError);
                    return;
                }

                CMenu BLL = new CMenu(CCommon.LANG);
                MenuInfo parent_info = BLL.Wcmm_Getinfo(dest_pid);
                int dest_depth = parent_info == null ? 1 : parent_info.Depth;
                string[] iidarr = iidstr.Split(',');
                bool isDup = false;
                for (int i = 0; i < iidarr.Length; i++)
                {
                    MenuInfo info = BLL.Wcmm_Getinfo(int.Parse(iidarr[i]));
                    if (info.Id != dest_pid)
                    {
                        if (info.Pid != 0)
                            BLL.Updatenum(info.Pid.ToString(), Queryparam.Sqlcolumn.Pis, CConstants.NUM_DECREASE);
                        this.Move_Info(info, dest_cid, dest_pid, dest_depth, getchild, BLL);
                    }
                    else
                        isDup = true;
                }
                if (parent_info != null)
                {
                    int pis = parent_info.Pis == 0 ? iidarr.Length + 1 : iidarr.Length + parent_info.Pis;
                    if (isDup) pis--;
                    BLL.Updatenum(dest_pid.ToString(), Queryparam.Sqlcolumn.Pis, pis);
                }

                cmdMoveOk.Enabled = false;
                lstError = Form_GetError(lstError, Errortype.Completed, Definephrase.Move_completed, "", null);
                Master.Form_ShowError(lstError);
            }
            catch (Exception ex)
            {
                CCommon.CatchEx(ex);
            }
        }