public object PostRequest([FromBody] LeaveRecClass recallObj) { string startdate = recallObj.RecallDt; DateTime?startDt = new CommonMethodsClass().ConvertStringToDate(startdate); if (DateTime.Now >= startDt || startDt == null) { return(new { Error = "Recall date must be greater than today's date" }); } object[] varModifyMasterData = new object[8]; varModifyMasterData[0] = recallObj.CompId; varModifyMasterData[1] = recallObj.GRqstID; varModifyMasterData[2] = recallObj.RecallEmp; varModifyMasterData[3] = recallObj.SpentDays; varModifyMasterData[4] = recallObj.AccountingYear; varModifyMasterData[5] = DateTime.Parse(recallObj.RecallDt).ToString("dd-MMM-yyyy"); varModifyMasterData[6] = recallObj.UserId; varModifyMasterData[7] = DateTime.Now.ToString("dd-MMM-yyyy"); int result = DataCreator.ExecuteProcedure("UPDATE_H_EMP_LV_RQST_R", varModifyMasterData); if (result == 0) { DataTable dt = LeaveRecObj.LvlRecallDays(recallObj.CompId, recallObj.RqstId, recallObj.RecallEmp, recallObj.AccountingYear, recallObj.LvGrp, recallObj.LvCode); int unspent = 0; if (dt.Rows.Count > 0) { unspent = int.Parse(dt.Rows[0]["DateTo"].ToString()); } object[] varModifyData = new object[8]; varModifyData[0] = recallObj.CompId; varModifyData[1] = recallObj.LvGrp; varModifyData[2] = recallObj.RecallEmp; varModifyData[3] = int.Parse(recallObj.OldDuration) - int.Parse(recallObj.SpentDays); varModifyData[4] = recallObj.AccountingYear; varModifyData[5] = recallObj.LvCode; varModifyData[6] = recallObj.UserId; varModifyData[7] = DateTime.Now.ToString("dd-MMM-yyyy"); result = DataCreator.ExecuteProcedure(" UPDATE_H_EMP_LV_RMN_DAYS_R", varModifyData); } string error; if (result == 0) { error = ""; } else { error = "Error Saving Records"; } var response = new { Error = error }; return(response); }
public static EntityTipoEmpresa Create(IDataReader fila) { return(new EntityTipoEmpresa( Keys.KeyTipoEmpresa.Create(fila), DataCreator.CreateString(fila, "NombreTipo"), DataCreator.CreateInt32(fila, "Estado"))); }
private void buttonOK_Click(object sender, EventArgs e) { AddUserForm addUserForm = new AddUserForm(false); if (addUserForm.ShowDialog() != DialogResult.OK) { return; } _resultUser = addUserForm.ResultUser; LocalTestingProvider provider = null; TestHelper selectedTest = listBox.SelectedItem as TestHelper; if (selectedTest.IsMasterTest) { provider = new LocalTestingProvider(DataCreator.CreateFullTestorDataSet(_testHelpers), selectedTest); } else { provider = new LocalTestingProvider(selectedTest.TestorData, selectedTest); } provider.SetStudentName(String.Format("{0} {1} {2}", HtmlStore.GetString(_resultUser.LastName), HtmlStore.GetString(_resultUser.FirstName), HtmlStore.GetString(_resultUser.SecondName))); TestForm testForm = new TestForm(provider); testForm.ShowDialog(); }
public IList <EntityCargoPaginacion> SelectPagging(ref EntityCargoPaginacion oEntityCargoPaginacion) { DataProcedure run = new DataProcedure(); run.CollectionParams.AddInputParameter("NombreCargo", oEntityCargoPaginacion.NombreCargo); run.CollectionParams.AddInputParameter("Estado", oEntityCargoPaginacion.Estado); run.CollectionParams.AddInputParameter("PageIndex", oEntityCargoPaginacion.EntityPaginacion.PageIndex); run.CollectionParams.AddInputParameter("PageSize", oEntityCargoPaginacion.EntityPaginacion.RowsPerPage); run.CollectionParams.AddOutputParameter("TotalRows"); IList <EntityCargoPaginacion> oListCargo = new List <EntityCargoPaginacion>(); using (IDataReader reader = run.ExecuteReader(CTransaction.Empty, Procedimientos.Cargo_Select_Paginado)) { while (reader.Read()) { oListCargo.Add(EntityCargoPaginacion.CreatePag(reader)); } } run.AssignReturnParameters(); oEntityCargoPaginacion.EntityPaginacion.RowCount = DataCreator.CreateInt32(run.CollectionParams.GetParameter("TotalRows").Value); return(oListCargo); }
public void Sprites_Assembler_BinaryBlocks_BlocksTilesImage() { TestSprites((model, parameters, exporter) => { // setup model.OutputType = OutputType.Sprites; model.CommentType = CommentType.Full; model.BinaryOutput = true; model.BinaryBlocksOutput = true; model.BlocksAsImage = true; model.TilesAsImage = true; // execute exporter.Remap(); exporter.Export(); // verify VerifyBinary(parameters.TilesStream, DataCreator.SpritesTil(), "til"); VerifyBinary(parameters.PaletteStream, DataCreator.SpritesPal(), "pal"); VerifyBinary(parameters.BinaryStream, DataCreator.SpritesBin(), "bin"); VerifyBinaryIsEmpty(parameters.MapStream, "map"); VerifyBinaryIsEmpty(parameters.BlocksImageStream, "blocks image"); VerifyBinary(parameters.TilesImageStream, DataCreator.SpritesImageTiles(), "tiles image"); VerifyBinaryArray(14, (i) => DataCreator.SpritesImageBlock(i), parameters.BlockImageStream, "block image"); VerifyAssembler(parameters, DataCreator.AssemblerSpritesAndBinaryAndBlocks(parameters.Time, CommentType.None, true)); }); }
private void UserControl_Unloaded(object sender, RoutedEventArgs e) { DataCreator dataMgr = DataMgr.Instance.DataCreator; dataMgr.CreateDataProgressEvent -= dataMgr_CreateDataProgressEvent; dataMgr.CreateDataCompletedEvent -= dataMgr_CreateDataCompletedEvent; }
private void TestSprites(Action <MainModel, ExportParameters, Exporter> tester) { Test( DataCreator.XmlDocumentSprites(), DataCreator.ImageSprites1(), tester); }
public static EntityDistrito Create(IDataReader fila) { return(new EntityDistrito( Keys.KeyDistrito.Create(fila), DataCreator.CreateString(fila, "Nombre"), DataCreator.CreateInt32(fila, "Estado"))); }
public void Verify_That_Six_Levels_Are_Created() { var rootNodeId = "1"; var numberOfNodesOnEachLevel = 6; var numberOfTraversals = 1; var vertices = new List <(Dictionary <string, object> mandatoryProperties, Dictionary <string, object> optionalProperties)>(); var dbMock = new Mock <IDatabase>(); dbMock.Setup(x => x.InsertVertexAsync( It.IsAny <string>(), It.IsAny <string>(), It.IsAny <Dictionary <string, object> >(), It.IsAny <Dictionary <string, object> >(), It.IsAny <string>())) .Returns(Task.CompletedTask) .Callback <string, string, Dictionary <string, object>, Dictionary <string, object>, string> ((id, label, mandatoryProperties, optionalProperties, partitionKeyValue) => { vertices.Add((mandatoryProperties, optionalProperties)); }); _dataCreator = new DataCreator(dbMock.Object); _dataCreator.InitializeAsync().GetAwaiter().GetResult(); var result = _dataCreator.StartAsync(rootNodeId, numberOfNodesOnEachLevel, numberOfTraversals) .GetAwaiter().GetResult(); var vertexOfLevel6 = vertices.First(x => (int)x.mandatoryProperties["level"] == 6); Assert.IsTrue(vertexOfLevel6.optionalProperties.Any(x => x.Key == "manufacturer")); }
public static KeyProvincia Create(IDataReader row) { return(new KeyProvincia( DataCreator.CreateString(row, "IdDepartamento"), DataCreator.CreateString(row, "IdProvincia") )); }
public void Sprites_Assembler_BlocksImage() { TestSprites((model, parameters, exporter) => { // setup model.OutputType = OutputType.Sprites; model.CommentType = CommentType.None; model.BinaryOutput = false; model.BinaryBlocksOutput = false; model.BlocksAsImage = true; model.TilesAsImage = false; // execute exporter.Remap(); exporter.Export(); // verify (note no block image is generated for sprites) VerifyBinaryIsEmpty(parameters.PaletteStream, "pal"); VerifyBinaryIsEmpty(parameters.BinaryStream, "bin"); VerifyBinaryIsEmpty(parameters.TilesStream, "til"); VerifyBinaryIsEmpty(parameters.MapStream, "map"); VerifyBinaryIsEmpty(parameters.BlocksImageStream, "blocks image"); VerifyBinaryIsEmpty(parameters.TilesImageStream, "tiles image"); VerifyBinaryArrayIsEmpty(20, parameters.BlockImageStream, "block image"); VerifyAssembler(parameters, DataCreator.AssemblerSprites(parameters.Time, CommentType.None, true)); }); }
void SetupChart() { flexChart1.BeginUpdate(); flexChart1.Series.Clear(); // Add 3 data series var s1 = new Series(); s1.Binding = s1.Name = "March"; flexChart1.Series.Add(s1); var s2 = new Series(); s2.Binding = s2.Name = "April"; flexChart1.Series.Add(s2); var s3 = new Series(); s3.Binding = s3.Name = "May"; flexChart1.Series.Add(s3); // Set x-binding and add data to the chart flexChart1.BindingX = "Fruit"; flexChart1.DataSource = DataCreator.CreateFruit(); flexChart1.EndUpdate(); }
public object PostPreLogin([FromBody] NotifNewId notifNewIdObj) { try { int status = 0; if (!string.IsNullOrEmpty(notifNewIdObj.DeviceId)) { object[] insertNewId = new object[4]; insertNewId[0] = notifNewIdObj.CompId; insertNewId[1] = notifNewIdObj.DeviceId; insertNewId[2] = notifNewIdObj.EmpNo; insertNewId[3] = notifNewIdObj.UserId; status = DataCreator.ExecuteProcedure("INSERT_NOTIF_DEVICE_ID", insertNewId); //INSERT NEW ID FOR USER } DataTable outstandingMsgDt = _notifObj.GetOustandingNotifications(notifNewIdObj.CompId, notifNewIdObj.EmpNo); //NOT USED SO AS TO PERSIST NOTIFICATIONS //object[] updateNotifMsg = new object[3]; //updateNotifMsg[0] = notifNewIdObj.CompId; //updateNotifMsg[1] = notifNewIdObj.UserId; //updateNotifMsg[2] = notifNewIdObj.UserId; //status = DataCreator.ExecuteProcedure("UPDATE_NOTIF_MSG_TEMP", updateNotifMsg); //UPDATE SENT NOTIFICATIONS IN TABLE return(new { Status = status, Values = outstandingMsgDt }); } catch (Exception ex) { ex.Log(); throw new ExternalException(); } }
public static KeyDetallePedido Create(IDataReader row) { return(new KeyDetallePedido( DataCreator.CreateInt32(row, "IDPedido"), DataCreator.CreateInt32(row, "IDProducto") )); }
public static EntityProvincia Create(IDataReader fila) { return(new EntityProvincia( Keys.KeyProvincia.Create(fila), DataCreator.CreateString(fila, "Nombre"), DataCreator.CreateInt32(fila, "Estado"))); }
public void Tiles_Assembler_BlocksImage() { TestTiles((model, parameters, exporter) => { // setup model.OutputType = OutputType.Tiles; model.CommentType = CommentType.None; model.BinaryOutput = false; model.BinaryBlocksOutput = false; model.BlocksAsImage = true; model.TilesAsImage = false; // execute exporter.Remap(); exporter.Export(); // verify VerifyBinaryIsEmpty(parameters.PaletteStream, "pal"); VerifyBinaryIsEmpty(parameters.BinaryStream, "bin"); VerifyBinaryIsEmpty(parameters.MapStream, "map"); VerifyBinaryIsEmpty(parameters.TilesStream, "til"); VerifyBinaryIsEmpty(parameters.TilesInfoStream, "blk"); VerifyBinary(parameters.BlocksImageStream, DataCreator.TilesImageBlocks(), "blocks image"); VerifyBinaryIsEmpty(parameters.TilesImageStream, "tiles image"); VerifyAssembler(parameters, DataCreator.AssemblerTiles(parameters.Time, CommentType.None, true)); }); }
private void Test(XmlDocument sourceDocument, Bitmap sourceBitmap, Action <MainModel, ExportParameters, Exporter> tester) { // We use memory streams so that we can later on examine the results without writing out files - faster and more predictable. using ( MemoryStream sourceStream = new MemoryStream(), binaryStream = new MemoryStream(), paletteStream = new MemoryStream(), mapStream = new MemoryStream(), tilesStream = new MemoryStream(), tilesImageStream = new MemoryStream(), tilesInfoStream = new MemoryStream(), blocksImageStream = new MemoryStream()) { var blockStreams = new MemoryStream[40]; // We want streams to be "constant", created only once per test and then reused whenever anyone calls out the closures. var parameters = new ExportParameters { Time = DateTime.Now, ExportCallbacks = new ExportCallbacksImpl(), SourceStream = () => sourceStream, PaletteStream = () => paletteStream, BinaryStream = () => binaryStream, MapStream = () => mapStream, TilesStream = () => tilesStream, TilesInfoStream = () => tilesInfoStream, TilesImageStream = () => tilesImageStream, BlocksImageStream = () => blocksImageStream, BlockImageStream = (i) => { if (blockStreams[i] == null) { blockStreams[i] = new MemoryStream(); } return(blockStreams[i]); }, }; // We load default data and rely on each test to set it up as needed. This sets up model with default parameters, but we can later change them as needed in each specific test. var model = DataCreator.LoadModel(sourceDocument); model.AddImage(new SourceImage("image1", sourceBitmap)); // Prepare exporter. var exporter = new Exporter(model, parameters); // Call out tester closure to actually perform the test. tester(model, parameters, exporter); foreach (var stream in blockStreams) { if (stream != null) { stream.Dispose(); } } } }
public static EntityCargo Create(IDataReader fila) { return(new EntityCargo( Keys.KeyCargo.Create(fila), DataCreator.CreateString(fila, "NombreCargo"), DataCreator.CreateString(fila, "Descripcion"), DataCreator.CreateInt32(fila, "Estado"))); }
public static EntityUsuario Create(IDataReader fila) { return(new EntityUsuario( Keys.KeyUsuario.Create(fila), DataCreator.CreateString(fila, "Usuario"), DataCreator.CreateString(fila, "Clave"), DataCreator.CreateInt32(fila, "Estado"))); }
public void CreatePartitionKey_With_ThreeLevels_ShouldReturnOneLevels() { var parameter = "1-2-3"; var answer = "1"; var result = DataCreator.CreatePartitionKey(parameter); Assert.AreEqual(result, answer); }
public void CreatePartitionKey_With_OneLevel() { var parameter = "1"; var answer = "1"; var result = DataCreator.CreatePartitionKey(parameter); Assert.AreEqual(result, answer); }
public static EntityGrupo Create(IDataReader fila) { return(new EntityGrupo( Keys.KeyGrupo.Create(fila), DataCreator.CreateInt32(fila, "IDGrupoPadre"), DataCreator.CreateString(fila, "DescripcionCorta"), DataCreator.CreateString(fila, "DescripcionLarga"), DataCreator.CreateInt32(fila, "Estado"))); }
public HttpResponseMessage PutImage(int empNo, string empName, string compId) { try { int status = 0; object[] varInsertPara = new Object[7]; varInsertPara[0] = compId; varInsertPara[1] = empNo; varInsertPara[2] = ""; varInsertPara[3] = empName; //Session("Username") varInsertPara[4] = DateTime.Now.ToString("dd-MMM-yyyy"); varInsertPara[5] = empName; //Session("Username") varInsertPara[6] = DateTime.Now.ToString("dd-MMM-yyyy"); int SavePhotoCount = DataCreator.ExecuteProcedure("INSERT_GM_EMP_LOGO", varInsertPara); byte[] picByte; using (Stream imageStream = Request.Content.ReadAsStreamAsync().Result) { byte[] buffer = new byte[1024 * 1024]; int count = imageStream.Read(buffer, 0, buffer.Length); picByte = new byte[count]; for (int i = 0; i < count; i++) { picByte[i] = buffer[i]; } } using (OracleConnection con = new OracleConnection(new DataProvider().GetConnectionString())) using (OracleCommand cmd = new OracleCommand()) { con.Open(); string query = "Update gm_emp_logo t set t.photo= :photo where t.emp_aid=:staffId and comp_aid=:compId"; cmd.Connection = con; cmd.CommandText = query; cmd.Parameters.AddWithValue("photo", picByte); cmd.Parameters.AddWithValue("staffId", empNo); cmd.Parameters.AddWithValue("compId", compId); status = cmd.ExecuteNonQuery(); } if (status == 1) { return(Request.CreateResponse(new { ErrorStatus = 0 })); } else { return(Request.CreateResponse(HttpStatusCode.OK, new { ErrorStatus = 1 })); } } catch (Exception ex) { ex.Log(); return(Request.CreateResponse(HttpStatusCode.OK, new { ErrorStatus = 1 })); } }
public static EntityDetallePedido Create(IDataReader fila) { return(new EntityDetallePedido( Keys.KeyDetallePedido.Create(fila), DataCreator.CreateInt32(fila, "Cantidad"), DataCreator.CreateDecimal(fila, "TotalBruto"), DataCreator.CreateDecimal(fila, "Retencion"), DataCreator.CreateDecimal(fila, "TotalNeto"), DataCreator.CreateInt32(fila, "Estado"))); }
public static EntityCargoPaginacion CreatePag(IDataReader fila) { return(new EntityCargoPaginacion( Keys.KeyCargo.Create(fila), DataCreator.CreateString(fila, "NombreCargo"), DataCreator.CreateString(fila, "Descripcion"), DataCreator.CreateInt32(fila, "Estado"), DataCreator.CreateString(fila, "EstadoNombre"), null)); }
public void DismissPreviousAlerts(ApprovalClass apprObj) { string updateQuery = "UPDATE GM_ALERTS SET ALERT_STATUS = 'D' WHERE RQST_ID = '" + apprObj.RequestId + "'"; DataCreator.ExecuteSQL(updateQuery); updateQuery = "UPDATE NOTIF_MSG_TEMP SET STATUS = 1, MDFD_BY = '" + apprObj.UserName + "', MDFD_DATE = SYSDATE WHERE MSG_RQST_ID = " + apprObj.RequestId + " AND COMP_AID = '" + apprObj.CompanyCode + "' AND STATUS=0"; DataCreator.ExecuteSQL(updateQuery); }
public void MostPopularWomanName_NoWomenInUserList() { DataCreator dataInfo = new DataCreator(); List <User> users = new List <User>(); users.Add(new User("Zhenya", "Loban", "man", 19)); users.Add(new User("Adam", "Loban", "man", 25)); List <string> popularName = dataInfo.MostPopularWomanName(users); Assert.AreEqual(popularName, null); }
public static EntityTienda Create(IDataReader fila) { return(new EntityTienda( Keys.KeyTienda.Create(fila), DataCreator.CreateString(fila, "NombreTienda"), DataCreator.CreateString(fila, "Direccion"), DataCreator.CreateString(fila, "IdDistrito"), DataCreator.CreateString(fila, "IdProvincia"), DataCreator.CreateString(fila, "IdRegion"), DataCreator.CreateString(fila, "Referencia"), DataCreator.CreateInt32(fila, "Estado"))); }
public static EntityGrupoPaginacion CreatePag(IDataReader row) { return(new EntityGrupoPaginacion( Keys.KeyGrupo.Create(row), DataCreator.CreateInt32(row, "IDGrupoPadre"), DataCreator.CreateString(row, "DescripcionCorta"), DataCreator.CreateString(row, "DescripcionLarga"), DataCreator.CreateInt32(row, "Estado"), DataCreator.CreateString(row, "GrupoPadreNombre"), DataCreator.CreateString(row, "EstadoNombre"), null)); }
public static void SetupClient(TestContext context) { _adlsClient = SdkUnitTest.SetupSuperClient(); _adlsClient.DeleteRecursive(RemotePath); _oneLevelDirCount = 3; _oneLevelFileCnt = 2; _recurseLevel = 3; _oneFileSize = 100; DataCreator.CreateDirRecursiveRemote(_adlsClient, UnitTestPath, _recurseLevel, _oneLevelDirCount, _oneLevelFileCnt, _oneLevelFileCnt, _oneFileSize, _oneFileSize); }