public ActionResult Complain(List <ComplainFileUploadModel> Step3ObjectData) { ComplainStep1 Step1 = (ComplainStep1)TempData["_ComplainStep1"]; ComplainStep2 Step2 = (ComplainStep2)TempData["_ComplainStep2"]; if (Step1 == null || Step2 == null) { return(RedirectToAction("Complain", "Manage")); } string _refID = ""; int CompId = SaveComplain.AddnewComplain(Step1.Complain_Subject, 1, Helplibery.GetUserID(), Step1.CompanyName, Step1.CompanyDescription, Step2.Description, Step2.ComplainID, Step2.lv1, Step2.Tm_CauseID, Step2.PurchaseID, null, Step2.PaymentID, null, Step2.MotiveID, null, Step1.attorneyLog, null, ref _refID); SaveComplain.StartTrack(CompId, 1, null, null); SaveUtility.SaveComplainFileUpload(Step3ObjectData, CompId); //SaveComplain.StartTrack(CompId); TempData.Clear(); return(RedirectToAction("Confirm", "Manage")); }
private void _AddComplain(string tokenId, string Identification_number, string Consumer_firstname, string Consumer_lastname, string Consumer_gender, string Consumer_Birth , string Consumer_Address, string Consumer_ZipCode, string Consumer_Tel, string Consumer_Tel_Ex, string Consumer_Mobile, string Consumer_Fax, string Consumer_Email, string Complain_Subject , string Complain_Details, string DefendentName, string DefendentDescription, string Payment, string PlacePurchase, string Motive, string IsOversea, string OverseaAddress) { if (string.IsNullOrEmpty(tokenId)) { result = falseresult("UnAuthorized."); } if (string.IsNullOrEmpty(Identification_number)) { result = falseresult("Please provide Identification number."); } //string key = Encryption.Decrypt(tokenId); //if (!IsValidateToken(key)) // result = falseresult("UnAuthorized."); if (!IsValidateToken(tokenId)) { result = falseresult("UnAuthorized."); } try { Department_ExMapDao _departMap = new Department_ExMapDao(); AuthenticateTokenMapDao _authenMap = new AuthenticateTokenMapDao(); CustomerMapDao _cusMap = new CustomerMapDao(); CustomerVerifyMapDao _mapVer = new CustomerVerifyMapDao(); ComplainsMapDao _Map = new ComplainsMapDao(); Complains_WebService_logMapDao _logMap = new Complains_WebService_logMapDao(); Complains _Item = new Complains(); //var objToken = _authenMap.FindByKeygen(key).FirstOrDefault(); //if (objToken != null) //{ string Complain_Code_ID = null; var Dep_ex = _departMap.FindByKeygen(TokenValid.ApiKey).FirstOrDefault(); int? ChannelID = Dep_ex.ChanelID; int? CusID = SaveAccount.CheckUserAndNewregis(null, Identification_number, Consumer_firstname, Consumer_lastname, Consumer_gender, Consumer_Birth, Consumer_Address, null, null, null, Consumer_ZipCode, Consumer_Tel, Consumer_Tel_Ex, Consumer_Mobile, Consumer_Fax, Consumer_Email, false, null, null); if (IsOversea.ToUpper().Trim() == "TRUE") { var CusObj = _cusMap.FindById(CusID.Toint()); CusObj.IsOversea = true; _cusMap.AddOrUpdate(CusObj); _cusMap.CommitChange(); Customer_OverseaMapDao OverSeaMap = new Customer_OverseaMapDao(); if (OverSeaMap.FindAll().Where(o => o.CustomerID == CusID).ToList().Count() == 0) { Customer_Oversea SMapObj = new Customer_Oversea(); SMapObj.CustomerID = CusID; SMapObj.address_oversea = OverseaAddress; OverSeaMap.Add(SMapObj); OverSeaMap.CommitChange(); } } int Id = SaveComplain.AddnewComplain(Complain_Subject, ChannelID, CusID, DefendentName, DefendentDescription, Complain_Details , null, null, null, null, PlacePurchase, null, Payment, null, Motive, null, null, ref Complain_Code_ID); SaveComplain.StartTrack(Id, 3, TokenValid.ApiKey, null); _Item = _Map.FindById(Id); //*********************Save Complain Service Log Complains_WebService_log _log = new Complains_WebService_log(); _log.IdentityID = Identification_number; _log.Sex = Consumer_gender != null?Consumer_gender.ToLower() : ""; _log.ApiKey = TokenValid.ApiKey; _log.CreateDate = DateTime.Now; _log.FullName = Consumer_firstname + " " + Consumer_lastname; // _log.TitleID = TitleID; _log.Fname = Consumer_firstname; _log.Lname = Consumer_lastname; _log.DateOfBirth = Consumer_Birth; _log.Address = Consumer_Address; _log.ZipCode = Consumer_ZipCode; _log.Tel = Consumer_Tel; _log.Tel_ext = Consumer_Tel_Ex; _log.Mobile = Consumer_Mobile; _log.Fax = Consumer_Fax; _log.Email = Consumer_Email; _log.Complain_Subject = Complain_Subject; _log.Complain_Details = Complain_Details; _log.CompanyName = DefendentName; _log.CompanyDescription = DefendentDescription; //_log.PaymentID = PaymentID; //_log.PlacePurchaseID = PlacePurchaseID; //_log.MotiveID = Motive; _log.Payment_Text = Payment; _log.PlacePurchase_Text = PlacePurchase; _log.Motive_Text = Motive; _log.IsOversea = (IsOversea.Trim().ToUpper() == "TRUE") ? true : false; _log.OverseaAddress = OverseaAddress; _logMap.AddOrUpdate(_log); _logMap.CommitChange(); Complains_DepartmentMapDao DepTMapDao = new Complains_DepartmentMapDao(); Complains_Department _Dept = new Complains_Department(); _Dept.ComplainID = Id; _Dept.DepartmentID = Dep_ex.ID; DepTMapDao.Add(_Dept); DepTMapDao.CommitChange(); SaveUtility.SaveTransactionLog(_Item.Keygen, "Add Complain", SaveUtility.TransStatus.Create, TokenValid.ApiKey, IPAddress, "s"); //s: service result = Trueresult(new OCPB.Service.Model.Complain(_Item.Complain_Code_ID, _Item.Complain_Date.ToThaiFormate(), _Item.Complain_Time, _Item.Complain_Subject)); //} //else //{ // result = falseresult("UnAuthorized."); //} } catch (Exception ex) { SaveUtility.logError(ex); result = falseresult(ex.Message); } //finally //{ // _mapVer = null; // _Map = null; // _logMap = null; // _departMap = null; // _authenMap = null; // _cusMap = null; //} HttpContext.Current.Response.ContentType = "application/json"; HttpContext.Current.Response.Write(JsonConvert.SerializeObject(result)); HttpContext.Current.Response.End(); }