예제 #1
0
        public void BagRefresh()
        {
            int id = 1;
            int originalCount;

            BasicClass basicClass = InsertBasicClass(id);

            originalCount = basicClass.StringBag.Count;

            ISession     s = OpenSession();
            ITransaction t = s.BeginTransaction();

            ISession     s2 = OpenSession();
            ITransaction t2 = s2.BeginTransaction();

            BasicClass bc  = (BasicClass)s.Load(typeof(BasicClass), id);
            BasicClass bc2 = (BasicClass)s2.Load(typeof(BasicClass), id);

            bc2.StringBag.Add("refresh value");
            t2.Commit();
            s2.Close();

            s.Refresh(bc);
            Assert.AreEqual(originalCount + 1, bc.StringBag.Count, "was refreshed correctly");

            s.Delete(bc);
            t.Commit();
            s.Close();
        }
예제 #2
0
        private void getMainInformation()
        {
            var dt1       = new DataTable();
            var dt2       = new DataTable();
            var UsedClass = new BasicClass();

            dt1 = UsedClass.selectdata("Casher_select_all_IDs", null);
            dt2 = UsedClass.selectdata("Casher_SelectUnUsedInvoices", null);
            textBoxPercentageTransfer.Text = dt1.Rows[0]["PercentageTransfer"].ToString();

            if (dt2.Rows.Count > 0)
            {
                textBoxInvoiceNo.Text = dt2.Rows[0]["InvoiceNo"].ToString();
                deletePrviousInvoices();
                UnUsedId = true;
            }
            else
            {
                textBoxInvoiceNo.Text = dt1.Rows[0]["InvoiceNo"].ToString();
                UsedClass.ExecuteCommand("Casher_IncreaseInvoiceNumber", null);     //increase Invoice Number
                SaveInvoices("UNUSED", "UNUSED");
                UnUsedId = true;
            }
            //else
            //{
            //}
        }
예제 #3
0
        private void set_itemsWithoutarcode(object sender, EventArgs e)
        {
            Button clickedbutton = sender as Button;

            flowLayoutPanelitemsWithoutBar.Controls.Clear();
            var dt        = new DataTable();
            var UsedClass = new BasicClass();

            SqlParameter[] param = new SqlParameter[1];
            param[0] = new SqlParameter("@Item", SqlDbType.NVarChar, 250);

            param[0].Value = clickedbutton.Text;
            dt             = UsedClass.selectdata("CasherForm_Selectitem_UsingBarcodeORName", param);

            listBoxitemsWithoutBarcode.DataSource    = dt;
            listBoxitemsWithoutBarcode.DisplayMember = "ItemName";
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Button btn_Item = new Button();
                btn_Item.Name      = dt.Rows[i]["ItemName"].ToString();
                btn_Item.Text      = dt.Rows[i]["ItemName"].ToString();
                btn_Item.AutoSize  = true;
                btn_Item.Height    = 55;
                btn_Item.FlatStyle = FlatStyle.Flat;
                btn_Item.FlatAppearance.BorderSize         = 1;
                btn_Item.FlatAppearance.MouseOverBackColor = Color.FromArgb(245, 124, 0);
                btn_Item.ForeColor = Color.FromArgb(255, 255, 255);
                btn_Item.Click    += new EventHandler(SetItemsGrid);
                flowLayoutPanelitemsWithoutBar.Controls.Add(btn_Item);
            }
        }
예제 #4
0
        /// <summary>
        /// Compares the non Collection Properties of the BasicClass
        /// </summary>
        /// <param name="expected">The expected values.</param>
        /// <param name="actual">The Actual values.</param>
        /// <param name="includeCollections"></param>
        internal void AssertPropertiesEqual(BasicClass expected, BasicClass actual, bool includeCollections)
        {
            Assert.AreEqual(expected.Id, actual.Id, "Id");
            Assert.AreEqual(expected.CharacterProperty, actual.CharacterProperty, "CharacterProperty");
            Assert.AreEqual(expected.ClassProperty, actual.ClassProperty, "ClassProperty");
            Assert.AreEqual(expected.CultureInfoProperty, actual.CultureInfoProperty, "CultureInfoProperty");
            Assert.AreEqual(expected.DateTimeProperty, actual.DateTimeProperty, "DateTimeProperty");
            Assert.AreEqual(expected.Int16Property, actual.Int16Property, "Int16Property");
            Assert.AreEqual(expected.Int32Property, actual.Int32Property, "Int32Property");
            Assert.AreEqual(expected.Int64Property, actual.Int64Property, "Int64Property");
            Assert.AreEqual(expected.SingleProperty, actual.SingleProperty, 0, "SingleProperty");
            Assert.AreEqual(expected.StringProperty, actual.StringProperty, "StringProperty");
            Assert.AreEqual(expected.TicksProperty, actual.TicksProperty, "TicksProperty");
            Assert.AreEqual(expected.TrueFalseProperty, actual.TrueFalseProperty, "TrueFalseProperty");
            Assert.AreEqual(expected.YesNoProperty, actual.YesNoProperty, "YesNoProperty");

            if (includeCollections)
            {
                ObjectAssert.AreEqual(expected.StringArray, actual.StringArray);
                ObjectAssert.AreEqual(expected.Int32Array, actual.Int32Array);
                ObjectAssert.AreEqual(expected.StringBag, actual.StringBag, false);
                ObjectAssert.AreEqual(expected.StringList, actual.StringList);
                ObjectAssert.AreEqual(expected.StringMap, actual.StringMap, true);
                ObjectAssert.AreEqual(expected.StringSet, actual.StringSet);
            }
        }
예제 #5
0
        public void BagRefresh()
        {
            int id = 1;
            int originalCount;

            BasicClass basicClass = InsertBasicClass(id);

            originalCount = basicClass.StringBag.Count;

            ISession s = OpenSession();
            // There used to be a transaction started on s and commited before the Close().
            // This transaction was removed since it was causing a deadlock with SQLite.
            // This is a theoretical improvement as well, since the transaction could
            // be in a mode that would prevent non-repeatable reads, hence breaking the test.

            ISession     s2 = OpenSession();
            ITransaction t2 = s2.BeginTransaction();

            BasicClass bc  = (BasicClass)s.Load(typeof(BasicClass), id);
            BasicClass bc2 = (BasicClass)s2.Load(typeof(BasicClass), id);

            bc2.StringBag.Add("refresh value");
            t2.Commit();
            s2.Close();

            s.Refresh(bc);
            Assert.AreEqual(originalCount + 1, bc.StringBag.Count, "was refreshed correctly");

            s.Delete(bc);
            s.Flush();
            s.Close();
        }
예제 #6
0
        private void buttonPreventUser_Click(object sender, EventArgs e)
        {
            var dt        = new DataTable();
            var UsedClass = new BasicClass();

            SqlParameter[] param = new SqlParameter[7];
            param[0] = new SqlParameter("@ID", SqlDbType.Int);
            param[1] = new SqlParameter("@FullName", SqlDbType.NVarChar, 150);
            param[2] = new SqlParameter("@UserName", SqlDbType.NVarChar, 150);
            param[3] = new SqlParameter("@ReportPermision", SqlDbType.Bit);
            param[4] = new SqlParameter("@StorePermision", SqlDbType.Bit);
            param[5] = new SqlParameter("@CasherPermision", SqlDbType.Bit);
            param[6] = new SqlParameter("@SuperUser", SqlDbType.Bit);
            if (dataGridViewUsers.CurrentRow.Index >= 0)
            {
                param[0].Value = Int32.Parse(dataGridViewUsers.Rows[dataGridViewUsers.CurrentRow.Index].Cells["ColumnUserID"].Value.ToString());
                param[1].Value = dataGridViewUsers.Rows[dataGridViewUsers.CurrentRow.Index].Cells["ColumnUserFullName"].Value.ToString();
                param[2].Value = dataGridViewUsers.Rows[dataGridViewUsers.CurrentRow.Index].Cells["ColumnUserName"].Value.ToString();
                param[3].Value = 0;
                param[4].Value = 0;
                param[5].Value = 0;
                param[6].Value = 0;

                UsedClass.ExecuteCommand("Casher_UpdateUsers", param);

                MessageBox.Show("تم حضر هذا المستخدم سوف يتم الخروج من البرنامج", "MESSAGE");

                Application.Exit();
            }
        }
예제 #7
0
        public IActionResult DoUntil(string what, [FromBody] BasicClass until)
        {
            if (until.until == null)
            {
                return(Json(new { error = "Please provide a number!" }));
            }
            int?end = until.until;

            for (int?i = until.until - 1; i > 0; i--)
            {
                if (what == "sum")
                {
                    end += i;
                }
                else if (what == "factor")
                {
                    end *= i;
                }
                else
                {
                    return(Json(new { error = "Please provide an input!" }));
                }
            }
            return(Json(new { result = $"{end}" }));
        }
예제 #8
0
        private async void BtnDelet_OnClick(object sender, RoutedEventArgs e)
        {
            if (!(StackItems.DataContext is Customer item))
            {
                return;
            }

            var massage = await BasicClass.ShowBasicMessage(this,
                                                            "تنبيه",
                                                            "هل ترغب في حذف الاشتراك ؟ ",
                                                            MessageDialogStyle.AffirmativeAndNegative);

            if (massage != MessageDialogResult.Affirmative)
            {
                return;
            }

            using (_customerServices)
            {
                _customerServices.CustomerRepository.Delete(item);
                await _customerServices.CustomerRepository.SaveAsync();
            }

            StackItems.DataContext = new Customer();

            await PopulateDatGrid();
        }
예제 #9
0
        private async void BtnLogin_OnClick(object sender, RoutedEventArgs e)
        {
            try
            {
                using (_loginServices)
                {
                    var usr = await _loginServices.CheckUser(NameTextBox.Text, FloatingPasswordBox.Password);

                    if (!usr)
                    {
                        await BasicClass.ShowBasicMessage(this, "تنبيه", "الرجاء التأكد من صحة إسم المستخدم وكلمة المرور", MessageDialogStyle.Affirmative);

                        return;
                    }
                    else
                    {
                        this.Hide();
                        //App.User = usr;
                        BasicClass.OpenWindow(new MainWindow());
                    }
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);

                MessageBox.Show(exception.InnerException?.Message);
            }
        }
예제 #10
0
        private void listBoxSelectionItems_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            var dt        = new DataTable();
            var UsedClass = new BasicClass();

            if (listBoxSelectionItems.Enabled == true)
            {
                SqlParameter[] param = new SqlParameter[1];
                param[0]       = new SqlParameter("@Item", SqlDbType.NVarChar, 250);
                param[0].Value = listBoxSelectionItems.Text;

                dt = UsedClass.selectdata("CasherForm_Selectitem_UsingBarcodeORName", param);
                if (dt.Rows.Count > 0)
                {
                    var ItemName      = dt.Rows[0]["ItemName"].ToString();
                    var price         = dt.Rows[0]["price_for_buy"].ToString();
                    var StockQuantity = int.Parse(dt.Rows[0]["StockQuantity"].ToString());
                    var CriticalRange = int.Parse(dt.Rows[0]["Critical_Quantity"].ToString());
                    var ExpireDate    = dt.Rows[0]["ItemExpire"].ToString();
                    //note
                    price = "1";
                    writeIntoGrid(ItemName, price, StockQuantity, CriticalRange, ExpireDate);
                }
            }
        }
예제 #11
0
 //=======================================================
 //Service provided by Telerik (www.telerik.com)
 //Conversion powered by NRefactory.
 //Twitter: @telerik
 //Facebook: facebook.com/telerik
 //=======================================================
 private void sSaveStudentTotalGrade()
 {
     try
     {
         int    vSTD_ID            = BasicClass.vUsrID;
         string vStdGradesStatment = "";
         vStdGradesStatment = "INSERT INTO [StudentExam].[dbo].[Student_Grades]																"+ "\n" +
                              "           ([TValue],			[Desca]				,[TDate],[STD_ID],[Lastupdate],[ProcessID],[MachineName])	"+ "\n" +
                              " SELECT     SUM(Grade) , 'اجمالى مجموع درجات الطالب',GETDATE(),STD_ID ,GETDATE()   ,   '" + Process.GetCurrentProcess().Id + "'      ,'" + System.Environment.MachineName + "'" + "\n" +
                              " FROM		Student_Answers																						"+ "\n" +
                              " WHERE		STD_ID = "+ BasicClass.vUsrID + "																						"+ "\n" +
                              " GROUP BY	STD_ID																								";
         vStdGradesStatment += "UPDATE [User]										"+ "\n" +
                               "   SET [IsExamTaken] = 'Y'							"+ "\n" +
                               "      ,[Lastupdate]  = GETDATE()					"+ "\n" +
                               "      ,[ProcessID]   = '" + Process.GetCurrentProcess().Id + "' " + "\n" +
                               "      ,[MachineName] = '" + System.Environment.MachineName.Trim() + "'" + "\n" +
                               "  WHERE ID =" + vSTD_ID + "\n";
         Int64 saved = BasicClass.fDMLData(vStdGradesStatment, this.Name);
     }
     catch (Exception ex)
     {
         ExceptionHandler.HandleException(ex.Message, "FRM_Exam", "sSaveStudentTotalGrade");
     }
     finally
     {
         if (BasicClass.vSqlConn.State == ConnectionState.Broken || BasicClass.vSqlConn.State == ConnectionState.Open)
         {
             BasicClass.vSqlConn.Close();
         }
     }
 }
예제 #12
0
        private void buttonPrintInvoice_Click(object sender, EventArgs e)
        {
            var UsedClass = new BasicClass();
            var dt        = new DataTable();

            //if ( dataGridViewItems.Rows.Count > 0 || textBoxInvoiceNO.Text != "" )
            //{
            if (textBoxCustomerName.Text == "")
            {
                MessageBox.Show("يرجى ادخال أسم الزبون", "Message");
                textBoxCustomerName.Focus();
            }
            else
            {
                SqlParameter[] param = new SqlParameter[2];
                param[0]       = new SqlParameter("@InvoiceNo", SqlDbType.Int);
                param[1]       = new SqlParameter("@CustomerName", SqlDbType.NVarChar, 250);
                param[0].Value = textBoxInvoiceNO.Text;
                param[1].Value = textBoxCustomerName.Text.Trim();

                dt = UsedClass.selectdata("Casher_PrintForma", param);
                var crp = new Reports.PurshaceReport();
                CrystalDecisions.CrystalReports.Engine.TextObject invoiceType = (CrystalDecisions.CrystalReports.Engine.TextObject)crp.ReportDefinition.Sections["Section2"].ReportObjects["Text15"];
                invoiceType.Text = textBoxInvoiceNO.Text;
                crp.SetDataSource(dt);
                PrintForm form = new PrintForm();
                form.crystalReportViewer1.ReportSource = crp;
                form.ShowDialog();
            }

            //}
        }
예제 #13
0
    public static DateTime fGetCurDateTime()
    {
        //JN 18-05-2005
        //Function To Get Current DateTime From DB Server
        DateTime   vCurDateTime = default(DateTime);
        BasicClass vcBase       = new BasicClass("BTS");

        try {
            System.Data.SqlClient.SqlCommand vSqlCommand = new System.Data.SqlClient.SqlCommand();
            vSqlCommand.Connection = BasicClass.vSqlConn;
            BasicClass.vSqlConn.Open();
            //Open System.Database Connection.
            vSqlCommand.CommandText = " Select GetDate() ";
            SqlDataReader SqlReader = default(SqlDataReader);
            SqlReader = vSqlCommand.ExecuteReader();
            while (SqlReader.Read())
            {
                if (SqlReader.IsDBNull(0) == false)
                {
                    vCurDateTime = Convert.ToDateTime(SqlReader[0]);
                }
            }
        } catch (Exception ex) {
            //cException.sHandleException(ex.Message, "cBase", "fGetCurDateTime");
        } finally {
            if (BasicClass.vSqlConn.State == ConnectionState.Open | BasicClass.vSqlConn.State == ConnectionState.Broken)
            {
                BasicClass.vSqlConn.Close();
            }
        }
        return(vCurDateTime);
    }
예제 #14
0
        private void STS_Main_ButtonClick(object sender, Infragistics.Win.UltraWinStatusBar.PanelEventArgs e)
        {
            try
            {
                if (e.Panel.Key.ToString() == "BTN_OK")
                {
                    if (fValidateInputs())
                    {
                        cImportExcel vImport = new cImportExcel();
                        vImport.vTDate = BasicClass.fGetCurDateTime();

                        vImport.vFileName     = TXT_FileName.Text;
                        vImport.vWorkSheetNo  = int.Parse(TXT_WorkSheet.Value.ToString());
                        vImport.vFirstRow     = int.Parse(TXT_FirstRow.Value.ToString());
                        vImport.vFirstColumn  = int.Parse(TXT_FirstColumn.Value.ToString());
                        vImport.vNameCol      = int.Parse(TXT_Name.Value.ToString());
                        vImport.vMobileNoCol  = int.Parse(TXT_MobileNumber.Value.ToString());
                        vImport.vAddressCol   = int.Parse(TXT_Address.Value.ToString());
                        vImport.vBirthDateCol = int.Parse(TXT_BirthDate.Value.ToString());
                        vImport.vGenderCol    = int.Parse(TXT_Gender.Value.ToString());
                        vLstItems             = vImport.fImportPersons();
                        this.Close();
                    }
                }
                else if (e.Panel.Key.ToString() == "BTN_Cancel")
                {
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                ExceptionHandler.HandleException(ex.Message, this.Name, "StatusBar_Lov_ButtonClick");
            }
        }
예제 #15
0
        private void buttondeleteCatSave_Click(object sender, EventArgs e)
        {
            var UsedClass = new BasicClass();

            SqlParameter[] param = new SqlParameter[1];
            param[0] = new SqlParameter("@CategoryID", SqlDbType.Int);
            if (comboBoxdeletechooseCat.Text == "")
            {
                MessageBox.Show("خطأ في ادخال المعلومات", "Message");
            }
            else
            {
                param[0].Value = int.Parse((comboBoxdeletechooseCat.SelectedValue.ToString()));
                DialogResult Result = MessageBox.Show("عملية الحذف سوف تؤدي الى حذف العناصر التي تنتمي لهذا الصنف", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Hand);
                if (Result == DialogResult.Yes)
                {
                    UsedClass.ExecuteCommand("Casher_deleteCategory", param);
                    MessageBox.Show("DONE", "MESSAGE");
                    comboBoxdeletechooseCat_DropDown(sender, e);
                }
                else
                {
                }
            }
        }
예제 #16
0
        private async void BtnDelete_OnClick(object sender, RoutedEventArgs e)
        {
            if (!(StackItem.DataContext is Line item))
            {
                return;
            }

            var massage = await BasicClass.ShowBasicMessage(this, "تنبيه", "هل ترغب في حذف الاشتراك ؟ ",
                                                            MessageDialogStyle.AffirmativeAndNegative);

            if (massage != MessageDialogResult.Affirmative)
            {
                return;
            }

            using (_line)
            {
                _line.Line.Delete(item);
                await _line.Line.SaveAsync();
            }

            StackItem.DataContext = new Customer();

            await PopulateDgv();
        }
예제 #17
0
        private void buttonModifyUsers_Click(object sender, EventArgs e)
        {
            var dt        = new DataTable();
            var UsedClass = new BasicClass();

            SqlParameter[] param = new SqlParameter[7];
            param[0] = new SqlParameter("@ID", SqlDbType.Int);
            param[1] = new SqlParameter("@FullName", SqlDbType.NVarChar, 150);
            param[2] = new SqlParameter("@UserName", SqlDbType.NVarChar, 150);
            param[3] = new SqlParameter("@ReportPermision", SqlDbType.Bit);
            param[4] = new SqlParameter("@StorePermision", SqlDbType.Bit);
            param[5] = new SqlParameter("@CasherPermision", SqlDbType.Bit);
            param[6] = new SqlParameter("@SuperUser", SqlDbType.Bit);
            if (dataGridViewUsers.CurrentRow.Index >= 0 && changesInUserFlag == true)
            {
                for (int i = 0; i < dataGridViewUsers.Rows.Count; i++)
                {
                    param[0].Value = Int32.Parse(dataGridViewUsers.Rows[i].Cells["ColumnUserID"].Value.ToString());
                    param[1].Value = dataGridViewUsers.Rows[i].Cells["ColumnUserFullName"].Value.ToString();
                    param[2].Value = dataGridViewUsers.Rows[i].Cells["ColumnUserName"].Value.ToString();
                    param[3].Value = Convert.ToBoolean(dataGridViewUsers.Rows[i].Cells["ColumnReportPermsion"].Value.ToString());
                    param[4].Value = Convert.ToBoolean(dataGridViewUsers.Rows[i].Cells["ColumnStorePermsion"].Value.ToString());
                    param[5].Value = Convert.ToBoolean(dataGridViewUsers.Rows[i].Cells["ColumnCasherPermsion"].Value.ToString());
                    param[6].Value = Convert.ToBoolean(dataGridViewUsers.Rows[i].Cells["ColumnSuper"].Value.ToString());

                    UsedClass.ExecuteCommand("Casher_UpdateUsers", param);
                }
                MessageBox.Show("DONE", "MESSAGE");
                Application.Exit();
            }
            else
            {
                //nothing
            }
        }
        public void ClassSetPropertyNameIsExactMatch()
        {
            var input = new BasicClass();

            TestAssignmentOnReferenceType(input, "Property", "abc123");
            Assert.AreEqual("abc123", input.Property);
        }
예제 #19
0
 public void SetUp()
 {
     _driver.Manage().Cookies.DeleteAllCookies();
     _driver.Navigate().GoToUrl("https://github.com/");
     _driver.Manage().Window.Maximize();
     BasicClass.ShouldLocate(_driver, DataBase.targetUrl); //ожидание
 }
        public void ClassSetPropertyNameDiffersInCase()
        {
            var input = new BasicClass();

            TestAssignmentOnReferenceType(input, "pRoPeRtY", "other");
            Assert.AreEqual("other", input.Property);
        }
예제 #21
0
        private bool fSaveData(bool pMessage)
        {
            bool   vIsSaved     = false;
            long   rowsAffected = 0;
            string vGender      = "";

            try
            {
                if (pMessage == true)
                {
                    if (MessageBox.Show("هل تريد الحفظ ؟", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign) == System.Windows.Forms.DialogResult.Yes)
                    {
                        if (fValidateQuestion() == false)
                        {
                            return(false);
                        }
                        else
                        {
                            sSave();
                            rowsAffected = BasicClass.fDMLData(vSqlStatment, "FRM_Questions");
                            if (rowsAffected > 0)
                            {
                                if (Strings.Trim(this.OpnDlg_Picture.FileName).Length > 0)
                                {
                                    rowsAffected += BasicClass.fAttachImage(Strings.Trim(this.OpnDlg_Picture.FileName), "[Question]", "Picture", " Where Code           ='" + Strings.Trim(vQuestionCode) + "'", this.Name);
                                    this.OpnDlg_Picture.FileName = null;
                                }
                                vIsSaved = true;
                                sNew();
                                sResetFormMode();
                            }
                        }
                    }
                }
                else
                {
                    if (fValidateQuestion() == false)
                    {
                        return(false);
                    }
                    else
                    {
                        sSave();
                        rowsAffected = BasicClass.fDMLData(vSqlStatment, "FRM_Questions");
                        if (rowsAffected > 0)
                        {
                            vIsSaved = true;
                            sNew();
                            sResetFormMode();
                        }
                    }
                }
                sEmptySqlStatmentArray();
            }
            catch (Exception Ex)
            {
                ExceptionHandler.HandleException(Ex.Message, "FRM_Questions", "fSaveData");
            }
            return(vIsSaved);
        }
        public void ClassSetPropertyWithInvalidType()
        {
            var input = new BasicClass();

            TestAssignmentOnReferenceType(input, "Property", true);
            Assert.AreEqual("Success!", input.Property);
        }
예제 #23
0
        public void TestPrivateFieldAccess()
        {
            using (ISession s = OpenSession())
                using (ITransaction tx = s.BeginTransaction())
                {
                    BasicClass bc = new BasicClass();
                    if (!TestDialect.SupportsNullCharactersInUtfStrings)
                    {
                        bc.CharacterProperty = 'a';
                    }
                    bc.Id = 1;
                    bc.ValueOfPrivateField = 5;
                    s.Save(bc);
                    tx.Commit();
                }

            using (ISession s = OpenSession())
                using (ITransaction tx = s.BeginTransaction())
                {
                    BasicClass bc = (BasicClass)s.Load(typeof(BasicClass), 1);
                    Assert.AreEqual(5, bc.ValueOfPrivateField, "private field accessor");
                    s.Delete(bc);
                    tx.Commit();
                }
        }
        public void ClassSetPrimitiveProperty()
        {
            var input = new BasicClass();

            TestAssignmentOnReferenceType(input, "Primitive", 123);
            Assert.AreEqual(123, input.Primitive);
        }
예제 #25
0
        public void TestWrapArrayInListProperty()
        {
            ISession     s  = OpenSession();
            ITransaction t  = s.BeginTransaction();
            BasicClass   bc = new BasicClass();

            if (!TestDialect.SupportsNullCharactersInUtfStrings)
            {
                bc.CharacterProperty = 'a';
            }

            int id = 1;

            bc.StringList = new string[] { "one", "two" };

            s.Save(bc, id);
            t.Commit();
            s.Close();

            s  = OpenSession();
            t  = s.BeginTransaction();
            bc = (BasicClass)s.Load(typeof(BasicClass), id);

            Assert.AreEqual(2, bc.StringList.Count, "should have saved to StringList from an array");
            Assert.IsTrue(bc.StringList.Contains("one"), "'one' should be in there");
            Assert.IsTrue(bc.StringList.Contains("two"), "'two' should be in there");

            s.Delete(bc);
            t.Commit();
            s.Close();
        }
예제 #26
0
        private int getInformation(string ID)
        {
            var dt        = new DataTable();
            var UsedClass = new BasicClass();

            dt = UsedClass.selectdata("Casher_select_all_IDs", null);

            if (dt.Rows.Count > 0)
            {
                switch (ID)
                {
                case "ItemID":
                    var ItemID = int.Parse(dt.Rows[0]["ItemID"].ToString());
                    return(ItemID);

                case "CatID":
                    var CatID = int.Parse(dt.Rows[0]["CategoryID"].ToString());
                    return(CatID);

                default:
                    break;
                }
            }
            return(0);
        }
예제 #27
0
        private void textBoxBarCodeItem_KeyDown(object sender, KeyEventArgs e)
        {
            var dt        = new DataTable();
            var UsedClass = new BasicClass();

            if (e.KeyValue == (char)Keys.Enter)
            {
                if (textBoxBarCodeItem.Text != "")
                {
                    SqlParameter[] param = new SqlParameter[1];
                    param[0]       = new SqlParameter("@Item", SqlDbType.NVarChar, 250);
                    param[0].Value = textBoxBarCodeItem.Text.Trim();

                    dt = UsedClass.selectdata("CasherForm_Selectitem_UsingBarcodeORName", param);
                    textBoxBarCodeItem.Text = "";
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        var ItemName      = dt.Rows[i]["ItemName"].ToString();
                        var price         = dt.Rows[i]["price_for_buy"].ToString();
                        var StockQuantity = int.Parse(dt.Rows[i]["StockQuantity"].ToString());
                        var CriticalRange = int.Parse(dt.Rows[i]["Critical_Quantity"].ToString());
                        var ExpireDate    = dt.Rows[i]["ItemExpire"].ToString();
                        writeIntoGrid(ItemName, price, StockQuantity, CriticalRange, ExpireDate);
                    }
                }
            }
        }
예제 #28
0
        private void buttonedititem_Click(object sender, EventArgs e)
        {
            var UsedClass = new BasicClass();
            var dt        = new DataTable();

            SqlParameter[] param = new SqlParameter[7];
            if (changesInItemFlag)
            {
                param[0] = new SqlParameter("@itemID", SqlDbType.Int);
                param[1] = new SqlParameter("@itemName", SqlDbType.NVarChar, 100);
                param[2] = new SqlParameter("@itemCategory", SqlDbType.NVarChar, 100);
                param[3] = new SqlParameter("@Barcode", SqlDbType.NVarChar, 100);
                param[4] = new SqlParameter("@ExpireDate", SqlDbType.NVarChar, 100);
                param[5] = new SqlParameter("@CriticalRange", SqlDbType.Int);
                param[6] = new SqlParameter("@PCS", SqlDbType.Int);
                for (int i = 0; i < dataGridVieweditItem.Rows.Count; i++)
                {
                    param[0].Value = int.Parse(dataGridVieweditItem.Rows[i].Cells["ColumnItemID"].Value.ToString());
                    param[1].Value = dataGridVieweditItem.Rows[i].Cells["ColumnItemName"].Value.ToString();
                    param[2].Value = dataGridVieweditItem.Rows[i].Cells["ColumnItemCategory"].Value.ToString();
                    param[3].Value = dataGridVieweditItem.Rows[i].Cells["ColumnBarcode"].Value.ToString();
                    param[4].Value = dataGridVieweditItem.Rows[i].Cells["ColumnExpireDate"].Value.ToString();
                    param[5].Value = int.Parse(dataGridVieweditItem.Rows[i].Cells["ColumnCriticalRange"].Value.ToString());
                    param[6].Value = int.Parse(dataGridVieweditItem.Rows[i].Cells["ColumnpcsCarton"].Value.ToString());
                    UsedClass.ExecuteCommand("Casher_settingUpdateItem", param);
                }
                changesInItemFlag = false;
                MessageBox.Show("DONE", "MESSAGE");
                textBoxEditItemSearch_TextChanged(sender, e);
            }
            else
            {
            }

            //if ( changesInItems.Rows.Count > 0 && changesInItemFlag == true )
            //{
            //    param[0] = new SqlParameter ( "@itemID" , SqlDbType.Int );
            //    param[1] = new SqlParameter ( "@itemName" , SqlDbType.NVarChar , 100 );
            //    param[2] = new SqlParameter ( "@itemCategory" , SqlDbType.NVarChar , 100 );
            //    param[3] = new SqlParameter ( "@Barcode" , SqlDbType.NVarChar , 100 );
            //    param[4] = new SqlParameter ( "@ExpireDate" , SqlDbType.NVarChar , 100 );
            //    param[5] = new SqlParameter ( "@CriticalRange" , SqlDbType.Int );
            //    param[6] = new SqlParameter ( "@PCS" , SqlDbType.Int );

            //    for ( int i = 0 ; i < changesInItems.Rows.Count ; i++ )
            //    {
            //        param[0].Value = changesInItems.Rows[i]["ItemID"].ToString ();
            //        param[1].Value = changesInItems.Rows[i]["ItemName"].ToString ();
            //        param[2].Value = changesInItems.Rows[i]["itemCategory"].ToString ();
            //        param[3].Value = changesInItems.Rows[i]["ItemBarCode"].ToString ();
            //        param[4].Value = changesInItems.Rows[i]["ItemExpire"].ToString ();
            //        param[5].Value = int.Parse ( changesInItems.Rows[i]["Critical_Quantity"].ToString () );
            //        param[6].Value = int.Parse ( changesInItems.Rows[i]["Pcs_InsideCarton"].ToString () );
            //        UsedClass.ExecuteCommand ( "Casher_settingUpdateItem" , param );
            //    }
            //    changesInItemFlag = false;
            //    MessageBox.Show ( "DONE" , "MESSAGE" );
            //    textBoxEditItemSearch_TextChanged ( sender , e );
            //}
        }
예제 #29
0
 private void CacherForm_Activated(object sender, EventArgs e)
 {
     if (BasicClass.UnrnningBillId > 0)
     {
         dataGridViewItems.Rows.Clear();
         counter = 1;
         var            UsedClass = new BasicClass();
         var            dt        = new DataTable();
         SqlParameter[] param     = new SqlParameter[1];
         param[0]       = new SqlParameter("@InvoiceFilter", SqlDbType.NVarChar, 150);
         param[0].Value = BasicClass.UnrnningBillId.ToString();
         dt             = UsedClass.selectdata("Casher_Select_Invoices_with_all_Information", param);
         if (dt.Rows.Count > 0)
         {
             textBoxCustomerName.Text       = dt.Rows[0]["CustomerName"].ToString();
             textBoxInvoiceNo.Text          = dt.Rows[0]["invoiceNumber"].ToString();
             dateTimePickerInvoiceDate.Text = dt.Rows[0]["InvoiceDate"].ToString();
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 var ItemName = dt.Rows[i]["itemName"].ToString();
                 var Quantity = int.Parse(dt.Rows[i]["itemQuantity"].ToString());
                 Quantity = Quantity * -1;
                 var ItemPrice     = dt.Rows[i]["itemPrice"].ToString();
                 var TotalPrice    = dt.Rows[i]["totalPrice"].ToString();
                 var ItemExpire    = dt.Rows[i]["ItemExpire"];
                 var StockQuantity = dt.Rows[i]["StockQuantity"].ToString();
                 var CriticalRange = dt.Rows[i]["Critical_Quantity"].ToString();
                 dataGridViewItems.Rows.Add(counter, ItemName, Quantity, ItemPrice, TotalPrice, 0, ItemExpire, StockQuantity, CriticalRange);
                 counter++;
             }
             BasicClass.UnrnningBillId = 0;
             moneyCalcuation();
         }
     }
 }
        public void ClassPropertyDoesNotExist()
        {
            var input  = new BasicClass();
            var result = Get(input, "BlahBlahBlah");

            Assert.Null(result);
        }