private string Delete(string iid) { try { if (!CCommon.Right_del(CFunctions.Get_Definecatrelate(Webcmm.Id.Feedback, Queryparam.Defstring.Page))) return Definephrase.Invalid_right; CFeedback DAL = new CFeedback(); if (DAL.Delete(iid)) { int pid = CCommon.Get_QueryNumber(Queryparam.Pid); if (pid != 0) DAL.Updatepis(pid.ToString(), CConstants.NUM_DECREASE, iid.Split(',').Length); return Definephrase.Remove_completed; } else return Definephrase.Remove_error; } catch (Exception ex) { throw ex; } }
private void Move_Info(FeedbackInfo source_info, int dest_pid, int dest_depth, bool getchild, CFeedback BLL) { if (source_info == null) return; int offset_depth = source_info.Depth - (dest_depth + 1); FeedbackInfo info_copy = source_info.copy(); info_copy.Pid = dest_pid; info_copy.Depth = dest_depth + 1; info_copy.Status = CCommon.GetStatus_upt(); info_copy.Timeupdate = DateTime.Now; if (BLL.Save(info_copy)) { List<FeedbackInfo> listin = null; List<FeedbackInfo> listsub = BLL.Getlist_sub(source_info.Id, listin); if (listsub != null && listsub.Count > 0) { foreach (FeedbackInfo info_sub in listsub) { 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.Timeupdate = DateTime.Now; BLL.Save(info_sub); } } } }
protected void cmdMoveOk_Click(object sender, EventArgs e) { try { string iidstr = txtIidstr.Value; int dest_pid = int.Parse(ddlMovepid.SelectedValue); bool getchild = chkMoveoption_getchild.Checked; lstError = new List<Errorobject>(); if (CFunctions.IsNullOrEmpty(iidstr)) { lstError = Form_GetError(lstError, Errortype.Error, Definephrase.Move_error, "", null); Master.Form_ShowError(lstError); return; } CFeedback BLL = new CFeedback(); FeedbackInfo 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++) { FeedbackInfo 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_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); } }