private void HandleModify(BOL_REQUEST_ID oREQUEST_ID, DataRow row) { string strMsg = ""; REQUEST_ID DAL_REQUEST_ID = new REQUEST_ID(con); if (!DAL_REQUEST_ID.IsAlreadyUpdated(oREQUEST_ID, out strMsg)) // If updated_at is not already modified { //update the record oREQUEST_ID.GD = string.IsNullOrEmpty(oREQUEST_ID.GD_CODE) ? 0 : 2; oREQUEST_ID.PASSWORD_EXPIRATION_DATE = oREQUEST_ID.DISABLED_FLG == "*" ? null : oREQUEST_ID.PASSWORD_EXPIRATION_DATE; oREQUEST_ID.PASSWORD_SET_DATE = oREQUEST_ID.DISABLED_FLG == "*" ? null : oREQUEST_ID.PASSWORD_SET_DATE; DAL_REQUEST_ID.Update(oREQUEST_ID, CURRENT_DATETIME, CURRENT_USER, out strMsg); } else { ResponseUtility.ReturnFailMessage(row); return; } //return message and MK value if (String.IsNullOrEmpty(strMsg)) //success { ResponseUtility.ReturnSuccessMessage(row, UPDATED_AT_DATETIME, CURRENT_DATETIME, CURRENT_USER); } else //failed { ResponseUtility.MailSendingFail(row); } }
public MetaResponse SendMail(string CompanyCodeList) { try { string strMsg = ""; DataTable dgvList = Utility.Utility_Component.JsonToDt(CompanyCodeList); for (int i = 0; i < dgvList.Rows.Count; i++) { //cast to REQUEST_ID object BOL_REQUEST_ID oREQUEST_ID = new BOL_REQUEST_ID(); oREQUEST_ID = Cast_REQUEST_ID(dgvList.Rows[i]); REQUEST_ID DAL_REQUEST_ID = new REQUEST_ID(con); if (!DAL_REQUEST_ID.IsAlreadyUpdated(oREQUEST_ID, out strMsg)) // If updated_at is not already modified { bool mailSuccess = PrepareAndSendMail(oREQUEST_ID); if (mailSuccess) { //update email sent date oREQUEST_ID.EMAIL_SEND_DATE = TEMP; DAL_REQUEST_ID.UpdateMailDate(oREQUEST_ID, CURRENT_DATETIME, CURRENT_USER, out strMsg); if (String.IsNullOrEmpty(strMsg)) { //success message dgvList.Rows[i]["EMAIL_SEND_DATE"] = UPDATED_AT_DATETIME; ResponseUtility.ReturnMailSuccessMessage(dgvList.Rows[i], UPDATED_AT_DATETIME, CURRENT_DATETIME, CURRENT_USER); } else { //fail message ResponseUtility.MailSendingFail(dgvList.Rows[i]); } } else { ResponseUtility.MailSendingFail(dgvList.Rows[i]); } } else { ResponseUtility.ReturnFailMessage(dgvList.Rows[i]); } } response.Status = 1; response.Data = Utility.Utility_Component.DtToJSon(dgvList, "Mail status");; timer.Stop(); response.Meta.Duration = timer.Elapsed.TotalSeconds; return(response); } catch (Exception ex) { return(ResponseUtility.GetUnexpectedResponse(response, timer, ex)); } }
public MetaResponse GDConfirmRequest(string list) { try { string msg = ""; DataTable dgvList = Utility.Utility_Component.JsonToDt(list); for (int i = 0; i < dgvList.Rows.Count; i++) { BOL_REQUEST_DETAIL oREQUEST_DETAIL = new BOL_REQUEST_DETAIL(); BOL_REQUEST_ID oREQUEST_ID = new BOL_REQUEST_ID(); //cast into objects oREQUEST_ID = Cast_REQUEST_ID(dgvList.Rows[i]); oREQUEST_DETAIL = Cast_REQUEST_DETAIL(dgvList.Rows[i]); //send mail bool mailSuccess = PrepareAndSendMail(oREQUEST_DETAIL, true, null); if (mailSuccess) { REQUEST_ID DAL_REQUEST_ID = new REQUEST_ID(con); if (!DAL_REQUEST_ID.IsAlreadyUpdated(oREQUEST_ID, out msg)) { //set GD to 1 oREQUEST_ID.GD = 1; //insert the record DAL_REQUEST_ID.GDConfirmationRequestUpdate(oREQUEST_ID, CURRENT_DATETIME, CURRENT_USER, out msg); //return message and MK value if (String.IsNullOrEmpty(msg)) //success { ResponseUtility.ReturnSuccessMessage(dgvList.Rows[i], UPDATED_AT_DATETIME, CURRENT_DATETIME, CURRENT_USER, string.Format(Utility.Messages.Jimugo.I000ZZ016, "GD確認依頼")); } else //failed { ResponseUtility.ReturnFailMessage(dgvList.Rows[i]); } } } else { ResponseUtility.MailSendingFail(dgvList.Rows[i]); } } response.Status = 1; response.Data = Utility.Utility_Component.DtToJSon(dgvList, "GD Confirm Request");; timer.Stop(); response.Meta.Duration = timer.Elapsed.TotalSeconds; return(response); } catch (Exception ex) { return(ResponseUtility.GetUnexpectedResponse(response, timer, ex)); } }
private void HandleModify(BOL_REQUEST_DETAIL oREQUEST_DETAIL, BOL_REQUEST_ID oREQUEST_ID, DataRow row) { string msg = ""; using (TransactionScope dbTxn = new TransactionScope()) { #region UPDATE REQUEST_DETSIL REQUEST_DETAIL DAL_REQUEST_DETAIL = new REQUEST_DETAIL(con); if (!DAL_REQUEST_DETAIL.IsAlreadyUpdated(oREQUEST_DETAIL, out msg)) // If updated_at is not already modified { //insert the record DAL_REQUEST_DETAIL.UpdateUsageApplication(oREQUEST_DETAIL, CURRENT_DATETIME, CURRENT_USER, out msg); if (!string.IsNullOrEmpty(msg)) { dbTxn.Dispose(); ResponseUtility.ReturnFailMessage(row); return; } } else { dbTxn.Dispose(); ResponseUtility.ReturnFailMessage(row); return; } #endregion #region UPDATE REQUEST_ID REQUEST_ID DAL_REQUEST_ID = new REQUEST_ID(con); if (!DAL_REQUEST_ID.IsAlreadyUpdated(oREQUEST_ID, out msg)) // If updated_at is not already modified { //insert the record DAL_REQUEST_ID.UpdateUsageApplication(oREQUEST_ID, CURRENT_DATETIME, CURRENT_USER, out msg); } else { dbTxn.Dispose(); ResponseUtility.ReturnFailMessage(row); return; } //return message and MK value if (String.IsNullOrEmpty(msg)) //success { dbTxn.Complete(); ResponseUtility.ReturnSuccessMessage(row, UPDATED_AT_DATETIME, CURRENT_DATETIME, CURRENT_USER); } else //failed { dbTxn.Dispose(); ResponseUtility.ReturnFailMessage(row); } #endregion } }
private void HandleDelete(BOL_REQUEST_ID oREQUEST_ID, DataRow row) { string strMsg = ""; using (TransactionScope dbTxn = new TransactionScope()) { //check if it is already registered in REQUEST_DETAIL REQUEST_DETAIL DAL_REQUEST_DETAIL = new REQUEST_DETAIL(con); REQUEST_ID DAL_REQUEST_ID = new REQUEST_ID(con); if (!DAL_REQUEST_ID.IsAlreadyUpdated(oREQUEST_ID, out strMsg)) // IF updated_at is not already modified { if (!DAL_REQUEST_DETAIL.IsAlreadyUsed(oREQUEST_ID.COMPANY_NO_BOX, out strMsg)) { //delete the record DAL_REQUEST_ID.Delete(oREQUEST_ID, out strMsg); } else //Already used { dbTxn.Dispose(); ResponseUtility.ReturnFailMessage(row, string.Format(Utility.Messages.Jimugo.E000ZZ033, oREQUEST_ID.COMPANY_NO_BOX)); return; } } else { dbTxn.Dispose(); ResponseUtility.ReturnFailMessage(row); return; } //return message and MK value if (String.IsNullOrEmpty(strMsg)) //success { dbTxn.Complete(); ResponseUtility.ReturnDeleteSuccessMessage(row); } else //failed { ResponseUtility.ReturnFailMessage(row); } } }