/// <summary> /// 提交今日工作日志 /// </summary> /// <param name="list1"></param> /// <returns></returns> public bool UpdateTodayLog(List <KORWeb.DDL.Tb_WorkLogDD> list1) { bool succ = false; JConnect.GetConnect().BeginTrans(); try { List <SearchField> condition = new List <SearchField>(); Tb_WorkLogDA da1 = new Tb_WorkLogDA(); Dictionary <String, object> dic1 = new Dictionary <string, object>(); foreach (Tb_WorkLogDD d1 in list1) { condition.Clear(); condition.Add(new SearchField("AddUserID", d1.AddUserID)); condition.Add(new SearchField("parentGuid", d1.ParentGuid)); condition.Add(new SearchField("PlanID", d1.PlanID)); condition.Add(new SearchField("PlanNum", d1.PlanNum)); String t1 = "CDate('" + d1.BegDate.ToString("yyyy-MM-dd") + "')"; condition.Add(new SearchField("begDate", t1, SearchFieldType.NumericType)); dic1.Clear(); //修改数据 if (da1.HasData(condition)) { dic1["LogContent"] = d1.LogContent; dic1["WorkLoad"] = d1.WorkLoad; da1.EditData(condition, dic1); } else { dic1["LogContent"] = d1.LogContent; dic1["WorkLoad"] = d1.WorkLoad; if (d1.LogContent.Length > 0 && d1.WorkLoad > 0) { dic1["LogContent"] = d1.LogContent; dic1["WorkLoad"] = d1.WorkLoad; dic1["parentGuid"] = d1.ParentGuid; dic1["PlanID"] = d1.PlanID; dic1["PlanNum"] = d1.PlanNum; dic1["AddUserID"] = d1.AddUserID; dic1["AddUserName"] = d1.AddUserName; dic1["begDate"] = d1.BegDate; dic1["Addtime"] = d1.AddTime; dic1["LogID"] = WebFrame.Util.JString.GetUnique32ID(); da1.NewData(dic1); } } } JConnect.GetConnect().CommitTrans(); succ = true; } catch (Exception err) { JConnect.GetConnect().RollBackTrans(); succ = false; } return(succ); }
/// <summary> /// 新增一条数据 /// </summary> /// <param name="data1">Dictionary数据</param> public void NewData(Dictionary <String, object> data1) { try { Tb_WorkLogDA da1 = new Tb_WorkLogDA(); da1.NewData(data1); this.executeResultCount = da1.ExecuteResultCount; } catch (Exception err) { this.ErrorInfo = err.Message.Replace("\r", "").Replace("\t", "").Replace("\n", ""); } }
/// <summary> /// 保存工作日志 /// </summary> /// /// <param name="logid"></param> /// <param name="authorid"></param> /// <param name="authorName"></param> /// <param name="logcontent"></param> /// <param name="begdate"></param> /// /// <returns></returns> public int SaveWorkLog( String logid, String authorid, String authorName, String logcontent, String begdate) { int succ = 0; JConnect.GetConnect().BeginTrans(); try { //1--插入或修改日志 Dictionary <String, object> dic1 = new Dictionary <string, object>(); JConnect.GetConnect().CommitTrans(); dic1["logid"] = logid; dic1["AddUserID"] = authorid; dic1["AddUserName"] = authorName; dic1["begdate"] = DateTime.Parse(begdate); dic1["logcontent"] = logcontent; if (DateTime.Parse(begdate).ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd")) { dic1["IsBuDeng"] = true; } else { dic1["IsBuDeng"] = false; } List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("logid", logid)); Tb_WorkLogDA da1 = new Tb_WorkLogDA(); if (da1.HasData(condition)) { da1.EditData(condition, dic1); } else { da1.NewData(dic1); } JConnect.GetConnect().CommitTrans(); succ = 1; } catch (Exception err) { JConnect.GetConnect().RollBackTrans(); } return(succ); }