/// <summary> /// 新增一条数据 /// </summary> /// <param name="data1">Dictionary数据</param> public void NewData(Dictionary <String, object> data1) { try { Tb_PlanDetailDA da1 = new Tb_PlanDetailDA(); da1.NewData(data1); this.executeResultCount = da1.ExecuteResultCount; } catch (Exception err) { this.ErrorInfo = err.Message.Replace("\r", "").Replace("\t", "").Replace("\n", ""); throw err; } }
/// <summary> /// 将计划导入到周计划 /// </summary> /// <param name="projectGuid"></param> /// <param name="week1"></param> /// <param name="t1"></param> /// <param name="t2"></param> /// <param name="remark"></param> /// <param name="AttachFile"></param> /// <param name="AttachFilePath"></param> /// <param name="list1"></param> /// <returns></returns> public bool ImportExcelToWeekPlan(String projectGuid, int week1, DateTime t1, DateTime t2, String remark, String AttachFile, String AttachFilePath, List <Tb_PlanDetailDD> list1) { bool succ = false; JConnect.GetConnect().BeginTrans(); try { Tb_PlanDA da1 = new Tb_PlanDA(); //提交数据的版本更新 List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("parentGuid", projectGuid)); condition.Add(new SearchField("PlanKind", "2", SearchFieldType.NumericType)); condition.Add(new SearchField("History", "false", SearchFieldType.NumericType)); Dictionary <String, object> dic1 = da1.GetFirstDictionary(condition, "*"); int version = 1; if (dic1 != null && dic1.Count > 0) { version = int.Parse(dic1["Version"].ToString()); version++; dic1.Clear(); dic1["History"] = true; da1.EditData(condition, dic1); } //提交新的版本数据 String planid = WebFrame.Util.JString.GetUnique32ID(); dic1.Clear(); dic1["parentGuid"] = projectGuid; dic1["PlanID"] = planid; dic1["PlanKind"] = "2"; dic1["Version"] = version; dic1["Remark"] = remark; dic1["AddTime"] = DateTime.Now; dic1["AddUserID"] = FrameLib.UserID; dic1["AddUserName"] = FrameLib.UserName; dic1["AttachFile"] = AttachFile; dic1["AttachFilePath"] = AttachFilePath; dic1["PlanStatus"] = 0; dic1["FinishTime"] = DBNull.Value; dic1["PlanWeek"] = week1; dic1["begTime"] = t1; dic1["endTime"] = t2; dic1["History"] = false; da1.NewData(dic1); //提交新的计划明细数据 Tb_PlanDetailDA da2 = new Tb_PlanDetailDA(); foreach (Tb_PlanDetailDD d1 in list1) { dic1.Clear(); dic1["PlanKind"] = d1.PlanKind; dic1["parentGuid"] = projectGuid; dic1["planID"] = planid; dic1["planNum"] = d1.PlanNum; dic1["planTitle"] = d1.PlanTitel; dic1["begTime"] = d1.BegTime; dic1["endTime"] = d1.EndTime; dic1["workload"] = d1.Workload; dic1["ExecuteManID"] = d1.ExecuteManID; dic1["ExecuteManName"] = d1.ExecuteManName; //设置整体计划编号和月计划编号 dic1["ParentNum"] = d1.ParentNum; dic1["MonthPlanNum"] = d1.MaonthPlanNum; dic1["remark"] = d1.Remark; dic1["Taskkind"] = "0"; dic1["payMemo"] = d1.PayMemo; da2.NewData(dic1); } JConnect.GetConnect().CommitTrans(); succ = true; } catch (Exception err) { JConnect.GetConnect().RollBackTrans(); } return(succ); }