public Object GetTicketTransaction([FromBody] SupportInput si) { TicketTransactionOutput fdop = new TicketTransactionOutput(); DataSet SelectedSlots = new DataSet(); string sJSONResponse = ""; DataTable dt_TicketTypes = new DataTable(); List <TicketTransaction> ttdetails = new List <TicketTransaction>(); try { dt_TicketTypes = getdata(string.Format("Select ID,TicketId,RequestTypeId,BranchCode,MemberShipCode,MemberName,StatusId,StatusName,PostPoneDate,Comments from TicketTransaction where BranchCode='" + si.BranchCode + "' and PostPoneDate between '" + si.FromDate + "' and '" + si.ToDate + "'")); for (int i = 0; i < dt_TicketTypes.Rows.Count; i++) { TicketTransaction fd = new TicketTransaction { ID = Convert.ToInt32(dt_TicketTypes.Rows[i]["ID"].ToString()), TicketId = dt_TicketTypes.Rows[i]["TicketId"].ToString(), RequestTypeId = Convert.ToInt32(dt_TicketTypes.Rows[i]["RequestTypeId"].ToString()), BranchCode = dt_TicketTypes.Rows[i]["BranchCode"].ToString(), MemberShipCode = dt_TicketTypes.Rows[i]["MemberShipCode"].ToString(), MemberName = dt_TicketTypes.Rows[i]["MemberName"].ToString(), Comments = dt_TicketTypes.Rows[i]["Comments"].ToString(), StatusId = dt_TicketTypes.Rows[i]["StatusId"].ToString(), StatusName = dt_TicketTypes.Rows[i]["StatusName"].ToString() }; ttdetails.Add(fd); } fdop.status = "success"; fdop.value = ttdetails; sJSONResponse = JsonConvert.SerializeObject(fdop); } catch (Exception ec) { fdop.status = "fail"; sJSONResponse = JsonConvert.SerializeObject(fdop); } return(sJSONResponse); }
public Object TicketTypesPost([FromBody] SupportInput si) { string sJSONResponse = ""; DataTable dt_AppType = new DataTable(); string ServerDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); int a = 0; string olPackage_Query = "insert into TicketTypes(RequestType) values('" + si.RequestType + "')"; SupportOutput ffopt = new SupportOutput(); try { cnn.Open(); SqlCommand tm_cmd = new SqlCommand(olPackage_Query, cnn); tm_cmd.ExecuteNonQuery(); ffopt.status = "Success"; } catch (Exception ex) { ffopt.status = "Fail"; } finally { cnn.Close(); } sJSONResponse = JsonConvert.SerializeObject(ffopt); return(sJSONResponse); }
public Object TicketTransactionPost([FromBody] SupportInput si) { string sJSONResponse = ""; DataTable dt_AppType = new DataTable(); string ServerDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); int a = 0; string olPackage_Query = "insert into TicketTransaction(TicketId,RequestTypeId,BranchCode,MemberShipCode,InvoiceId,StatusId,StatusName,PostPoneDate,Comments,CreatedBy,CreatedOn,IsDeleted,IsActive) values('" + si.TicketId + "','" + si.RequestTypeId + "','" + si.BranchCode + "','" + si.MemberShipCode + "','" + si.InvoiceId + "','" + si.StatusId + "','" + si.StatusName + "','" + si.PostPoneDate + "','" + si.Comments + "','" + si.CreatedBy + "','" + ServerDateTime + "',0,1)"; SupportOutput ffopt = new SupportOutput(); try { cnn.Open(); SqlCommand tm_cmd = new SqlCommand(olPackage_Query, cnn); tm_cmd.ExecuteNonQuery(); ffopt.status = "Success"; } catch (Exception ex) { ffopt.status = "Fail"; } finally { cnn.Close(); } sJSONResponse = JsonConvert.SerializeObject(ffopt); return(sJSONResponse); }
public Object TicketTransactionUpdate([FromBody] SupportInput si) { string sJSONResponse = ""; DataTable dt_AppType = new DataTable(); string ServerDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); int a = 0; string olPackage_Query = ""; SupportOutput ffopt = new SupportOutput(); try { cnn.Open(); olPackage_Query = "update TicketTransaction set TicketId='" + si.TicketId + "',RequestTypeId='" + si.RequestTypeId + "',BranchCode='" + si.BranchCode + "',MemberShipCode='" + si.MemberShipCode + "',InvoiceId='" + si.InvoiceId + "',Comments='" + si.Comments + "', StatusId = '" + si.StatusId + "',StatusName = '" + si.StatusName + "' where ID=" + si.ID + " "; SqlCommand tm_cmd = new SqlCommand(olPackage_Query, cnn); tm_cmd.ExecuteNonQuery(); ffopt.status = "Success"; } catch (Exception ex) { ffopt.status = "Fail"; } finally { cnn.Close(); } sJSONResponse = JsonConvert.SerializeObject(ffopt); return(sJSONResponse); }
public Object GetTicketTypes([FromBody] SupportInput si) { TicketTypeOpt fdop = new TicketTypeOpt(); DataSet SelectedSlots = new DataSet(); string sJSONResponse = ""; DataTable dt_TicketTypes = new DataTable(); List <TicketTypes> ttdetails = new List <TicketTypes>(); try { dt_TicketTypes = getdata(string.Format("Select ID,RequestType from TicketTypes")); for (int i = 0; i < dt_TicketTypes.Rows.Count; i++) { TicketTypes fd = new TicketTypes { ID = dt_TicketTypes.Rows[i]["ID"].ToString(), RequestType = dt_TicketTypes.Rows[i]["RequestType"].ToString() }; ttdetails.Add(fd); } fdop.status = "success"; fdop.value = ttdetails; sJSONResponse = JsonConvert.SerializeObject(fdop); } catch (Exception ec) { fdop.status = "fail"; sJSONResponse = JsonConvert.SerializeObject(fdop); } return(sJSONResponse); }
public Object TicketBookingPost([FromBody] SupportInput si) { string sJSONResponse = ""; DataTable dt_AppType = new DataTable(); string ServerDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); int a = 0; DataTable dt_LID = new DataTable(); dt_LID = getdata(string.Format("select ISNULL(MAX(ID),0) as LID from TicketBooking")); string TicketId = ""; int count = 0; count = Convert.ToInt32(dt_LID.Rows[0]["LID"].ToString()) + 1; TicketId = si.BranchCode + Convert.ToString(count); SupportOutput ffopt = new SupportOutput(); cnn.Open(); SqlCommand command = cnn.CreateCommand(); SqlTransaction transaction; transaction = cnn.BeginTransaction("SampleTransaction"); command.Connection = cnn; command.Transaction = transaction; try { command.CommandText = "insert into TicketBooking(TicketId,RequestTypeId,BranchCode,MemberShipCode,InvoiceId,Comments,CreatedBy,CreatedOn,IsDeleted,IsActive) values('" + TicketId + "','" + si.RequestTypeId + "','" + si.BranchCode + "','" + si.MemberShipCode + "','" + si.InvoiceId + "','" + si.Comments + "','" + si.CreatedBy + "','" + ServerDateTime + "',0,1)"; command.ExecuteNonQuery(); command.CommandText = "insert into TicketTransaction(TicketId,RequestTypeId,BranchCode,MemberShipCode,InvoiceId,StatusId,StatusName,PostPoneDate,Comments,CreatedBy,CreatedOn,IsDeleted,IsActive) values('" + TicketId + "','" + si.RequestTypeId + "','" + si.BranchCode + "','" + si.MemberShipCode + "','" + si.InvoiceId + "','1','Pending','','" + si.Comments + "','" + si.CreatedBy + "','" + ServerDateTime + "',0,1)"; command.ExecuteNonQuery(); transaction.Commit(); ffopt.status = "Success"; } catch (Exception ex) { try { transaction.Rollback(); } catch (Exception ex2) { } ffopt.status = "Fail"; } finally { cnn.Close(); } sJSONResponse = JsonConvert.SerializeObject(ffopt); return(sJSONResponse); }
public Object TicketTransactionDelete([FromBody] SupportInput si) { string sJSONResponse = ""; SupportOutput ffopt = new SupportOutput(); SqlCommand command = cnn.CreateCommand(); string ServerDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); try { cnn.Close(); cnn.Open(); SqlTransaction transaction; transaction = cnn.BeginTransaction("SampleTransaction"); command.Connection = cnn; command.Transaction = transaction; try { command.CommandText = "delete from TicketTransaction where ID=" + si.ID + " "; command.ExecuteNonQuery(); transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); } finally { ffopt.status = "success"; } } catch (Exception ec) { } sJSONResponse = JsonConvert.SerializeObject(ffopt); return(sJSONResponse); }