Example #1
0
    //this method updates the event start and end time
    public static void updateEventTime(int id, DateTime start, DateTime end)
    {
        //SqlConnection con = new SqlConnection(connectionString);
        //SqlCommand cmd = new SqlCommand("UPDATE event SET event_start=@event_start, event_end=@event_end WHERE event_id=@event_id", con);
        //cmd.Parameters.AddWithValue("@event_start", start);
        //cmd.Parameters.AddWithValue("@event_end", end);
        //cmd.Parameters.AddWithValue("@event_id", id);
        //using (con)
        //{
        //    con.Open();
        //    cmd.ExecuteNonQuery();
        //}

        DAL.DAL _dal = new DAL.DAL(dbchain, DAL.DAL.Moteurs.SQLSERVER.ToString());
        if (_dal.IsConnexionFermee())
        {
            //Ouverture de la connection
            _dal.OuvrirConnexion();
        }

        string[] _param = new string[2];
        _param[0] = "@ID" + ";" + SqlDbType.Int + ";" + id.ToString();
        _param[3] = "@START" + ";" + SqlDbType.DateTime + ";" + end.ToString();
        _param[5] = "@END" + ";" + SqlDbType.DateTime + ";" + end.ToString();

        _dal.ExecuteQueryNoResult("UpdateCRAEventTime", CommandType.StoredProcedure, _param);
    }
        public void DeleteItem()
        {
            ExceptionCatcher.ExceptionFinder(() => {
                using (SDB sdb = new SDB())
                {
                    var customer = new Musteri {
                        MusteriID = musteri.MusteriID
                    };
                    DAL.DAL dal             = new DAL.DAL();
                    MessageBoxResult result = DXMessageBox.Show("Çalışan Silinecek Onaylıyor Musunuz?", "Uyarı", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes, MessageBoxOptions.None);
                    switch (result)
                    {
                    case MessageBoxResult.Yes:
                        dal.DeleteRecordMus(customer);
                        MessageBox.Show("Ürün Silindi!");
                        gridControl_customerList.ItemsSource = null;
                        GetMusteriList();
                        break;

                    case MessageBoxResult.No:
                        break;
                    }
                }
            });
        }
Example #3
0
        public void PopulatePlots()
        {
            DAL.DAL db = new DAL.DAL();
            dgUnscheduledPlots.DataSource = plotBindingSource1;

            plotBindingSource1.DataSource = db.GetUnsheduledPlots();
        }
        public void DeleteItem()
        {
            ExceptionCatcher.ExceptionFinder(() => {
                using (SDB sdb = new SDB())
                {
                    var urun = new Urun {
                        UrunID = Urunentity.UrunID
                    };
                    DAL.DAL dal             = new DAL.DAL();
                    MessageBoxResult result = DXMessageBox.Show("Ürünü Silinecek Onaylıyor Musunuz?", "Uyarı", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes, MessageBoxOptions.None);
                    switch (result)
                    {
                    case MessageBoxResult.Yes:
                        dal.DeleteRecord(urun);
                        MessageBox.Show("Ürün Silindi!");
                        GridControl_ProductList.ItemsSource = null;
                        GetUrunList();
                        break;

                    case MessageBoxResult.No:
                        break;
                    }
                }
            });
        }
Example #5
0
        static void Main(string[] args)
        {
            Employee emp           = new Employee();;
            string   strConnString = @"Data Source=Macintosh HD Users\scothaynes\Projects\Company.sqlite; Version=3";

            DAL.DAL dal = new DAL.DAL(strConnString);

            #region "Test database Functionalities"

            //TestSelectCommand(emp, dal);
            //TestInsertCommand(emp, dal);
            //TestUpdateCommand(emp, dal);
            //TestDeleteCommand(emp, dal);
            //TestXMLSerialization();

            #endregion

            #region Test HTTP Methods
            //GenerateGetRequest();
            //GeneratePOSTRequest();
            //GeneratePUTRequest();
            GenerateDELETERequest();
            #endregion

            Console.ReadLine();
        }
Example #6
0
        public void DeleteItem()
        {
            ExceptionCatcher.ExceptionFinder(() => {
                using (SDB sdb = new SDB())
                {
                    var personel = new Personel {
                        PersonelID = personelEntity.PersonelID
                    };
                    DAL.DAL dal             = new DAL.DAL();
                    MessageBoxResult result = DXMessageBox.Show("Çalışan Silinecek Onaylıyor Musunuz?", "Uyarı", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes, MessageBoxOptions.None);
                    switch (result)
                    {
                    case MessageBoxResult.Yes:
                        dal.DeleteRecordPer(personel);
                        MessageBox.Show("Personel Silindi!");
                        gridcontrol_personel.ItemsSource = null;
                        GetPersonelList();
                        break;

                    case MessageBoxResult.No:
                        break;
                    }
                }
            });
        }
Example #7
0
        static void Main(string[] args)
        {
            Employee emp           = new Employee();;
            string   strConnString = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\robgallagher\source\repos\RestWebService\EmployeeDataBase\Company.mdf;Integrated Security=True";

            DAL.DAL dal = new DAL.DAL(strConnString);

            #region "Test database Functionalities"

            //TestSelectCommand(emp, dal);
            //TestInsertCommand(emp, dal);
            //TestUpdateCommand(emp, dal);
            //TestDeleteCommand(emp, dal);
            //TestXMLSerialization();

            #endregion

            #region Test HTTP Methods
            //GenerateGetRequest();
            //GeneratePOSTRequest();
            //GeneratePUTRequest();
            GenerateDELETERequest();
            #endregion

            Console.ReadLine();
        }
        public List <string> dajVoznjeKrozStanicu(long sifraStanice)
        {
            DAL.DAL d = DAL.DAL.Instanca;
            d.kreirajKonekciju();
            List <string> spisak = new List <string>();
            List <DAL.Entiteti.Linija> linije = d.getDAO.getLinijaDAO().GetAll();

            foreach (DAL.Entiteti.Linija linija in linije)
            {
                bool nasao    = false;
                int  pozicija = 0;
                for (int i = 0; i < linija.Stanice.Count; i++)
                {
                    if (linija.Stanice[i].SifraStanice == sifraStanice)
                    {
                        nasao    = true;
                        pozicija = i;
                    }
                }
                if (nasao)
                {
                    List <DAL.Entiteti.Voznja> voznje = linija.Voznje;
                    foreach (DAL.Entiteti.Voznja voznja in voznje)
                    {
                        string naziv = String.Format("{0}, {1}", linija.NazivLinije, voznja.VrijemePolaska.AddMinutes((double)linija.TrajanjeDoPolaska[pozicija]).ToString("dd.MM.yy, HH:mm:ss"));
                        spisak.Add(naziv);
                    }
                }
            }
            return(spisak);
        }
Example #9
0
        public void AcceptedBasket()
        {
            ExceptionCatcher.ExceptionFinder(() => {
                if (combobox_musteri.SelectedItem == null)
                {
                    MessageBox.Show("Müşteri Seçiniz!");
                }
                else
                {
                    using (SDB sdb = new SDB())
                    {
                        for (int i = 0; i < SepetHelper.Sepet.Count; i++)
                        {
                            Sati sati        = new Sati();
                            sati.SatisUrunID = SepetHelper.Sepet[i].UrunID;
                            sati.SatisTarih  = DateTime.Now;
                            sati.SatisAdet   = SepetHelper.Sepet[i].urunAdet;
                            sati.SatisFiyat  = Convert.ToDecimal(SepetHelper.Sepet[i].urunToplamFiyat);
                            sati.SatisPerID  = AuthenticateHelperr.LoginUser[0].PersonelID;
                            sati.SatisMusID  = Convert.ToInt32(combobox_musteri.EditValue);

                            DAL.DAL dal = new DAL.DAL();
                            dal.SatisRapor(sati);
                        }
                        MainWindow window = (MainWindow)Window.GetWindow(this);
                        MessageBox.Show("Satış Yapıldı");
                        window.TabControlMain.SelectedContainer.Close();
                        window.AcceptBasket.IsEnabled = false;
                        window.CancelBasket.IsEnabled = false;
                        SepetHelper.Sepet             = null;
                    }
                }
            });
        }
Example #10
0
    //this method updates the event title and description
    public static void updateEvent(int id, String title, String description)
    {
        /*SqlConnection con = new SqlConnection(connectionString);
         * SqlCommand cmd = new SqlCommand("UPDATE event SET title=@title, description=@description WHERE event_id=@event_id", con);
         * cmd.Parameters.AddWithValue("@title", title);
         * cmd.Parameters.AddWithValue("@description", description);
         * cmd.Parameters.AddWithValue("@event_id", id);
         */
        DAL.DAL _dal = new DAL.DAL(dbchain, DAL.DAL.Moteurs.SQLSERVER.ToString());
        if (_dal.IsConnexionFermee())
        {
            //Ouverture de la connection
            _dal.OuvrirConnexion();
        }

        string[] _param = new string[3];
        _param[0] = "@ID" + ";" + SqlDbType.Int + ";" + id.ToString();
        _param[1] = "@RESSOURCE" + ";" + SqlDbType.Int + ";" + title.ToString();
        _param[2] = "@JOURINFO" + ";" + SqlDbType.Int + ";" + description.ToString();

        _dal.ExecuteQueryNoResult("UpdateCRAEvent", CommandType.StoredProcedure, _param);

        /* using (con)
         * {
         *   con.Open();
         *   cmd.ExecuteNonQuery();
         * }
         */
    }
Example #11
0
        static void Main(string[] args)
        {
            Employee emp           = new Employee();;
            string   strConnString = @"Data Source=SYNPUNEHCRV-105\SQLEXPRESS;Initial Catalog=Company;Integrated Security=True";

            DAL.DAL dal = new DAL.DAL(strConnString);

            #region "Test database Functionalities"

            //TestSelectCommand(emp, dal);
            //TestInsertCommand(emp, dal);
            //TestUpdateCommand(emp, dal);
            //TestDeleteCommand(emp, dal);
            //TestXMLSerialization();

            #endregion

            #region Test HTTP Methods
            //GenerateGetRequest();
            //GeneratePOSTRequest();
            //GeneratePUTRequest();
            GenerateDELETERequest();
            #endregion

            Console.ReadLine();
        }
Example #12
0
 private void SatisRaporList()
 {
     ExceptionCatcher.ExceptionFinder(() => {
         DAL.DAL dal = new DAL.DAL();
         List <SatisEntity> raporList   = dal.SatisRaporList();
         gridcontrol_report.ItemsSource = raporList;
     });
 }
Example #13
0
 private void GetPersonelList()
 {
     ExceptionCatcher.ExceptionFinder(() => {
         DAL.DAL dal = new DAL.DAL();
         List <PersonelEntity> list       = dal.GetPersoneList();
         gridcontrol_personel.ItemsSource = list;
     });
 }
 private void GetUrunList()
 {
     ExceptionCatcher.ExceptionFinder(() => {
         DAL.DAL dal = new DAL.DAL();
         List <UrunKategoriEntity> list      = dal.GetUrunList();
         GridControl_ProductList.ItemsSource = list;
     });
 }
 private void GetMusteriList()
 {
     ExceptionCatcher.ExceptionFinder(() => {
         DAL.DAL dal         = new DAL.DAL();
         List <Musteri> list = dal.GetMusteriList();
         gridControl_customerList.ItemsSource = list;
     });
 }
 private VendorSerializable TranslateVendor(DAL.Vendor oldVendor)
 {
     return new VendorSerializable()
     {
         Id = oldVendor.Id,
         Name = oldVendor.Name
     };
 }
 public double dajCijenuJedneKarte(long sifraLinije, long sifraPocetneStanice, long sifraKrajnjeStanice)
 {
     DAL.DAL d = DAL.DAL.Instanca;
     d.kreirajKonekciju();
     DAL.Entiteti.Linija  odabranaLinija = d.getDAO.getLinijaDAO().getById(sifraLinije);
     DAL.Entiteti.Stanica prvaStanica    = d.getDAO.getStaniceDAO().getById(sifraPocetneStanice);
     DAL.Entiteti.Stanica drugaStanica   = d.getDAO.getStaniceDAO().getById(sifraKrajnjeStanice);
     return(odabranaLinija.vratiCijenu(prvaStanica, drugaStanica));
 }
 public string dajNajjeftinijiPut(long sifraPocetneStanice, long sifraKrajnjeStanice)
 {
     DAL.DAL d = DAL.DAL.Instanca;
     d.kreirajKonekciju();
     DAL.Entiteti.Stanica           pocetnaStanica = d.getDAO.getStaniceDAO().getById(sifraPocetneStanice);
     DAL.Entiteti.Stanica           krajnjaStanica = d.getDAO.getStaniceDAO().getById(sifraKrajnjeStanice);
     DesktopAplikacija.Entiteti.Put put            = DesktopAplikacija.Informisanje.InformisanjeKomande.vratiNajjeftinijiPut(pocetnaStanica, krajnjaStanica);
     return(put.ToString().Replace("\n", "; "));
 }
Example #19
0
 private static void TestUpdateCommand(Employee emp, DAL.DAL dal)
 {
     Console.WriteLine("Testing Update Command");
     emp             = new Employee();
     emp.FirstName   = "Anne";
     emp.LastName    = "Brown";
     emp.EmpCode     = 1110;
     emp.Designation = "HR";
     dal.UpdateEmployee(emp);
     PrintEmployeeInformation(emp);
 }
 public bool ispravanRasporedStanica(long sifraLinije, long sifraPocetneStanice, long sifraKrajnjeStanice)
 {
     DAL.DAL d = DAL.DAL.Instanca;
     d.kreirajKonekciju();
     DAL.Entiteti.Linija linija = d.getDAO.getLinijaDAO().getById(sifraLinije);
     if (dajIndexStanice(sifraPocetneStanice, linija) == -1 || dajIndexStanice(sifraKrajnjeStanice, linija) == -1)
     {
         return(false);
     }
     return(dajIndexStanice(sifraPocetneStanice, linija) < dajIndexStanice(sifraKrajnjeStanice, linija));
 }
Example #21
0
 private entity.Contact FromDataBase(database.Contact contact)
 {
     return new entity.Contact
     {
         Id = contact.Id,
         FirstName = contact.FirstName,
         LastName = contact.LastName,
         Email = contact.Email,
         LuckyNumber = contact.LuckyNumber
     };
 }
Example #22
0
 /// <summary>
 /// Fügt eine neue Konfiguration hinzu
 /// </summary>
 /// <param name="_configuration"></param>
 /// <returns>false wenn der Konfigurationsname schon existiert</returns>
 public static Boolean AddConfiguration(DAL.DALObjects.cObjConfiguration _configuration)
 {
     if (!_configStack.ContainsKey(_configuration.ConnectionName))
     {
         _configStack.Add(_configuration.ConnectionName, _configuration);
         return true;
     }
     else
     {
         return false;
     }
 }
        public List <long> dajLinije()
        {
            DAL.DAL d = DAL.DAL.Instanca;
            d.kreirajKonekciju();
            List <long> spisak = new List <long>();
            List <DAL.Entiteti.Linija> linije = d.getDAO.getLinijaDAO().GetAll();

            foreach (DAL.Entiteti.Linija linija in linije)
            {
                spisak.Add(linija.SifraLinije);
            }
            return(spisak);
        }
        public List <long> dajStaniceULiniji(long sifraLinije)
        {
            DAL.DAL d = DAL.DAL.Instanca;
            d.kreirajKonekciju();
            List <long> spisak = new List <long>();

            DAL.Entiteti.Linija linija = d.getDAO.getLinijaDAO().getById(sifraLinije);
            foreach (DAL.Entiteti.Stanica stanica in linija.Stanice)
            {
                spisak.Add(stanica.SifraStanice);
            }
            return(spisak);
        }
 public string dajImeLinije(long sifraLinije)
 {
     DAL.DAL d = DAL.DAL.Instanca;
     d.kreirajKonekciju();
     try
     {
         return(d.getDAO.getLinijaDAO().getById(sifraLinije).NazivLinije);
     }
     catch (Exception ex)
     {
         return("__GRESHKA__");
     }
 }
        public List <long> dajStanice()
        {
            DAL.DAL d = DAL.DAL.Instanca;
            d.kreirajKonekciju();
            List <long> spisak = new List <long>();
            List <DAL.Entiteti.Stanica> stanice = d.getDAO.getStaniceDAO().GetAll();

            foreach (DAL.Entiteti.Stanica stanica in stanice)
            {
                spisak.Add(stanica.SifraStanice);
            }
            return(spisak);
        }
        public List <long> dajVoznje(long sifraLinije)
        {
            DAL.DAL d = DAL.DAL.Instanca;
            d.kreirajKonekciju();
            List <long> spisak = new List <long>();

            DAL.Entiteti.Linija linija = d.getDAO.getLinijaDAO().getById(sifraLinije);
            foreach (DAL.Entiteti.Voznja voznja in linija.Voznje)
            {
                spisak.Add(voznja.SifraVoznje);
            }
            return(spisak);
        }
 public string dajImeStanice(long sifraStanice)
 {
     DAL.DAL d = DAL.DAL.Instanca;
     d.kreirajKonekciju();
     try
     {
         return(d.getDAO.getStaniceDAO().getById(sifraStanice).ToString());
     }
     catch (Exception ex)
     {
         return("__GRESHKA__");
     }
 }
Example #29
0
        private static void TestInsertCommand(Employee emp, DAL.DAL dal)
        {
            Console.WriteLine("Testing Insert Command");
            emp             = new Employee();
            emp.FirstName   = "Eva";
            emp.LastName    = "Brown";
            emp.EmpCode     = 1110;
            emp.Designation = "Architect";
            dal.AddEmployee(emp);
            Employee newEmp = new Employee();

            newEmp = dal.GetEmployee(1110);
            PrintEmployeeInformation(newEmp);
        }
        public List <bool> dajSlobodnaSjedista(long sifraLinije, long sifraVoznje, long sifraPocetneStanice, long sifraKrajnjeStanice)
        {
            DAL.DAL d = DAL.DAL.Instanca;
            d.kreirajKonekciju();
            List <bool> sjedista = new List <bool>();

            DAL.Entiteti.Linija linija = d.getDAO.getLinijaDAO().getById(sifraLinije);
            long brojSjedista          = d.getDAO.getVoznjaDAO().getById(sifraVoznje).Autobus.BrojSjedista;

            for (int i = 0; i < brojSjedista; i++)
            {
                sjedista.Add(true);
            }
            List <DAL.Entiteti.KupacKarte>      kupciKarti          = new List <DAL.Entiteti.KupacKarte>();
            List <DAL.Entiteti.KupacSaPopustom> kupciKartiSPopustom = new List <DAL.Entiteti.KupacSaPopustom>();

            kupciKarti          = d.getDAO.getKupacKarteDAO().GetAll();
            kupciKartiSPopustom = d.getDAO.getKupacKarteSPopustomDAO().GetAll();
            foreach (DAL.Entiteti.KupacKarte kupac in kupciKarti)
            {
                if (kupac.Voznja.SifraVoznje == sifraVoznje)
                {
                    if (dajIndexStanice(kupac.PocetnaStanica.SifraStanice, linija) < dajIndexStanice(sifraKrajnjeStanice, linija)
                        &&
                        dajIndexStanice(kupac.KrajnjaStanica.SifraStanice, linija) > dajIndexStanice(sifraPocetneStanice, linija))
                    {
                        foreach (int mjesto in kupac.Sjedista)
                        {
                            sjedista[mjesto - 1] = false;
                        }
                    }
                }
            }
            foreach (DAL.Entiteti.KupacSaPopustom kupac in kupciKartiSPopustom)
            {
                if (kupac.Voznja.SifraVoznje == sifraVoznje)
                {
                    if (dajIndexStanice(kupac.PocetnaStanica.SifraStanice, linija) < dajIndexStanice(sifraKrajnjeStanice, linija)
                        &&
                        dajIndexStanice(kupac.KrajnjaStanica.SifraStanice, linija) > dajIndexStanice(sifraPocetneStanice, linija))
                    {
                        foreach (int mjesto in kupac.Sjedista)
                        {
                            sjedista[mjesto - 1] = false;
                        }
                    }
                }
            }
            return(sjedista);
        }
 private AutomobileSerializable TranslateAutomobile(DAL.Automobile oldAutomobile)
 {
     return new AutomobileSerializable()
     {
         id = oldAutomobile.id,
         model = oldAutomobile.model,
         acceleration = Convert.ToDecimal(oldAutomobile.acceleration),
         enginePower = Convert.ToInt32(oldAutomobile.enginePower),
         fuelEconomy = Convert.ToDecimal(oldAutomobile.fuelEconomy),
         maxSpeed = Convert.ToInt32(oldAutomobile.maxSpeed),
         price = Convert.ToDecimal(oldAutomobile.price),
         vendorId = oldAutomobile.vendorId
     };
 }
Example #32
0
        public void AddNewItem()
        {
            ExceptionCatcher.ExceptionFinder(() => {
                using (SDB sdbContext = new SDB())
                {
                    if (personelEntity == null)
                    {
                        Personel personel         = new Personel();
                        personel.PersonelAd       = personalName.Text;
                        personel.PersonelSoyad    = personelLastname.Text;
                        personel.PersonelRoleID   = chkboxAdmin.IsChecked.Value == true ? int.Parse(chkboxAdmin.Tag.ToString()) : chkboxUser.IsChecked.Value == true ? int.Parse(chkboxUser.Tag.ToString()) : int.Parse(chkboxUser2.Tag.ToString());
                        personel.PersonelUsername = personelUsername.Text;
                        personel.PersonelPassword = HashingHelper.HashingPassword(personelPassword.Text);

                        personel.PersonelPic = ImageHelper.ConvertImageToByte(Per_pic_url.Text);
                        DAL.DAL dal          = new DAL.DAL();
                        dal.NewRecordPer(personel);

                        gridPersonelForm.Visibility      = Visibility.Collapsed;
                        gridcontrol_personel.ItemsSource = null;
                        GetPersonelList();
                    }
                    else
                    {
                        Personel personel         = new Personel();
                        personel.PersonelID       = personelEntity.PersonelID;
                        personel.PersonelAd       = personalName.Text;
                        personel.PersonelSoyad    = personelLastname.Text;
                        personel.PersonelRoleID   = chkboxAdmin.IsChecked.Value == true ? int.Parse(chkboxAdmin.Tag.ToString()) : chkboxUser.IsChecked.Value == true ? int.Parse(chkboxUser.Tag.ToString()) : int.Parse(chkboxUser2.Tag.ToString());
                        personel.PersonelUsername = personelUsername.Text;
                        personel.PersonelPassword = HashingHelper.HashingPassword(personelPassword.Text);
                        if (personelEntity.PersonelPic != null)
                        {
                            personel.PersonelPic = personelEntity.PersonelPic;
                        }


                        DAL.DAL dal = new DAL.DAL();
                        dal.UpdateRecordPer(personel);
                        MainWindow window = (MainWindow)Window.GetWindow(this);
                        window.RibbonController();
                        gridPersonelForm.Visibility      = Visibility.Collapsed;
                        gridcontrol_personel.ItemsSource = null;
                        GetPersonelList();
                        ClearForm();
                    }
                }
            });
        }
Example #33
0
    //change the connection string as per your database connection.
    //private static string connectionString = "Data Source=PEUWUL24667\\MSSQLSERVER2008;Initial Catalog=NewRedSol;User ID=sa;Password=Pepsico2008" ;

    //this method retrieves all events within range start-end
    public static List <CalendarEvent> getEvents(DateTime start, DateTime end)
    {
        List <CalendarEvent> events = new List <CalendarEvent>();

        DAL.DAL _dal = new DAL.DAL(dbchain, DAL.DAL.Moteurs.SQLSERVER.ToString());
        if (_dal.IsConnexionFermee())
        {
            //Ouverture de la connection
            _dal.OuvrirConnexion();
        }

        string[] _param = new string[2];
        _param[0] = "@date_start" + ";" + SqlDbType.DateTime + ";" + start.ToString();
        _param[1] = "@date_end" + ";" + SqlDbType.DateTime + ";" + end.ToString();

        DataTable _tbl_loadevent = _dal.GetInformationInDataTable("LoadCRAEvent", CommandType.StoredProcedure, _param);

        _dal.FermeConnexion();

        //SqlConnection con = new SqlConnection(connectionString);
        //SqlCommand cmd = new SqlCommand("SELECT event_id, description, title, event_start, event_end FROM event where event_start>=@start AND event_end<=@end", con);
        //cmd.Parameters.AddWithValue("@start", start);
        //cmd.Parameters.AddWithValue("@end", end);

        //using (con)
        //{
        //    con.Open();
        //    SqlDataReader reader = cmd.ExecuteReader();
        //    while (reader.Read())
        //    {
        foreach (DataRow _row in _tbl_loadevent.Rows)
        {
            CalendarEvent cevent = new CalendarEvent();
            cevent.id        = (int)_row["id"];
            cevent.ressource = (int)_row["ressource"];
            cevent.jourinfo  = (int)_row["jourinfo"];
            cevent.start     = (DateTime)_row["event_start"];
            cevent.end       = (DateTime)_row["event_end"];
            events.Add(cevent);
        }
        //}
        return(events);
        //side note: if you want to show events only related to particular users,
        //if user id of that user is stored in session as Session["userid"]
        //the event table also contains a extra field named 'user_id' to mark the event for that particular user
        //then you can modify the SQL as:
        //SELECT event_id, description, title, event_start, event_end FROM event where user_id=@user_id AND event_start>=@start AND event_end<=@end
        //then add paramter as:cmd.Parameters.AddWithValue("@user_id", HttpContext.Current.Session["userid"]);
    }
        //SAVE İşlemini Yapıyor
        public void AddNewItem()
        {
            ExceptionCatcher.ExceptionFinder(() => {
                using (SDB sdbContext = new SDB())
                {
                    if (Urunentity == null)
                    {
                        Urun urun      = new Urun();
                        urun.UrunAd    = productName.Text;
                        urun.UrunFiyat = Convert.ToDecimal(productPrice.Text);
                        urun.UrunKod   = productCode.Text;
                        urun.UrunStok  = Convert.ToInt16(txtedit_productStok.Text);
                        urun.UrunKatID = ((Kategori)productCat_combobox.SelectedItem).KategoriID;
                        urun.UrunPic   = BL.ImageHelper.ConvertImageToByte(Pro_pic_url.Text);

                        pro_image.Source = new BitmapImage(new Uri(Pro_pic_url.Text));
                        DAL.DAL dal      = new DAL.DAL();
                        dal.NewRecord(urun);

                        FormContainer.Visibility            = Visibility.Collapsed;
                        GridControl_ProductList.ItemsSource = null;
                        GetUrunList();
                    }
                    else
                    {
                        Urun urun      = new Urun();
                        urun.UrunID    = Urunentity.UrunID;
                        urun.UrunAd    = productName.Text;
                        urun.UrunFiyat = Convert.ToDecimal(productPrice.Text);
                        urun.UrunKod   = productCode.Text;
                        urun.UrunStok  = Convert.ToInt16(txtedit_productStok.Text);
                        if (Urunentity.UrunPic != null)
                        {
                            urun.UrunPic = Urunentity.UrunPic;
                        }

                        urun.UrunKatID = ((Kategori)productCat_combobox.SelectedItem).KategoriID;
                        DAL.DAL dal    = new DAL.DAL();
                        dal.UpdateRecord(urun);
                        MainWindow window = (MainWindow)Window.GetWindow(this);
                        window.RibbonController();
                        FormContainer.Visibility            = Visibility.Collapsed;
                        GridControl_ProductList.ItemsSource = null;
                        GetUrunList();
                        ClearForm();
                    }
                }
            });
        }
        public void Act(DAL.IDataRepository DataRepo, dynamic ClassObject, int ActionType)
        {
            switch (ActionType)
            {

                case 1://Create
                    DataRepo.Create(ClassObject);
                    break;
                case 2://Update
                    DataRepo.Update(ClassObject);
                    break;
                case 3://Delete
                    DataRepo.Delete(ClassObject);
                    break;
                default:
                    break;
            }
        }
Example #36
0
        public object AddCommodityOption()
        {
            object model = new
            {
                ID = Guid.NewGuid().ToString("N"),
                CommodityID = "0a05c53871b84921987cf763e55463a9",
                Name = "精装版",
                Price = "199",
                Flag = 1,
                Remark = string.Empty
            };

            object modelNa = new
            {
                ID = Guid.NewGuid().ToString("N"),
                CommodityID = "0a05c53871b84921987cf763e55463a9",
                Name = "豪华版",
                Price = "299",
                Flag = 1,
                Remark = string.Empty
            };

            var dal = new WX_ShopCommodityOptionDAL();

            dal.Add(model);
            return dal.Add(modelNa);
        }
Example #37
0
 public static void RegistraIngreso(DAL.Ingreso ingreso)
 {
     DAL.Ingreso.registraIngreso(ingreso);
 }
        public ActionResult Update(DAL.BillCreditControlList model)
        {
            if (Session["Login"] != null)
            {
                LoginSession loginsession = (LoginSession)Session["Login"];
                ViewBag.CompanyLogo = loginsession.CompanyLogo;
                String actionName = this.ControllerContext.RouteData.Values["action"].ToString();
                String controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                ViewBag.Menu = BAL.Common.GetActiveMenu(controllerName, BAL.Common.LayoutType(loginsession.UserType));

                if (ModelState.IsValid)
                {
                    try
                    {

                        model.ModifyBY = loginsession.UserID;
                        if (BAL.BillCreditControlModel.UpdateCreditControl(model))
                        {
                            return RedirectToAction("Index", "BillCredit");
                        }
                        else
                        {
                            return Content("Unable to save , try again");
                        }
                    }
                    catch (Exception ex)
                    {
                        return Content("ErrorMessage" + ":" + ex.StackTrace.ToString());
                    }
                }
                else
                { return RedirectToAction("Index", "Energy"); }
            }
            else
            { return RedirectToAction("Index", "Home"); }
        }
Example #39
0
        private void ConfigureAndTriggerSchedule(DAL.Schedule currentSchedule)
        {
            Boolean CoreWorkingOK = true;

            si.sie("ConfigureAndTriggerSchedule");
            string allTickerText = "";
            KillTicker();

            Boolean tickerFound = false;
            TickerMetaToUse = "";
            contentCollection.Clear();

            try
            {
                //"text 0 690 1024 80 clWhite Arial 48 5"
                gridFive.Visibility = Visibility.Collapsed;
                gridFour.Visibility = Visibility.Collapsed;
                gridThree.Visibility = Visibility.Collapsed;
                gridTwo.Visibility = Visibility.Collapsed;

                #region CollectContentCollection
                try
                {
                    foreach (DAL.Content item in proxy.CollectMedia())
                    {
                        contentCollection.Add(item);
                    }
                }
                catch (Exception ex)
                {
                    CoreWorkingOK = false;
                    contentCollection.Clear();
                }

                si.sii("Content Collection Count = " + contentCollection.Count().ToString());


                //if there is an error the collection is cleared and loaded from xml, if it worked the collection is saved for future use
                if (contentCollection.Count > 0)
                {
                    SerializeContentCollection(@"c:\tmp\content.xml");
                }
                else
                {
                    contentCollection.Clear();
                    if (FTPONLY)
                    {
                        contentCollection = DeSerializeContentCollection(@"c:\tmp\xml\content.xml");
                    } 
                    else
                    {
                        contentCollection = DeSerializeContentCollection(@"c:\tmp\content.xml");
                    }
                };
                #endregion


                si.sii("Collecting Media in Content Collection");
                CollectMediaInContentCollection(); //Collect All Media
                si.sii("Collect this loop:"+currentSchedule.Loopname);

                #region CollectCurrentLoop
                try
                {
                    if (CoreWorkingOK)
                    {
                        currentLoop = proxy.CollectThisLoop(currentSchedule.Loopname); //Collect Loop
                        SerializeCurrentLoop(@"c:\tmp\loop.xml");
                    }
                    else
                    {
                        currentLoop = null;
                    }
                }
                catch (Exception)
                {
                    currentLoop = null;
                }

                if (currentLoop == null) si.sii("Current Loop is NULL possibly because Core isn't working - Collect from XML");
                si.sii("FTP Only Variable = "+FTPONLY.ToString());

                if (currentLoop == null)
                {
                    if (FTPONLY)
                    {
                        si.sii(@"INSIDE FTP ONLY - Deserializing c:\tmp\xml\loops.xml");
                        ObservableCollection<Loop> lc = new ObservableCollection<Loop>();
                        //DAL.LoopCollection lc = new LoopCollection();
                        try
                        {
                            lc = DeSerializeLoopCollection(@"c:\tmp\xml\loops.xml");
                            si.sii(@"Items in Loops.xml:"+lc.Count.ToString());
                        }
                        catch (Exception e3)
                        {
                            si.six(e3);
                        }
                        
                        foreach (var l in lc)
                        {
                            si.sii("Stepping through loops.xml:"+l.Name+"/"+l.Templatename+"/"+l.Templateid.ToString());
                           if (l.Name == currentSchedule.Loopname)
                           {
                               currentLoop = l;
                               si.sii("Current Loop = "+currentLoop.Name);
                               break;
                           }
                        }
                    } else
                    {
                        currentLoop = DeSerializeCurrentLoop(@"c:\tmp\loop.xml");    
                    }
                }
                #endregion

                try
                {
                    LastLoopTick = proxy.CollectDelta("loop");
                    LastTickerTick = proxy.CollectDelta("ticker");
                }
                catch (Exception)
                {
                }

                #region CollectTemplateCollection
                si.sii("Collect this template:" + currentLoop.Templatename);
                try
                {
                    templateCollection = proxy.CollectZonesForThisTemplateName(currentLoop.Templatename); //CollectTemplate
                }
                catch (Exception)
                {
                    templateCollection.Clear();
                }

                if (templateCollection.Count > 0)
                {
                    SerializeTemplateCollection(@"c:\tmp\template.xml");
                }
                else
                {
                    if (FTPONLY)
                    {
                        try
                        {
                            templateCollection.Clear();
                            //TemplateCollection tmpCollection = new TemplateCollection();
                            ObservableCollection<Template> tmpCollection = new ObservableCollection<DAL.Template>();
                            tmpCollection = DeSerializeTemplateCollection(@"c:\tmp\xml\template.xml");
                            foreach (var t in tmpCollection)
                            {
                                if (t.Name == currentLoop.Templatename && t.Zonename != "_template")
                                {
                                    templateCollection.Add(t);
                                    si.sii("Template Zone Added = " + t.Name + "/" + t.Zonename + "/" + t.Zonedescription);
                                }
                            }
                            si.sii("Zones in Template = "+templateCollection.Count.ToString());
                        }
                        catch (Exception x1)
                        {
                            si.six(x1);
                        }
                    } else
                    {
                        templateCollection = DeSerializeTemplateCollection(@"c:\tmp\template.xml");
                        foreach (var t in templateCollection)
                        {
                            si.sii("Template Zone Added = " + t.Name + "/" + t.Zonename + "/" + t.Zonedescription);
                        }
                        si.sii("Zones in Template = " + templateCollection.Count.ToString());
                    }
                }
                #endregion

                //Populate Zones
                contentQ.Clear();
                contentQ2.Clear();
                contentQ3.Clear();
                contentQ4.Clear();
                contentQ5.Clear();
                int count = 1;
                int tickerInCount = 0; //equals count where ticker is found, 0 by default means no ticker
                int backGroundCount = 0; // //equals count where ticker is found, 0 by default means background is empty (we hide this grid)
                string TickerBackgroundColour = "";
                double TickerOpacity = 0;
                allTickerText = "";

                si.sii("===============================");
                si.sii("===============================");

                foreach (var item in templateCollection)
                {
                    try
                    {
                        if (CoreWorkingOK)
                        {
                            loopContentCollection = proxy.CollectLoopContentForZoneByName(item.Zonename, currentLoop.Name);
                            SerializeLoopContentCollection(@"c:\tmp\zone\" + item.Zonename + ".xml", loopContentCollection);
                        }
                        else
                            if (FTPONLY && File.Exists(@"c:\tmp\xml\allloopcontent.xml"))
                            {
                                //LoopContentCollection tmpLCC = new LoopContentCollection();
                                ObservableCollection<LoopContent> tmpLCC = new ObservableCollection<LoopContent>();
                                si.sii("Collecting from tmpxml alllloopcontent.xml");
                                tmpLCC = DeSerializeLoopContentCollection(@"c:\tmp\xml\allloopcontent.xml");
                                si.sii("LoopContent Items collected from xml = " + tmpLCC.Count.ToString());
                                loopContentCollection.Clear();
                                foreach (LoopContent c in tmpLCC)
                                {
                                    si.sii("STEPPING THROUGH Loop Content tmpLCC:" + c.Medianame);
                                    if (c.Zonename == item.Zonename && c.Loopname == currentLoop.Name)
                                    {
                                        si.sii("ADDING TO LOOP Content Collection Content tmpLCC:" + c.Medianame);
                                        loopContentCollection.Add(c);
                                    }
                                }
                            }
                            else
                            {
                                loopContentCollection = DeSerializeLoopContentCollection(@"c:\tmp\zone\" + item.Zonename + ".xml");
                            }
                    }
                    catch (Exception ei)
                    {
                        si.six(ei);
                    }

                    if (item.ZoneType.ToLower() == "Location and Weather strip".ToLower())
                    {
                        tbLocation.Text = Properties.Settings.Default.ClientID.ToUpper();
                        borderWeatherStrip.Visibility = Visibility.Visible;
                        UpdateWeather();
                    }

                    if (item.ZoneType.ToLower() == "Weather Box".ToLower())
                    {
                        tbLocation.Text = Properties.Settings.Default.ClientID.ToUpper();
                        borderWeatherRight.Visibility = Visibility.Visible;
                        UpdateWeather();
                    }

                    si.sii(item.Zonename + "/" + item.X + "/" + item.Width);
                    foreach (var lc in loopContentCollection)
                    {
                        #region First Configure the Ticker
                        try
                        {
                            foreach (var cc in contentCollection)
                            {
                                if (cc.Contenttype == "Ticker" && lc.Mediaid == cc.Id)
                                {
                                    //Return All TickerMeta
                                    allTickerText += cc.Metadata8 + "    ";
                                    TickerMeta = "text";
                                    TickerMeta += " " + item.X.ToString(); //"text 0 690 1024 80 clWhite Arial 48 5"
                                    TickerMeta += " " + item.Y.ToString();
                                    TickerMeta += " " + item.Width.ToString();
                                    TickerMeta += " " + item.Height.ToString();
                                    Color tickerC = new Color();
                                    ColorConverter ccv = new ColorConverter();
                                    string tickerColour = cc.Metadata4;
                                    TickerMeta += " $00" + tickerColour.Substring(7, 2) + tickerColour.Substring(5, 2) + tickerColour.Substring(3, 2);//0000FF";// Color.FromRgb(0xFF, 0xFF, 0xFF).ToString(); //Color

                                    TickerBackgroundColour = cc.Metadata6;
                                    TickerOpacity = Convert.ToDouble(cc.Metadata7);
                                    UserControlContent.TickerBackgroundOpacity = TickerOpacity;
                                    
                                    TickerMeta += " " + cc.Metadata2; //Font
                                    TickerMeta += " " + cc.Metadata3; //Size
                                    //TickerMeta += " " + cc.Metadata5; //Speed
                                    TickerMeta += " 12";
                                    if (lc.Order == 1)
                                    {
                                        tickerFound = true;
                                        UserControlContent.TickerBackgroundColour = TickerBackgroundColour;
                                        TickerMetaToUse = TickerMeta;
                                        tickerInCount = count;
                                        si.sii("TICKER METADATA = " + TickerMeta);
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {    
                        }
                        #endregion

                        //Do the rest
                        si.sii("Looping through ContentCollection...Medianame="+lc.Medianame+" / LoopName="+lc.Loopname);
                        foreach (var cc in contentCollection)
                        {
                            if (cc.Contenttype != "Ticker" && lc.Mediaid == cc.Id)
                                {
                                    //selectedn = @"c:\content\_media\" + System.IO.Path.GetFileName(selectedn);
                                    if (cc.Contenttype == "Background") backGroundCount = count;
                                    if (count == 1)
                                    {
                                        contentQ2.Add(cc);
                                        si.sii("ADDING CONTENT TO Q2:"+cc.Filelocation);
                                    }
                                    if (count == 2)
                                    {
                                        contentQ3.Add(cc);
                                        si.sii("ADDING CONTENT TO Q3:" + cc.Filelocation);
                                    }
                                    if (count == 3)
                                    {
                                        contentQ4.Add(cc);
                                    }
                                    if (count == 4) contentQ5.Add(cc);
                                    si.sii(@"c:\content\_media\" + System.IO.Path.GetFileName(cc.Filelocation));
                                }
                        }
                    }

                    try
                    {
                        WriteTickerFile(allTickerText);
                    }
                    catch (Exception)
                    {
                    }

                    uccTwo = new UserControlContent();
                    uccThree = new UserControlContent();
                    uccFour = new UserControlContent();
                    uccFive = new UserControlContent();

                    Grid currentGrid = null;

                    #region PopulateGridWithContent
                    if (count == 1)
                    {
                        if (tickerInCount == 1)
                        {
                            uccTwo.IsTickerBackground = true;
                        }
                        gridTwo.Children.Clear();
                        gridTwo.Children.Add(uccTwo);
                        currentGrid = gridTwo;
                        if (contentQ.Count == 0) currentGrid = gridHiddenGrid;
                        uccTwo.SetContentQ(contentQ2);
                        KeepAliveTicker++;
                        si.sii("Firing Grid 2");
                    }
                    else
                        if (count == 2)
                        {
                            if (tickerInCount == 2)
                            {
                                uccThree.IsTickerBackground = true;
                            }
                            gridThree.Children.Clear();
                            gridThree.Children.Add(uccThree);
                            currentGrid = gridThree;
                            uccThree.SetContentQ(contentQ3);
                            KeepAliveTicker++;
                            si.sii("Firing Grid 3");
                        }
                        else
                            if (count == 3)
                            {
                                if (tickerInCount == 3)
                                {
                                    uccFour.IsTickerBackground = true;
                                }
                                gridFour.Children.Clear();
                                gridFour.Children.Add(uccFour);
                                currentGrid = gridFour;
                                uccFour.SetContentQ(contentQ4);
                                KeepAliveTicker++;
                                si.sii("Firing Grid 4");
                            }
                            else
                                if (count == 4)
                                {
                                    if (tickerInCount == 4)
                                    {
                                        uccFive.IsTickerBackground = true;
                                    }
                                    gridFive.Children.Clear();
                                    gridFive.Children.Add(uccFive);
                                    currentGrid = gridFive;
                                    uccFive.SetContentQ(contentQ5);
                                    KeepAliveTicker++;
                                    si.sii("Firing Grid 5");
                                };
                    #endregion
                    //gridTwo.Children.Add(ucc);
                    //ucc.SetContentQ(contentQ);

                    double x = Convert.ToDouble(item.X); //sim("targetx=" + target.x);
                    double y = Convert.ToDouble(item.Y); //sim("targety=" + target.y);
                    double width = Convert.ToDouble(item.Width);
                    double height = Convert.ToDouble(item.Height);

                    currentGrid.Width = width;
                    currentGrid.Height = height;
                    currentGrid.Opacity = Convert.ToDouble(item.Opacity);
                    Canvas.SetTop(currentGrid, y);
                    Canvas.SetLeft(currentGrid, x);

                    //Canvas.SetZIndex(currentGrid, Convert.ToInt16(target.layer));
                    //sim(gridIndex + "|" + currentGrid + "x=" + x + " y=" + y);

                    currentGrid.Visibility = Visibility.Visible;

                    count++;

                    if (backGroundCount == 1) gridTwo.Visibility = Visibility.Collapsed;
                    if (backGroundCount == 2) gridThree.Visibility = Visibility.Collapsed;
                    if (backGroundCount == 3) gridFour.Visibility = Visibility.Collapsed;
                    if (backGroundCount == 4) gridFive.Visibility = Visibility.Collapsed;
                }
            }
            catch
            {
            }
            try
            {
                tickerTimer.Start();
            }
            catch (Exception ex)
            {
                
            }
            
            si.sil("ConfigureAndTriggerSchedule");
            //this.Topmost = true;
            //this.Activate();
            //this.Focus();
        }