Exemple #1
0
        public SeachphieuMKT(Viewtable Fromviewable, string tablename, string valuesave)
        {
            // tkhead  là tìm theo head - - tk là tìm theo detai
            InitializeComponent();
            this.Fromviewable = Fromviewable;

            this.tablename = tablename;
            this.valuesave = valuesave;

            List <View.MKTselectStoreandRegion.ComboboxItem> CombomCollection2 = new List <View.MKTselectStoreandRegion.ComboboxItem>();

            string connection_string = Utils.getConnectionstr();

            LinqtoSQLDataContext dc = new LinqtoSQLDataContext(connection_string);

            this.dc = dc;
            ///
            //       string username = Utils.getusername();
            //     string rightkho = Model.Username.getmaquyenkho();

            View.MKTselectStoreandRegion.ComboboxItem cb1 = new View.MKTselectStoreandRegion.ComboboxItem();
            cb1.Value = "";
            cb1.Text  = "All Regions";// + "    || Example: " + item2.Example;
            CombomCollection2.Add(cb1);

            var rs3 = from pp in dc.tbl_MKT_Regions
                      //  where pp.Region == rightkho
                      select pp;

            foreach (var item2 in rs3)


            {
                View.MKTselectStoreandRegion.ComboboxItem cb = new View.MKTselectStoreandRegion.ComboboxItem();
                cb.Value = item2.Region.Trim();
                cb.Text  = item2.Region.Trim() + ": " + item2.Note.Trim().ToUpper();// + "    || Example: " + item2.Example;
                CombomCollection2.Add(cb);
            }

            cbselect2.DataSource        = CombomCollection2;
            cbstatusphieu.SelectedIndex = 0;
            //    this.ststusphieu = cbstatusphieu.SelectedValue.ToString();

            this.region      = "";// (cbselect2.SelectedItem as View.MKTselectStoreandRegion.ComboboxItem).Value.ToString();
            this.statusphieu = "";
        }
        public MKTFromdatetodateRegion()
        {
            InitializeComponent();

            List <View.MKTselectStoreandRegion.ComboboxItem> CombomCollection2 = new List <View.MKTselectStoreandRegion.ComboboxItem>();

            string connection_string = Utils.getConnectionstr();

            LinqtoSQLDataContext dc = new LinqtoSQLDataContext(connection_string);

            ///
            //       string username = Utils.getusername();
            //     string rightkho = Model.Username.getmaquyenkho();


            var rs3 = from pp in dc.tbl_MKT_Regions
                      //  where pp.Region == rightkho
                      select pp;

            foreach (var item2 in rs3)


            {
                View.MKTselectStoreandRegion.ComboboxItem cb = new View.MKTselectStoreandRegion.ComboboxItem();
                cb.Value = item2.Region.Trim();
                cb.Text  = item2.Region.Trim() + ": " + item2.Note.Trim().ToUpper();// + "    || Example: " + item2.Example;
                CombomCollection2.Add(cb);
            }

            cbselect2.DataSource = CombomCollection2;



            fromdatepicker.Value        = DateTime.Today;
            todatepicker.Value          = DateTime.Today;
            this.fromdate               = fromdatepicker.Value;
            this.todate                 = todatepicker.Value;
            cbstatusphieu.SelectedIndex = 0;
            //    this.ststusphieu = cbstatusphieu.SelectedValue.ToString();

            this.region = "";// (cbselect2.SelectedItem as View.MKTselectStoreandRegion.ComboboxItem).Value.ToString();
            chon        = false;
        }