コード例 #1
0
ファイル: TestBLL.cs プロジェクト: CbrainSolutions/HMS
        public bool IsRecordExists(EntityTest entDept)
        {
            bool flag = false;

            try
            {
                tblTestMaster obj = (from tbl in objData.tblTestMasters
                                     where tbl.IsDelete == false &&
                                     tbl.TestName.ToUpper().ToString().Trim().Equals(entDept.TestName.ToUpper().ToString().Trim())
                                     select tbl).FirstOrDefault();
                if (obj != null)
                {
                    flag = true;
                }
                else
                {
                    flag = false;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(flag);
        }
コード例 #2
0
        public async Task <IActionResult> PutEntityTest([FromRoute] int id, [FromBody] EntityTest entityTest)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != entityTest.Id)
            {
                return(BadRequest());
            }

            _context.Entry(entityTest).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EntityTestExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #3
0
ファイル: DynamicTest.cs プロジェクト: lanicon/FlowRx
        public void Dynamic_Composed_Common_Directory_Has_Same_Snapshot_As_Undynamic_Composition()
        {
            IEntityDirectory <string> dynamicDir = GetDynamicCommonDirectory();

            Assert.Equal(
                EntityTest.GetCommonDirectoryHardcodedDebugString(),
                dynamicDir.Changes.Snapshot().ToDebugStringList());
        }
コード例 #4
0
        public void WhereWithInt64()
        {
            IEnumerable <EntityTest> resultlist = (from o in session.Linq <EntityTest>()
                                                   where o.PInt64 == 1
                                                   select o);
            EntityTest result = resultlist.Single <EntityTest>();

            Assert.AreEqual(result.PInt64, 1);
        }
        public void I_Can_Add_New_Item_To_List()
        {
            var newitem = new EntityTest()
            {
                Title = "New item created on " + DateTime.Now,
            };

            var result = _subject.Add(newitem);
            Assert.IsNotNull(result);
        }
コード例 #6
0
        protected void BtnEdit_Click(object sender, EventArgs e)
        {
            int lintCnt = 0;

            try
            {
                EntityTest entDept = new EntityTest();
                entDept.Precautions = txtDeptCode.Text;
                entDept.TestName    = txtDeptDesc.Text;
                entDept.TestId      = Convert.ToInt32(testid.Value);
                entDept.TestCharge  = Convert.ToDecimal(txtCharge.Text);
                entDept.IsRadiology = rdoRadiology.Checked ? true : false;
                entDept.IsPathology = rdoPathology.Checked ? true : false;
                entDept.TestCatId   = Convert.ToInt32(ddlTestCatagory.SelectedValue);
                EntityTest obj = (from tbl in mobjDeptBLL.GetAllTests()
                                  where tbl.TestId == Convert.ToInt32(testid.Value) &&
                                  tbl.TestName.ToUpper().Equals(txtDeptDesc.Text.ToUpper())
                                  select tbl).FirstOrDefault();

                if (obj != null)
                {
                    lintCnt = mobjDeptBLL.Update(entDept);
                    GetTests();
                    lblMessage.Text = "Record Updated Successfully";
                }
                else
                {
                    if (!mobjDeptBLL.IsRecordExists(entDept))
                    {
                        lintCnt = mobjDeptBLL.Update(entDept);

                        if (lintCnt > 0)
                        {
                            GetTests();
                            lblMessage.Text = "Record Updated Successfully";
                        }
                        else
                        {
                            lblMessage.Text = "Record Not Updated.";
                        }
                    }
                    else
                    {
                        lblMessage.Text = "Record Already Exist.";
                    }
                }
                MultiView1.SetActiveView(View1);
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }
        }
コード例 #7
0
        public async Task <IActionResult> PostEntityTest([FromBody] EntityTest entityTest)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.EntityTest.Add(entityTest);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetEntityTest", new { id = entityTest.Id }, entityTest));
        }
コード例 #8
0
 private static void CreateTestDataForEntest()
 {
     EntityTest[] ents = new EntityTest[] {
         new EntityTest()
         {
             PByte = 1, PInt16 = 1, PInt32 = 1, PInt64 = 1, PString = "One", PBool = true
         },
         new EntityTest()
         {
             PByte = 2, PInt16 = 2, PInt32 = 2, PInt64 = 2, PString = "Two", PBool = true
         },
         new EntityTest()
         {
             PByte = 3, PInt16 = 3, PInt32 = 3, PInt64 = 3, PString = "Three", PBool = true
         },
         new EntityTest()
         {
             PByte = 4, PInt16 = 4, PInt32 = 4, PInt64 = 4, PString = "Four", PBool = false
         }
     };
     EntityContainer[] encns = new EntityContainer[] {
         new EntityContainer()
         {
             PStr = "Alkampfer", RegDate = new DateTime(2008, 1, 2)
         },
         new EntityContainer()
         {
             PStr = "Gian Maria Ricci", RegDate = new DateTime(2008, 7, 20)
         }
     };
     ents[0].Container = encns[0];
     ents[1].Container = encns[0];
     ents[2].Container = encns[0];
     ents[3].Container = encns[1];
     using (ISession session = CreateSession())
     {
         session.Delete("from EntityTest");
         session.Delete("from EntityContainer");
         session.Flush();
         foreach (EntityContainer entc in encns)
         {
             session.Save(entc);
         }
         foreach (EntityTest ent in ents)
         {
             session.Save(ent);
         }
         session.Flush();
     }
 }
コード例 #9
0
        public void Add()
        {
            var entity = new EntityTest();

            _genericRepository.Add(entity);

            _unityOfWork.Save();

            _entityTestRepository.Delete(entity);

            _unityOfWork.Save();

            //
        }
コード例 #10
0
        static void Main(string[] args)
        {
            TimeCountLogger.Initialize();
            ResultNLogger.Initialize();

            ITestSignature test = new DapperTest();

            TestMethod(test, "Dapper");
            test = new EntityTest();
            TestMethod(test, "Entity");
            test = new LinqTest();
            TestMethod(test, "Linq");

            Console.ReadKey();
        }
コード例 #11
0
        public void Set_Update_Success()
        {
            var updateResultMock = new Mock <UpdateResult>();

            var collectionMock = new Mock <IMongoCollection <EntityTest> >();

            collectionMock.Setup(c =>
                                 c.UpdateOne(
                                     It.IsAny <FilterDefinition <EntityTest> >(),
                                     It.IsAny <UpdateDefinition <EntityTest> >(),
                                     It.IsAny <UpdateOptions>(),
                                     It.IsAny <CancellationToken>()))
            .Returns(updateResultMock.Object);

            var databaseMock = new Mock <IMongoDatabase>();

            databaseMock
            .Setup(d => d.GetCollection <EntityTest>(It.IsAny <string>(), It.IsAny <MongoCollectionSettings>()))
            .Returns(() => collectionMock.Object);

            var set = new Set <EntityTest>(databaseMock.Object);

            set.Update(o => o.Prop1 == 1, () => new EntityTest
            {
                Prop1 = 1,
                Prop2 = "test",
                Prop6 = new SubEntityTest
                {
                    SubProp1 = 2,
                    SubProp2 = "teste2"
                }
            });

            var entityTest = new EntityTest
            {
                Prop1 = 1,
                Prop2 = "test",
                Prop6 = new SubEntityTest
                {
                    SubProp1 = 2,
                    SubProp2 = "teste2"
                }
            };

            set.Update(o => o.Prop1 == 1, () => entityTest);
        }
コード例 #12
0
ファイル: DynamicTest.cs プロジェクト: lanicon/FlowRx
        public void Dynamic_Implementation_BaseValueInterface_With_Read_Write_Has_Hardcoded_Snapshot()
        {
            var dynamicEntity = EntityDynamic <ICommonDirectoryBaseValues> .Create();

            var commonDirectory = dynamicEntity.Value;

            commonDirectory.TestDirectory.TestBool    = !commonDirectory.TestDirectory.TestBool;
            commonDirectory.TestDirectory.TestDouble += 23;
            commonDirectory.TestDirectory.TestInt    += 23;
            commonDirectory.TestDirectory.TestString  = $"{commonDirectory.TestDirectory.TestString}TestString";
            commonDirectory.TestDirectory.TestList.Add(1);
            commonDirectory.TestDirectory.TestList.Add(10);
            commonDirectory.TestDirectory.TestList.Add(15);
            Assert.Equal(
                EntityTest.GetCommonDirectoryHardcodedDebugString(),
                dynamicEntity.Changes.Snapshot().ToDebugStringList());
        }
コード例 #13
0
ファイル: DynamicTest.cs プロジェクト: lanicon/FlowRx
        public void Dynamic_Implementation_EntityValueInterface_With_Read_Write_Has_Hardcoded_Snapshot()
        {
            var dynamicEntity = EntityDynamic <ICommonDirectoryEntityValues> .Create();

            var commonDirectory = dynamicEntity.Value;

            commonDirectory.TestDirectory.Value.TestBool.OnNext(!commonDirectory.TestDirectory.Value.TestBool.Value);
            commonDirectory.TestDirectory.Value.TestDouble.OnNext(commonDirectory.TestDirectory.Value.TestDouble.Value + 23);
            commonDirectory.TestDirectory.Value.TestInt.OnNext(commonDirectory.TestDirectory.Value.TestInt.Value + 23);
            commonDirectory.TestDirectory.Value.TestString.OnNext($"{commonDirectory.TestDirectory.Value.TestString.Value}TestString");
            commonDirectory.TestDirectory.Value.TestList.Add(EntitySubject <int> .Create(1));
            commonDirectory.TestDirectory.Value.TestList.Add(EntitySubject <int> .Create(10));
            commonDirectory.TestDirectory.Value.TestList.Add(EntitySubject <int> .Create(15));
            Assert.Equal(
                EntityTest.GetCommonDirectoryHardcodedDebugString(),
                dynamicEntity.Changes.Snapshot().ToDebugStringList());
        }
コード例 #14
0
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                int        lintcnt = 0;
                EntityTest entDept = new EntityTest();
                if (Session["update"].ToString() == ViewState["update"].ToString())
                {
                    entDept.TestName    = txtDeptDesc.Text.Trim();
                    entDept.TestCharge  = Convert.ToDecimal(txtCharge.Text);
                    entDept.Precautions = txtDeptCode.Text;
                    entDept.IsRadiology = rdoRadiology.Checked ? true : false;
                    entDept.IsPathology = rdoPathology.Checked ? true : false;
                    entDept.TestCatId   = Convert.ToInt32(ddlTestCatagory.SelectedValue);
                    if (!mobjDeptBLL.IsRecordExists(entDept))
                    {
                        lintcnt = mobjDeptBLL.InsertTest(entDept);

                        if (lintcnt > 0)
                        {
                            GetTests();
                            lblMessage.Text   = "Record Inserted Successfully.";
                            Session["update"] = Server.UrlEncode(System.DateTime.Now.ToString());
                        }
                        else
                        {
                            lblMessage.Text = "Record Not Inserted";
                        }
                    }
                    else
                    {
                        lblMessage.Text = "Record Already Exist.";
                    }
                }
                MultiView1.SetActiveView(View1);
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }
        }
コード例 #15
0
ファイル: DynamicTest.cs プロジェクト: lanicon/FlowRx
        public void Dynamic_Implementation_SubjectValueInterface_With_Read_Write_Has_Hardcoded_Snapshot()
        {
            var dynamicEntity = EntityDynamic <ICommonDirectorySubjectValues> .Create();

            var commonDirectory = dynamicEntity.Value;
            var testDirectory   = commonDirectory.TestDirectory.FirstAsync().Wait();

            testDirectory.TestBool.OnNext(!testDirectory.TestBool.FirstAsync().Wait());
            testDirectory.TestDouble.OnNext(testDirectory.TestDouble.FirstAsync().Wait() + 23);
            testDirectory.TestInt.OnNext(testDirectory.TestInt.FirstAsync().Wait() + 23);
            testDirectory.TestString.OnNext($"{testDirectory.TestString.FirstAsync().Wait()}TestString");
            var testList = testDirectory.TestList.FirstAsync().Wait();

            testList.Add(1);
            testList.Add(10);
            testList.Add(15);

            Assert.Equal(
                EntityTest.GetCommonDirectoryHardcodedDebugString(),
                dynamicEntity.Changes.Snapshot().ToDebugStringList());
        }
コード例 #16
0
ファイル: TestBLL.cs プロジェクト: CbrainSolutions/HMS
 public int Update(EntityTest entDept)
 {
     try
     {
         tblTestMaster test = (from tbl in objData.tblTestMasters
                               where tbl.IsDelete == false &&
                               tbl.TestId == entDept.TestId
                               select tbl).FirstOrDefault();
         test.TestName    = entDept.TestName;
         test.TestCharge  = entDept.TestCharge;
         test.Precautions = entDept.Precautions;
         test.IsPathology = entDept.IsPathology;
         test.IsRadiology = entDept.IsRadiology;
         test.TestCatId   = entDept.TestCatId;
         objData.SubmitChanges();
         return(1);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #17
0
ファイル: TestBLL.cs プロジェクト: CbrainSolutions/HMS
 public int InsertTest(EntityTest entDept)
 {
     try
     {
         tblTestMaster obj = new tblTestMaster()
         {
             Precautions = entDept.Precautions,
             TestName    = entDept.TestName,
             TestCharge  = entDept.TestCharge,
             IsDelete    = false,
             IsPathology = entDept.IsPathology,
             IsRadiology = entDept.IsRadiology,
             TestCatId   = entDept.TestCatId
         };
         objData.tblTestMasters.InsertOnSubmit(obj);
         objData.SubmitChanges();
         return(1);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #18
0
 public int Save(EntityTest entityTest)
 {
     //throw new System.NotImplementedException();
     return(5);
 }