当前位置: 首页>>代码示例>>C#>>正文


C# DB.AddCondition方法代码示例

本文整理汇总了C#中DB.AddCondition方法的典型用法代码示例。如果您正苦于以下问题:C# DB.AddCondition方法的具体用法?C# DB.AddCondition怎么用?C# DB.AddCondition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DB的用法示例。


在下文中一共展示了DB.AddCondition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Fill_DG

        private void Fill_DG()
        {

            try
            {
                DB db = new DB();

                db.AddCondition("pay_date", From_DTP.Value.Value.Date, false, ">=", "SD");
                db.AddCondition("pay_date", To_DTP.Value.Value.Date, false, "<=", "ED");

                DataSet ds = db.SelectSet(@"select * from payments p join persons pp on p.pay_per_id=pp.per_id where pay_trn_id=5 and pay_date>[email protected] and pay_date<[email protected];
                                            select * from payments p join persons pp on p.pay_per_id=pp.per_id where pay_trn_id=6 and pay_date>[email protected] and pay_date<[email protected]");

                ds.Tables[0].Rows.Add( null, null, ds.Tables[0].Compute("Sum(pay_value)", ""), "الاجمالى");
                ds.Tables[1].Rows.Add( null, null, ds.Tables[1].Compute("Sum(pay_value)", ""), "الاجمالى");

                Income_DG.ItemsSource = ds.Tables[0].DefaultView;

                Outcome_DG.ItemsSource = ds.Tables[1].DefaultView;
            
            }
            catch
            {


            }
        }
开发者ID:Enumeg,项目名称:POS-General,代码行数:27,代码来源:Loans.xaml.cs

示例2: Fill_Products_LB

        private void Fill_Products_LB()
        {

            try
            {
                int i = 2;
                string query = @"select products.*,cat_name, 0 pro_amount,0 pro_status from products
                                 join categories on pro_cat_id= cat_id                                
                                 join products_properties p1 on psp_pro_id=pro_id";
                DB db2 = new DB();

                db2.AddCondition("pro_name", Product_TB.Text, false, " like ");
                db2.AddCondition("pro_Serial", Serial_TB.Text, false, " like ");
                db2.AddCondition("pro_cat_id", Categories_CB.SelectedValue, Categories_CB.SelectedIndex < 1);
                foreach(ComboBox cb in Properties_WP.Children.OfType<ComboBox>().Where(c => c is ComboBox && c.SelectedIndex > 0))
                {
                    db2.AddCondition("p" + i + ".psp_value", cb.SelectedValue, cb.SelectedIndex < 1, "=", "psp_value_" + i);
                    db2.AddCondition("p" + i + ".psp_prp_id", cb.Name.Split('_')[1], cb.SelectedIndex < 1, "=", "psp_prp_id" + i);
                    query += " join products_properties p" + i + " on p1.psp_pro_id = p" + i + ".psp_pro_id ";
                    i++;
                }

                Stock_DG.ItemsSource = db2.SelectTableView(query + "group by pro_id");
                Get_Stock();
            }
            catch
            {

            }

        }
开发者ID:Enumeg,项目名称:POS-General,代码行数:31,代码来源:Points.xaml.cs

示例3: Fill_Employees_LB

        private void Fill_Employees_LB()
        {

            try
            {
                DB db2 = new DB("employees");

                // search by name
                db2.AddCondition("per_name", "%" + Name_Search_TB.Text + "%", false, " like ");

                // search by mobile
                db2.AddCondition("per_phone", "%" + Mobile_Search_TB.Text + "%", false, " like ");

                // search by Job
                db2.AddCondition("emp_job_id", Job_Search_CB.SelectedValue, Job_Search_CB.SelectedIndex < 1, "=", "emp_job_id");



                db2.Fill(LB, "emp_id", "per_name", @"select * from employees e join persons p on p.per_id=e.emp_per_id join jobs j on j.job_id=e.emp_job_id");

            }
            catch
            {

            }

        }
开发者ID:Enumeg,项目名称:POS-General,代码行数:27,代码来源:Employees.xaml.cs

示例4: Fill_Customers_LB

        private void Fill_Customers_LB()
        {

            try
            {
                DB db2 = new DB();

                // search by name
                db2.AddCondition("per_name", "%" + Name_Search_TB.Text + "%", false, " like ");

                // search by mobile
                db2.AddCondition("per_mobile", "%" + Mobile_Search_TB.Text + "%", false, " like ");
                if(Table == "customers")
                {
                    db2.Fill(LB, "cus_id", "per_name", @"select * from customers sup join persons per on sup.cus_per_id=per.per_id");
                }
                else
                {
                    db2.Fill(LB, "sup_id", "per_name", @"select *,sup_balance cus_balance from suppliers sup join persons per on sup.sup_per_id=per.per_id");
                }
            }
            catch
            {

            }

        }
开发者ID:Enumeg,项目名称:POS-General,代码行数:27,代码来源:Customers.xaml.cs

示例5: Fill_Properties_LB

        private void Fill_Properties_LB()
        {
            try
            {
                DB db = new DB("Properties");
                db.AddCondition("prp_name", Property_TB.Text.Trim(), false, " like ");
                db.AddCondition("prp_cat_id", Categories_CB.SelectedValue, Categories_CB.SelectedIndex < 1);
                db.SelectedColumns.Add("*");
                db.Fill(LB, "prp_id", "prp_name");
            }
            catch
            {

            }
        }
开发者ID:Enumeg,项目名称:POS-General,代码行数:15,代码来源:Properties.xaml.cs

示例6: Fill_Point_LB

        private void Fill_Point_LB()
        {
            try
            {
                DB db = new DB("points");
                db.AddCondition("pon_name", Point_TB.Text.Trim(), false, " like ");
                db.AddCondition("pon_type", Type_CB.SelectedIndex - 1, Type_CB.SelectedIndex < 1);
                db.SelectedColumns.Add("*");
                db.Fill(Points_LB, "pon_id", "pon_name");
            }
            catch
            {

            }
        }
开发者ID:Enumeg,项目名称:POS-General,代码行数:15,代码来源:Points.xaml.cs

示例7: Add_Update

        private bool Add_Update()
        {
            try
            {

                DB DataBase = new DB("groups");

                DataBase.AddColumn("grp_name", Type_TB.Text);

                if(Group_Id == null)
                {
                    if(DataBase.IsNotExist("grp_id", "grp_name"))
                    {
                        return Confirm.Check(DataBase.Insert());
                    }
                    else
                    {
                        Message.Show("لقد تم تسجيل هذا النوع من قبل", MessageBoxButton.OK, 5);
                        return false;
                    }


                }
                else
                {
                    DataBase.AddCondition("grp_id", this.Group_Id);
                    return Confirm.Check(DataBase.Update());
                }
            }
            catch
            {
                //MessageBox.Show("kiki_method");
                return false;
            }
        }
开发者ID:Enumeg,项目名称:POS-General,代码行数:35,代码来源:Groups.xaml.cs

示例8: Add_Update

        private bool Add_Update()
        {
            try
            {

                DB DataBase = new DB("Categories");

                DataBase.AddColumn("cat_name", Category_TB.Text.Trim());

                if(Category_Id == null)
                {
                    if(DataBase.IsNotExist("cat_id", "cat_name"))
                    {
                        return Confirm.Check(DataBase.Insert());
                    }
                    else
                    {
                        Message.Show("لقد تم تسجيل هذه الفئة من قبل", MessageBoxButton.OK, 5);
                        return false;
                    }


                }
                else
                {
                    DataBase.AddCondition("cat_id", this.Category_Id);
                    return Confirm.Check(DataBase.Update());
                }
            }
            catch
            {
                //MessageBox.Show("kiki_method");
                return false;
            }
        }
开发者ID:Enumeg,项目名称:POS-General,代码行数:35,代码来源:Categories.xaml.cs

示例9: Add_Update

        private bool Add_Update()
        {
            try
            {
                DB db = new DB("products");

                db.AddColumn("pro_cat_id", Categories_CB.SelectedValue);
                db.AddColumn("pro_name", Product_TB.Text.Trim());
                db.AddColumn("pro_sell", Sell_Price_TB.Text.Trim());


                if(Product_Id == null)
                {
                    if(db.IsNotExist("pro_id", "pro_name", "pro_cat_id"))
                    {
                        return db.Insert();
                    }
                    else
                    {
                        Message.Show("هذا المنتج مسجل من قبل", MessageBoxButton.OK, 5);
                        return false;
                    }
                }
                else
                {                 
                    db.AddCondition("pro_Id", this.Product_Id);
                    return db.Update();
                }

            }
            catch
            {
                return false;
            }
        }
开发者ID:Enumeg,项目名称:POS-General,代码行数:35,代码来源:Product.xaml.cs

示例10: Get_Outcome

        private void Get_Outcome()
        {
            try
            {
                    DB db2 = new DB("outcome");

                    db2.SelectedColumns.Add("*");

                    db2.AddCondition("out_id", Outcome_Id);

                    DataRow DR = db2.SelectRow();

                    Date_TB.Value = DateTime.Parse(DR["out_date"].ToString());
                    Type_CB.SelectedValue = DR["out_ott_id"];
                    Value_TB.Text = DR["out_value"].ToString();
                    Description_TB.Text = DR["out_description"].ToString();

                    Point_ID = DR["out_pon_id"];



            }
            catch
            {
                
               
            }
        }
开发者ID:Enumeg,项目名称:POS-General,代码行数:28,代码来源:Outcome.xaml.cs

示例11: Get_Attendence_Info

        private void Get_Attendence_Info()
        {
            try
            {
                DB db2 = new DB("Attendence");

                db2.SelectedColumns.Add("*");

                db2.AddCondition("Att_id", Attendence_Id);

                DataRow DR = db2.SelectRow();

                Employees_CB.SelectedValue = DR["att_emp_id"];

                Date_DTP.Value = DateTime.Parse(DR["att_date"].ToString());

                Attend_DTP.Value = new DateTime(TimeSpan.Parse(DR["att_attend"].ToString()).Ticks);

                Leave_DTP.Value = DR["att_leave"].ToString() != "" ? new DateTime(TimeSpan.Parse(DR["att_leave"].ToString()).Ticks) : Leave_DTP.Value;

            }
            catch
            {


            }
        }
开发者ID:Enumeg,项目名称:POS-General,代码行数:27,代码来源:Add_Update_Attendence.xaml.cs

示例12: Fill_Products_LB

        private void Fill_Products_LB()
        {

            try
            {                              
                DB db = new DB();

                db.AddCondition("pro_name", Product_TB.Text, false, " like ");
                db.AddCondition("pro_cat_id", Categories_CB.SelectedValue, Categories_CB.SelectedIndex < 1);
                Products_DG.ItemsSource = db.SelectTableView( @"select products.*,cat_name from products join categories on pro_cat_id= cat_id");
            }
            catch
            {

            }

        }
开发者ID:Enumeg,项目名称:POS-General,代码行数:17,代码来源:Products.xaml.cs

示例13: Fill_Products_LB

        private void Fill_Products_LB()
        {
            try
            {
                int i = 2;               
                DB db2 = new DB();

                db2.AddCondition("pro_name", Product_TB.Text, false, " like ");
                db2.AddCondition("pro_cat_id", Categories_CB.SelectedValue, Categories_CB.SelectedIndex < 1);

                db2.Fill(Products_LB, "pro_id", "pro_name", "select pro_id,pro_name from products");
            }
            catch
            {

            }

        }
开发者ID:Enumeg,项目名称:POS-General,代码行数:18,代码来源:Products_Search.xaml.cs

示例14: Fill_Outcome

        private void Fill_Outcome()
        {

            try
            {                
                DB db2 = new DB();
                db2.AddCondition("out_date", From_DTP.Value.Value.Date, false, ">=", "SD");
                db2.AddCondition("out_date", To_DTP.Value.Value.Date, false, "<=", "ED");
                DataTable dt = db2.SelectTable(@"select * from outcome o join outcome_types ot on o.out_ott_id=ot.ott_id where out_date>[email protected] and out_date<[email protected]");
                dt.Rows.Add(null, null,  dt.Compute("Sum(out_value)", ""), "الاجمالى");

                Outcome_DG.ItemsSource = dt.DefaultView;

            }
            catch
            {

            }
        }
开发者ID:Enumeg,项目名称:POS-General,代码行数:19,代码来源:Outcome_Page.xaml.cs

示例15: Check_Login

        private void Check_Login()
        {
            try
            {
                //select the user information giving the username 
                DB db = new DB("users");
                db.AddCondition("user_name", User_name_TB.Text.Trim());
                DataRow User = db.SelectRow("select * from users");

                //check if user is exist
                if(User != null)
                {
                    //check if password hashcode match
                    if(Password_TB.Password.GetHashCode().ToString() == User["user_pass"].ToString())
                    {
                        //set global variables
                        App.User_Id = User["User_Id"];
                        App.Group_ID = User["user_grp_id"];
                        //start application
                        Window m = new Window();
                        //check privileges
                        switch(int.Parse(User["user_grp_id"].ToString()))
                        {
                            case 1:
                                m = new Managent();
                                break;
                            case 2:
                                m = new Cashier_Window();
                                break;
                            case 3:
                                m = new Managent();
                                break;
                        }
                        //hide Login window and show the selected window
                        this.Hide();
                        m.ShowDialog();
                        //close application on windwos close
                        Application.Current.Shutdown();

                    }
                    else
                    {
                        Message.Show("كلمة المرور غير صحيحة", MessageBoxButton.OK, 10);
                    }
                }
                else
                {
                    Message.Show("إسم المستخدم غير صحيح", MessageBoxButton.OK, 10);
                }
            }
            catch
            {

            }
        }
开发者ID:Enumeg,项目名称:POS-General,代码行数:55,代码来源:Login.xaml.cs


注:本文中的DB.AddCondition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。