public void Add(TestRequestGenerate entity) { var sqlquery = @"INSERT INTO CENTRAL_LAB.TBLREQUESTGEN (REQUESTGENID,TESTREQUESTID,PCODE,PCODEDATE,PCODETIME,REQUESTDATE ,REQUESTTIME,UNITSENDDATE,UNITSENDTIME,UNITSENDCONFIRM,UNITNOTSENDDES ,TESTTYPE,UNITCONTROL,REQUESTTYPE,CREATEID,CONFIRMID,CONFIRM,STATUS ,TESTCOUNT,REQUESTFINISH,TESTEXE,TESTREJECT,RECEIVEDATE,RECEIVETIME ,SHIFT,SAMPLENO,VESELNO,LATNO,SAMPLEMAN) VALUES(:REQUESTGENID,:TESTREQUESTID,:PCODE,:PCODEDATE,:PCODETIME,:REQUESTDATE ,:REQUESTTIME,:UNITSENDDATE,:UNITSENDTIME,:UNITSENDCONFIRM,:UNITNOTSENDDES ,:TESTTYPE,:UNITCONTROL,:REQUESTTYPE,:CREATEID,:CONFIRMID,:CONFIRM,:STATUS ,:TESTCOUNT,:REQUESTFINISH,:TESTEXE,:TESTREJECT,:RECEIVEDATE,:RECEIVETIME ,:SHIFT,:SAMPLENO,:VESELNO,:LATNO,:SAMPLEMAN)"; _context.OracleContextConnectionString .Execute(sqlquery, new { entity.RequestgenId, entity.TestRequestId, entity.PCode, entity.PCodeDate, entity.PCodeTime, entity.RequestDate, entity.RequestTime, entity.UnitSendDate, entity.UnitSendTime, entity.UnitSendConfirm, entity.UnitNotSendDes, entity.TestType, entity.UnitControl, entity.RequestType, entity.CreateId, entity.ConfirmId, entity.Confirm, entity.Status, entity.TestCount, entity.RequestFinish, entity.TestExe, entity.TestReject, entity.ReceiveDate, entity.ReceiveTime, entity.Shift, entity.SampleNo, entity.VeselNo, entity.LatNo, entity.SampleMan }); }
public void Edit(int id, TestRequestGenerate entity) { var sqlquery = @"UPDATE TBLREQUESTGEN SET TESTREQUESTID =:TESTREQUESTID ,PCODE =:PCODE,PCODEDATE = :PCODEDATE ,PCODETIME = :PCODETIME,REQUESTDATE = :REQUESTDAT,REQUESTTIME = :REQUESTTIME ,UNITSENDDATE = :UNITSENDDATE,UNITSENDTIME = :UNITSENDTIME ,UNITSENDCONFIRM =:UNITSENDCONFIR,UNITNOTSENDDES = :UNITNOTSENDDES ,TESTTYPE =:TESTTYPE,UNITCONTROL = :UNITCONTROL,REQUESTTYPE =:REQUESTTYPE ,CREATEID = :CREATEID ,CONFIRMID = :CONFIRMID, ,CONFIRM = :CONFIRM ,STATUS = :STATUS,TESTCOUNT = :TESTCOUNT ,REQUESTFINISH =:REQUESTFINISH,TESTEXE = :TESTEXE,TESTREJECT = :TESTREJECT ,RECEIVEDATE =:RECEIVEDATE,RECEIVETIME =:RECEIVETIME,SHIFT = :SHIFT ,SAMPLENO = :SAMPLENO,VESELNO = :VESELNO ,LATNO = :LATNO ,SAMPLEMAN = :SAMPLEMAN WHERE REQUESTGENID = :REQUESTGENID"; _context.OracleContextConnectionString .Execute(sqlquery, new { entity.TestRequestId, entity.PCode, entity.PCodeDate, entity.PCodeTime, entity.RequestDate, entity.RequestTime, entity.UnitSendDate, entity.UnitSendTime, entity.UnitSendConfirm, entity.UnitNotSendDes, entity.TestType, entity.UnitControl, entity.RequestType, entity.CreateId, entity.ConfirmId, entity.Confirm, entity.Status, entity.TestCount, entity.RequestFinish, entity.TestExe, entity.TestReject, entity.ReceiveDate, entity.ReceiveTime, entity.VeselNo, entity.LatNo, entity.SampleMan, REQUESTGENID = id }); }
public ActionResult TestRequestAdd(TestRequestViewModel model) { if (!ModelState.IsValid) { ViewBag.Companies = new SelectList(_testrequestrepository.GetAllCompanies( _userrepository.GetUser(User.Identity.Name, int.Parse(CookieEncryptor.Decrypt(Request.Cookies["LabRequest-Cookie"].Value))).PersonId), "IdRec", "Des", int.Parse(model.Company)); ViewBag.Units = new SelectList(new List<string>(), "ApplicantId", "ApplicantName"); ViewBag.RequestTitles = new SelectList(new List<string>(), "IdRec", "Des"); return View(model); } if (model.RequestDetail == null) { ModelState.AddModelError("", "حداقل یک عنوان درخواست از جزئیات میبایست وارد شود"); ViewBag.Companies = new SelectList(_testrequestrepository.GetAllCompanies( _userrepository.GetUser(User.Identity.Name, int.Parse(CookieEncryptor.Decrypt(Request.Cookies["LabRequest-Cookie"].Value))).PersonId), "IdRec", "Des", int.Parse(model.Company)); ViewBag.Units = new SelectList(new List<string>(), "ApplicantId", "ApplicantName"); ViewBag.RequestTitles = new SelectList(new List<string>(), "IdRec", "Des"); return View(model); } var user = _userrepository.GetUser(User.Identity.Name, int.Parse(CookieEncryptor.Decrypt(Request.Cookies["LabRequest-Cookie"].Value))); var testreq = new TestRequest { TestRequestId = _testrequestrepository.MaxTextRequestId, RequestNo = _testrequestrepository.RequestNewCode(model.RequestType), ReqDate = model.RequestDate, StartDate = model.RequestDate, EndDate = model.RequestDate, ApplicantId = int.Parse(model.Unit), ReqType = 1, CreateId = user.PersonId, ConfirmId = 0, Confirm = "N", Enable = false, SampleName = model.SampleName, Contract = _testrequestrepository.RequestNewCode(model.RequestType), Com_Id = user.Com_Id }; _testrequestrepository.Add(testreq); var testreqgen = new TestRequestGenerate { RequestgenId = _testrequestgenrepository.MaxRequestGenId, TestRequestId = testreq.TestRequestId, PCode = testreq.RequestNo, PCodeDate = model.RequestDate, PCodeTime = _datetimerepository.GetShortLocalTime, RequestDate = model.RequestDate, RequestTime = _datetimerepository.GetShortLocalTime, UnitSendDate = model.RequestDate, UnitSendTime = _datetimerepository.GetShortLocalTime, UnitSendConfirm = 1, UnitNotSendDes = string.Empty, TestType = 1, UnitControl = 0, RequestType = (int)model.RequestType, CreateId = testreq.CreateId, ConfirmId = 0, Confirm = (int)model.RequestPriority, Status = 0, TestCount = 0, RequestFinish = 0, TestExe = 0, TestReject = 0, ReceiveDate = string.Empty, ReceiveTime = string.Empty, Shift = _testrequestgenrepository .GetCurrentShift(_datetimerepository.GetLongLocalTime , _datetimerepository.GetLocalDate), SampleNo = string.Empty, VeselNo = string.Empty, LatNo = model.LotNumber, SampleMan = model.SampleName }; _testrequestgenrepository.Add(testreqgen); foreach (var t in model.RequestDetail) { var reqtest = new RequestTest { ReqTestsId = _requesttestrepository.Max, RequestGenId = testreqgen.RequestgenId, TestRequestId = testreq.TestRequestId, RequestNameId = int.Parse(model.RequestTitle), TestId = int.Parse(t), ConfirmId = 0, Confirm = 0, ExeDate = string.Empty, ExeTime = string.Empty, ExeManId = 0, TestState = 0, TestDes = string.Empty, ReTestCount = 0, ConfirmDate = string.Empty, ConfirmTime = string.Empty, MachinId = 0, Price = _testrepository.GetPrice(int.Parse(t)).Price, PersonShift = 0, ExeShift = 0 }; _requesttestrepository.Add(reqtest); } return RedirectToAction("TestRequestResult", new { reqno = testreq.RequestNo }); }