// GET: ApplicationTypes public Object SlotsCapacityPost([FromBody] SlotAllocationInput sai) { string sJSONResponse = ""; DataTable dt_AppType = new DataTable(); string ServerDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); string a = ""; string olPackage_Query = "insert into CMSSlotWiseAllocation(TrainerCode,PackageCode,SlotCode,AllocatedCount,FreeTrialAllocatedCount,BranchCode,Duration,MinPrice,MaxPrice,CreatedBy,CreatedOn,IsDeleted,IsActive) values('" + sai.TrainerCode + "','" + sai.PackageCode + "','" + sai.SlotCode + "','" + sai.AllocatedCount + "','" + sai.FreeTrialAllocatedCount + "','" + sai.BranchCode + "','" + sai.Duration + "','" + sai.MinPrice + "','" + sai.MaxPrice + "','" + sai.CreatedBy + "','" + ServerDateTime + "',0,1)"; SlotAllocationOutput sapost = new SlotAllocationOutput(); try { cnn.Open(); SqlCommand tm_cmd = new SqlCommand(olPackage_Query, cnn); tm_cmd.ExecuteNonQuery(); sapost.status = "Success"; sapost.value = a; } catch (Exception ex) { sapost.status = "fail"; } finally { cnn.Close(); } sJSONResponse = JsonConvert.SerializeObject(sapost); return(sJSONResponse); }
public Object SlotsCapacityDelete([FromBody] SlotAllocationInput sai) { string sJSONResponse = ""; SlotAllocationOutput sapost = new SlotAllocationOutput(); 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 CMSSlotWiseAllocation where ID='" + sai.ID + "' "; command.ExecuteNonQuery(); transaction.Commit(); sapost.status = "Success"; } catch (Exception ex) { transaction.Rollback(); } finally { } } catch (Exception ec) { sapost.status = "fail"; } sJSONResponse = JsonConvert.SerializeObject(sapost); return(sJSONResponse); }
public Object SlotsCapacityUpdate([FromBody] SlotAllocationInput sai) { string sJSONResponse = ""; SlotAllocationOutput sapost = new SlotAllocationOutput(); 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 = "update CMSSlotWiseAllocation set TrainerCode='" + sai.TrainerCode + "',PackageCode='" + sai.PackageCode + "',SlotCode='" + sai.SlotCode + "',AllocatedCount='" + sai.AllocatedCount + "',FreeTrialAllocatedCount='" + sai.FreeTrialAllocatedCount + "',Duration='" + sai.Duration + "',MinPrice='" + sai.MinPrice + "',MaxPrice='" + sai.MaxPrice + "' where ID='" + sai.ID + "' "; command.ExecuteNonQuery(); transaction.Commit(); sapost.status = "Success"; } catch (Exception ex) { transaction.Rollback(); } finally { } } catch (Exception ec) { sapost.status = "fail"; } sJSONResponse = JsonConvert.SerializeObject(sapost); return(sJSONResponse); }