/// <summary>
        /// Hàm insert Loại xét nghiệm
        /// </summary>
        /// <param name="pitems"></param>
        /// <returns></returns>
        public static string InsertTestTypeList(TTestTypeList pitems)
        {
            int   i       = 0;
            Query queryRs = TTestTypeList.CreateQuery();

            try
            {
                if (
                    !TTestTypeList.FetchByParameter(TTestTypeList.Columns.TestTypeId, Comparison.Equals,
                                                    pitems.TestTypeId).Read())
                {
                    pitems.IsNew = true;
                    pitems.Save(i);
                    return(queryRs.GetMax(TTestTypeList.Columns.TestTypeId).ToString());
                }
                else
                {
                    return("-1");
                    //throw new Exception(string.Format("Name:{0} Đã tồn tại", pitems.IPAddress));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                txtID.Text = txtID.Text.ToUpper();
                if (ValidData())
                {
                    switch (vAction)
                    {
                    case action.Insert:
                        var obj = new TTestTypeList();
                        obj.TestTypeName = Utility.sDbnull(txtName.Text);
                        obj.IntOrder     = Utility.ByteDbnull(txtSequence.Value);
                        obj.Abbreviation = Utility.sDbnull(txtAbbreviation.Text);
                        obj.Note         = Utility.sDbnull(txtDesc.Text);
                        obj.Price        = Utility.DecimaltoDbnull(txtPrice.Value);
                        obj.PrintDetail  = Utility.ByteDbnull(ckbPrintDetail.Checked ? 1 : 0);
                        obj.IsNew        = true;
                        obj.Save();

                        drList = dtList.NewRow();
                        drList[TTestTypeList.Columns.TestTypeId] =
                            TTestTypeList.CreateQuery().GetMax(TTestTypeList.Columns.TestTypeId);
                        ApplyData2Datarow();
                        dtList.Rows.InsertAt(drList, 0);
                        dtList.AcceptChanges();

                        txtID.Text = Utility.sDbnull(drList[TTestTypeList.Columns.TestTypeId]);
                        vAction    = action.Update;
                        break;

                    case action.Update:
                        new Update(TTestTypeList.Schema.Name).Set(TTestTypeList.Columns.TestTypeName).EqualTo(
                            txtName.Text).
                        Set(TTestTypeList.Columns.IntOrder).EqualTo(txtSequence.Value).
                        Set(TTestTypeList.Columns.Abbreviation).EqualTo(txtAbbreviation.Text).
                        Set(TTestTypeList.Columns.Note).EqualTo(txtDesc.Text).
                        Set(TTestTypeList.Columns.Price).EqualTo(txtPrice.Value).
                        Set(TTestTypeList.Columns.PrintDetail).EqualTo(
                            Utility.ByteDbnull(ckbPrintDetail.Checked ? 1 : 0)).
                        Where(TTestTypeList.Columns.TestTypeId).IsEqualTo(Utility.Int32Dbnull(txtID.Text)).
                        Execute();
                        ApplyData2Datarow();
                        drList.AcceptChanges();
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// hàm thực hiện việc lấy kiểu dịch vụ
        /// </summary>
        /// <param name="MaDV"></param>
        /// <returns></returns>
        private string GetTestTypeList(string MaDV)
        {
            string   TestType_Name = "";
            SqlQuery sqlQuery      = new Select().From(TTestTypeList.Schema)
                                     .Where(TTestTypeList.Columns.Abbreviation).IsEqualTo(MaDV.Trim());
            TTestTypeList objTestTypeList = sqlQuery.ExecuteSingle <TTestTypeList>();

            if (objTestTypeList != null)
            {
                TestType_Name = objTestTypeList.TestTypeName;
            }

            return(TestType_Name);
        }
 /// <summary>
 /// Hàm Delete 1 dòng trên grid
 /// </summary>
 /// <param name="pId"></param>
 public static void DelteTestTypeList(int pId)
 {
     try
     {
         if (TTestTypeList.FetchByID(pId) != null)
         {
             TTestTypeList.Delete(pId);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                txtID.Text = txtID.Text.ToUpper();
                if (ValidData())
                    switch (vAction)
                    {
                        case action.Insert:
                            var obj = new TTestTypeList();
                            obj.TestTypeName = Utility.sDbnull(txtName.Text);
                            obj.IntOrder = Utility.ByteDbnull(txtSequence.Value);
                            obj.Abbreviation = Utility.sDbnull(txtAbbreviation.Text);
                            obj.Note = Utility.sDbnull(txtDesc.Text);
                            obj.Price = Utility.DecimaltoDbnull(txtPrice.Value);
                            obj.PrintDetail = Utility.ByteDbnull(ckbPrintDetail.Checked ? 1 : 0);
                            obj.IsNew = true;
                            obj.Save();

                            drList = dtList.NewRow();
                            drList[TTestTypeList.Columns.TestTypeId] =
                                TTestTypeList.CreateQuery().GetMax(TTestTypeList.Columns.TestTypeId);
                            ApplyData2Datarow();
                            dtList.Rows.InsertAt(drList, 0);
                            dtList.AcceptChanges();

                            txtID.Text = Utility.sDbnull(drList[TTestTypeList.Columns.TestTypeId]);
                            vAction = action.Update;
                            break;
                        case action.Update:
                            new Update(TTestTypeList.Schema.Name).Set(TTestTypeList.Columns.TestTypeName).EqualTo(
                                txtName.Text).
                                Set(TTestTypeList.Columns.IntOrder).EqualTo(txtSequence.Value).
                                Set(TTestTypeList.Columns.Abbreviation).EqualTo(txtAbbreviation.Text).
                                Set(TTestTypeList.Columns.Note).EqualTo(txtDesc.Text).
                                Set(TTestTypeList.Columns.Price).EqualTo(txtPrice.Value).
                                Set(TTestTypeList.Columns.PrintDetail).EqualTo(
                                    Utility.ByteDbnull(ckbPrintDetail.Checked ? 1 : 0)).
                                Where(TTestTypeList.Columns.TestTypeId).IsEqualTo(Utility.Int32Dbnull(txtID.Text)).
                                Execute();
                            ApplyData2Datarow();
                            drList.AcceptChanges();
                            break;
                    }
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
            }
        }
 /// <summary>
 /// Hàm Update dữ liệu trên Grid
 /// </summary>
 /// <param name="pitems"></param>
 public static void UpdateTestTypeList(TTestTypeList pitems)
 {
     try
     {
         if (TTestTypeList.FetchByID(pitems.TestTypeId) != null)
         {
             pitems.IsNew = false;
             pitems.Save();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 7
0
        /// <summary>
        /// hàm thực hiện lấy thông tin loại xét nghiệm
        /// </summary>
        /// <param name="ThietBi_ID"></param>
        /// <returns></returns>
        private string GetTestType_Name(int ThietBi_ID)
        {
            string   MaDV     = "FUNNY";
            SqlQuery sqlQuery = new Select().From(DDeviceList.Schema)
                                .Where(DDeviceList.Columns.DeviceId).IsEqualTo(ThietBi_ID);
            DDeviceList objDeviceList = sqlQuery.ExecuteSingle <DDeviceList>();

            if (objDeviceList != null)
            {
                SqlQuery query =
                    new Select().From(TTestTypeList.Schema).Where(TTestTypeList.Columns.TestTypeId).IsEqualTo(
                        objDeviceList.TestTypeId);
                TTestTypeList testTypeList = query.ExecuteSingle <TTestTypeList>();
                if (testTypeList != null)
                {
                    MaDV = testTypeList.Abbreviation;
                }
            }
            return(MaDV);
        }
Esempio n. 8
0
        public void Insert(string TestTypeName,string Note,short? IntOrder,short? PrintDetail,decimal? Price,string Abbreviation)
        {
            TTestTypeList item = new TTestTypeList();

            item.TestTypeName = TestTypeName;

            item.Note = Note;

            item.IntOrder = IntOrder;

            item.PrintDetail = PrintDetail;

            item.Price = Price;

            item.Abbreviation = Abbreviation;

            item.Save(UserName);
        }
Esempio n. 9
0
        public void Update(int TestTypeId,string TestTypeName,string Note,short? IntOrder,short? PrintDetail,decimal? Price,string Abbreviation)
        {
            TTestTypeList item = new TTestTypeList();
            item.MarkOld();
            item.IsLoaded = true;

            item.TestTypeId = TestTypeId;

            item.TestTypeName = TestTypeName;

            item.Note = Note;

            item.IntOrder = IntOrder;

            item.PrintDetail = PrintDetail;

            item.Price = Price;

            item.Abbreviation = Abbreviation;

            item.Save(UserName);
        }