private void Copy_Info(CategoryattrInfo source_info, int dest_cid, int dest_pid, int dest_depth, bool getchild, CCategoryattr BLL) { if (source_info == null) return; CategoryattrInfo 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<CategoryattrInfo> listsub = BLL.Wcmm_Getlist(source_info.Cid, source_info.Id, Get_ListOptionsNoPaging()); if (listsub == null || listsub.Count == 0) return; foreach (CategoryattrInfo info_sub in listsub) { this.Copy_Info(info_sub, dest_cid, info_copy.Id, info_copy.Depth, getchild, BLL); } } } }
private void Move_Info(CategoryattrInfo source_info, int dest_cid, int dest_pid, int dest_depth, bool getchild, CCategoryattr BLL) { if (source_info == null) return; int offset_depth = source_info.Depth - (dest_depth + 1); CategoryattrInfo 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<CategoryattrInfo> listin = null; List<CategoryattrInfo> listsub = BLL.Wcmm_Getlist_sub(source_info.Id, listin); if (listsub != null && listsub.Count > 0) { foreach (CategoryattrInfo 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); } } } }
private bool Save_Lang(CategoryattrInfo 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; CategoryattrInfo lang_info = info.copy(); lang_info.Id = 0; lang_info.Status = (int)CConstants.State.Status.Waitactive; (new CCategoryattr(lang_val)).Save(lang_info); } return true; } catch { return false; } }