public override void Loaded() { if (OperateFlag == "1") { CCInfo = OldInfos; string[] ArrayStr = OldInfos.F_STANDARDANSWER.Split(new string[] { "#" }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < ArrayStr.Length; i++) { if (ArrayStr[i].Split('|').Length == 3) { StantardAnswerInfos.Add(new DCStantardAnswerInfo() { PM = ArrayStr[i].Split('|')[0], ZS = Convert.ToInt32(ArrayStr[i].Split('|')[1]), JE = Convert.ToInt32(ArrayStr[i].Split('|')[2]) }); } } } }
public void CommitData() { if (string.IsNullOrEmpty(CCInfo.F_NAME)) { Messenger.Default.Send("名称不能为空!"); return; } string errorMessage = string.Empty; if (CommonFunction.CheckNumInput(CCInfo.F_TESTTIME, "考核时长", out errorMessage)) { Messenger.Default.Send(errorMessage); return; } if (CCInfo.F_PAGEWEIGHT < 0) { Messenger.Default.Send("您输入的{0}不能小于0,请重新输入!", "张数得分比例"); return; } if (CCInfo.F_MONEYWEIGHT < 0) { Messenger.Default.Send("您输入的{0}不能小于0,请重新输入!", "金额得分比例"); return; } var tempStr = string.Empty; if (!StantardAnswerInfos.Any(x => x.PM == "100")) { StantardAnswerInfos.Add(new DCStantardAnswerInfo() { PM = "100", ZS = 0, JE = 0 }); } if (!StantardAnswerInfos.Any(x => x.PM == "50")) { StantardAnswerInfos.Add(new DCStantardAnswerInfo() { PM = "50", ZS = 0, JE = 0 }); } if (!StantardAnswerInfos.Any(x => x.PM == "20")) { StantardAnswerInfos.Add(new DCStantardAnswerInfo() { PM = "20", ZS = 0, JE = 0 }); } if (!StantardAnswerInfos.Any(x => x.PM == "10")) { StantardAnswerInfos.Add(new DCStantardAnswerInfo() { PM = "10", ZS = 0, JE = 0 }); } if (!StantardAnswerInfos.Any(x => x.PM == "5")) { StantardAnswerInfos.Add(new DCStantardAnswerInfo() { PM = "5", ZS = 0, JE = 0 }); } if (!StantardAnswerInfos.Any(x => x.PM == "1")) { StantardAnswerInfos.Add(new DCStantardAnswerInfo() { PM = "1", ZS = 0, JE = 0 }); } foreach (var element in StantardAnswerInfos) { tempStr += element.PM + "|" + element.ZS.ToString() + "|" + element.JE.ToString() + "#"; } CCInfo.F_STANDARDANSWER = tempStr; string sql = string.Empty; string[] parms; if (OperateFlag == "0") { sql = @"INSERT INTO TY_COUNTCASH_VARIOUS ( F_KEY, F_NAME, F_TESTTIME, F_STANDARDANSWER, F_PAGEWEIGHT, F_MONEYWEIGHT, F_CREATOR, F_CREATETIME ) VALUES ( ?, ?, ?, ?, ?, ?, ?, sysdate )"; parms = new string[] { Guid.NewGuid().ToString("N").ToUpper(), CCInfo.F_NAME, CCInfo.F_TESTTIME.ToString(), CCInfo.F_STANDARDANSWER, CCInfo.F_PAGEWEIGHT.ToString(), CCInfo.F_MONEYWEIGHT.ToString(), App.LoginUserId }; } else if (OperateFlag == "1") { sql = @"UPDATE TY_COUNTCASH_VARIOUS SET F_KEY = ?, F_NAME = ?, F_TESTTIME = ?, F_STANDARDANSWER = ?, F_PAGEWEIGHT = ?, F_MONEYWEIGHT = ?, F_CREATOR = ?, F_CREATETIME = sysdate WHERE F_KEY = ?"; parms = new string[] { CCInfo.F_NAME, CCInfo.F_TESTTIME.ToString(), CCInfo.F_STANDARDANSWER, CCInfo.F_PAGEWEIGHT.ToString(), CCInfo.F_MONEYWEIGHT.ToString(), App.LoginUserId, CCInfo.F_KEY }; } else { return; } var flag = ExamHandle.TryExecute(sql, parms); if (flag) { Messenger.Default.Send("操作成功!"); Close(); } else { Messenger.Default.Send("操作失败!"); } return; }