Summary description for BusinessLayer
Beispiel #1
0
        public  DataAccessLayer.SOAResult InsertLog ( BusinessLayer.Log log)
        {

            // First check if this record exists in the SQLite

            using (var contents =  SQLiteUtilities.MainSQLiteConnection.CreateCommand ()) 
            {

                using (var c = SQLiteUtilities.MainSQLiteConnection.CreateCommand ()) 
                {
                    c.CommandText = "INSERT INTO[Log] ([Date], [LogText]) VALUES ('" + log.Date + "', '" +
                        log.LogText + "')";
                    try
                    {
                        var rowcount = c.ExecuteNonQuery (); // rowcount will be 1
                        if (rowcount == 1)
                            return  DataAccessLayer.SOAResult.TRUE;
                        else
                            return  DataAccessLayer.SOAResult.FALSE;
                    }
                    catch(Exception ex)
                    {
                        DataAccessLayer.ExceptionWriter.WriteLogFile(ex);
                        return DataAccessLayer.SOAResult.FALSE;
                    }

                }

            }

        }
        public System.Collections.Generic.List<BusinessLayer.Anfrage>    GetAnfragen (string lieferantenId, string deviceLanguage , ref BusinessLayer.User user)
        {
            // First check for the network status
            if (user.NetworkStatus == NetworkState.Disconnected)
                return GetAnfragen (lieferantenId, deviceLanguage, ref user, true);

            Stream dataStream;

            // Use the ServiceManager to build send the data to the SOA services            
            // The ServiceManager is responsible to send the data to the SOA services       
            // Run the service and return the value as a Datastream 
            // EXECUSERPERMISSION.JSON

            SOAServiceManager sm = new SOAServiceManager (DataAccessLayer.Utilities.ServerIP + "/anfragen.json",user.IdSession, DataAccessLayer.HTTPMethod.POST);                  

            // Add the Values                           
            sm.AddCriteriaValue ("KundeID", lieferantenId);
            sm.AddCriteriaValue ("Mandant", user.Mandant);
            sm.AddCriteriaValue ("Sprache", deviceLanguage);

            // Now it's show time   
            dataStream = sm.CommitPost ();                                                  

            if (dataStream == null)
                return null;

            StreamReader reader = new StreamReader(dataStream);
            if (reader == null)
                return null;

            string jsonText = reader.ReadToEnd ();

            return  Newtonsoft.Json.JsonConvert.DeserializeObject<List<BusinessLayer.Anfrage>> (jsonText);

        }
 /// <summary>
 /// Sets the controls.
 /// </summary>
 /// <param name="anschrift">Anschrift.</param>
 /// <param name="image">Image.</param>
 public void SetControls(BusinessLayer.Artikel artikel)
 {
     // fill the controls
     LblArtikelBez1.Text = artikel.Bez1;
     ArtikelBez2_6Label.Text = GetArtikelBez2_6(artikel);
     ArtikelNummerLabel.Text = artikel.Nummer;
 }
Beispiel #4
0
 protected void AdminDoctorView_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     BusinessLayer businessLyerObj = new BusinessLayer();
     string connectString = ConfigurationManager.AppSettings.Get("connString");
     int index = e.RowIndex;
     businessLyerObj.ApproveDoctor(AdminDoctorView.DataKeys[index].Value.ToString(), connectString);
 }
        public static System.Collections.Generic.List<BusinessLayer.TaskTyp>    GetTaskTyps( ref BusinessLayer.User user, bool Offline)
        {
            // First check for the network status
            if ( Offline == false)          
                return GetTaskTyps ( ref user);

            List<BusinessLayer.TaskTyp> taskTyps = new List<BusinessLayer.TaskTyp>();

            using (var contents = SQLiteUtilities.MainSQLiteConnection.CreateCommand ()) {

                contents.CommandText = "SELECT * FROM [TaskTyp]";
                var r = contents.ExecuteReader ();
                while (r.Read ())
                {
                    var tasktyp =new   BusinessLayer.TaskTyp();
                    tasktyp.ID = r["ID"].ToString();
                    tasktyp.Nummer = r["Nummer"].ToString().Replace("''","'");
                    tasktyp.Kuerzel = r["Kuerzel"].ToString().Replace("''","'");
                    tasktyp.Beschreibung = r["Beschreibung"].ToString().Replace("''","'");

                    taskTyps.Add(tasktyp);

                }

            }

            return taskTyps;

        }
Beispiel #6
0
        public HttpResponseMessage Get(string Company = null, string Key1 = null, string SessionUser = null)
        {
            if (SessionUser == string.Empty || SessionUser == "" || SessionUser == null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Session User Not Defined !"));
            }
            BusinessLayer BL = new BusinessLayer();
            //req by Tsen to remove the checking on the FS_PMCWH_c from Material Return Verification in the email subject Spritzer - HH - Mat Return Verification (no data)
            //string PMCWH = BL.MatRetnVerifyGetPMCWH(SessionUser);
            //if (PMCWH == "Not Found")
            //{
            //    return Request.CreateErrorResponse(HttpStatusCode.BadRequest, "PMC Warehouse not defined for user !");
            //}
            string PMCWH = ""; //Simply assign to empty because of the req changes

            if (!string.IsNullOrEmpty(Company))
            {
                List <MatReturnVerfy> entity = BL.GetMatRetnList(Company, PMCWH);
                if (entity != null)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, entity));
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.NotFound,
                                                       $"Not Found"));
                }
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest,
                                                   $"Company is Null!"));
            }
        }
        public string GetUmsatz(string id, ref BusinessLayer.User user)
        {
            // First we test if the networkstatus is disconnected or not
            if (user.NetworkStatus == NetworkState.Disconnected)
                return GetUmsatz (id, ref user, true);

            Stream dataStream;

            // Use the ServiceManager to build send the data to the SOA services			
            // The ServiceManager is responsible to send the data to the SOA services 		
            // Run the service and return the value as a Datastream	
            // EXECUSERPERMISSION.JSON

            SOAServiceManager sm = new SOAServiceManager (DataAccessLayer.Utilities.ServerIP + "/getpersonumsatz.json",user.IdSession, DataAccessLayer.HTTPMethod.POST);

            // Add the Values 							
            sm.AddCriteriaValue("ID", id);
            sm.AddCriteriaValue("Mandant", user.Mandant);
            sm.AddCriteriaValue("Bereich", "8");

            // Now it's show time	
            dataStream = sm.CommitPost();
            if (dataStream == null)
                return "0";

            StreamReader reader = new StreamReader(dataStream);
            string jsonText = reader.ReadToEnd();


            return  jsonText.Trim();

        }
 //
 public void InsertDetail(BusinessLayer.NhanVienBsn nhanvien)
 {
     try
     {
         SqlCommand cmd = new SqlCommand();
         cmd.CommandType = CommandType.Text;
         cmd.CommandText = "INSERT INTO " + this.tableName
             + "(" + this.fieldList + ") VALUES ('"
             + nhanvien.TeNV + "','" + nhanvien.Diachi + "','" + nhanvien.Ngaysinh.ToShortDateString() + "'," + Convert.ToInt32(nhanvien.Giotinh) + ",'" + nhanvien.Dienthoai + "'," + nhanvien.MaCV + "," + nhanvien.MaLuong + ",'" + nhanvien.SoBH + "',"+nhanvien.MaPhong+"," + nhanvien.MaCM + "," + nhanvien.MaTD + ")";
         dt = new DataTable();
         dt = GetData(cmd);
        
         MessageBox.Show("thêm m?i thành công", "Thông báo");
         //conn.Close();
     }
     catch (Exception)
     {
         MessageBox.Show("B? trùng khóa, thêm m?i th?t b?i", "Thông báo");
     }
     finally
     {
         closeConnect();
         // conn.Close();
     }
 }
Beispiel #9
0
        public ActionResult Edit(int id)
        {
            //populate the deptid field
            BusinessLayer bll  = new BusinessLayer();
            var           dids = bll.GetAllEmps()
                                 .Select(o => o.Deptid)
                                 .Distinct()
                                 .Select(o => new SelectListItem
            {
                Text  = o.ToString(),
                Value = o.ToString()
            }).ToList();

            //Get the Employee record using Business Layer
            var emp    = bll.SelectEmpById(id);
            var record = new Models.Employee
            {
                Ecode   = emp.Ecode,
                Ename   = emp.Ename,
                Salary  = emp.Salary,
                Deptid  = emp.Deptid,
                Deptids = dids
            };

            return(View(record));
        }
Beispiel #10
0
        /// <summary>
        /// Contructeur d'un fenètre d'ajout
        /// </summary>
        /// <param name="biblio"> Bibliothèque utilisée</param>
        /// <param name="ih"> Ihm principale </param>
        public ajouterLivre(BusinessLayer.Metier.Bibliotheque biblio, IHM ih)
        {
            _biblio = biblio;
            InitializeComponent();

            // Remplir le comboBoxAuteur et editeur
            foreach (IAuteur auteur in _biblio.Ecrivain)
            {
                comboBoxAuteur.Items.Add(auteur);

            }
            foreach (IEditeur edit in _biblio.Editeur)
            {
                comboBoxEditeur.Items.Add(edit);

            }
            foreach (IGenre genre in _biblio.Genre)
            {
                comboBoxGenre.Items.Add(genre);

            }

            modif = false;
            _ihm = ih;
            ih.Enabled = false;
        }
Beispiel #11
0
        private List <vItemProduct> LoadItemFromRemoteDB()
        {
            string filterExpression         = string.Format("1=1 AND IsDeleted=0 ORDER BY ItemCode");
            List <vItemProduct> listProduct = BusinessLayer.GetvItemProductList(filterExpression);

            return(listProduct);
        }
Beispiel #12
0
    protected void btn_Click(object sender, EventArgs e)
    {
        string id          = ((Control)sender).ID;
        int    question_id = 0;

        switch (id)
        {
        case "btn_check":
            int exist_indicator = BusinessLayer.Check_Username_Existence(txt_forgot_password.Text);

            if (exist_indicator == 0)
            {
                question_id          = LoadQuestions(txt_forgot_password.Text);
                pnl_email.Visible    = false;
                pnl_question.Visible = true;
                pnl_confirm.Visible  = false;
            }
            else
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("<p class='error bold'>Your account does not exist. Please check email address again.</p>");
                lit_error.Text = sb.ToString();
            }
            break;

        case "btn_submit":
            tblQuestion       q = ModelLayer.GetQuestion(question_id);
            tblQuestionAnswer a = ModelLayer.GetQuestionAnswer(q.iQuestionAnswer);

            if (a.vQuestionAnswer == txt_question_answer.Text)
            {
                string result = SendEmail(txt_forgot_password.Text);

                if (result == "Success")
                {
                    pnl_email.Visible    = false;
                    pnl_question.Visible = false;
                    pnl_confirm.Visible  = true;
                }
                else
                {
                    Common.ErrorLog(@"c:\logs\debug.txt", result);
                }
            }
            else
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("<p class='error bold'>Your security question answer does not match with our records. Please check your answer again.</p>");
                lit_error.Text = sb.ToString();
            }
            break;

        case "btn_confirm":
            Response.RedirectToRoute("Login");
            break;

        default:
            break;
        }
    }
        public static System.Collections.Generic.List<BusinessLayer.TaskTyp>    GetTaskTyps( ref BusinessLayer.User user)
        {
            // First check for the network status
            if (user.NetworkStatus == NetworkState.Disconnected)
                return GetTaskTyps ( ref user, true);

            Stream dataStream;

            // Use the ServiceManager to build send the data to the SOA services            
            // The ServiceManager is responsible to send the data to the SOA services       
            // Run the service and return the value as a Datastream 
            // EXECUSERPERMISSION.JSON

            SOAServiceManager sm = new SOAServiceManager (DataAccessLayer.Utilities.ServerIP + "/tasktyp.json",user.IdSession, DataAccessLayer.HTTPMethod.POST);                    


            // Now it's show time   
            dataStream = sm.CommitPost ();                                                  

            if (dataStream == null)
                return null;

            StreamReader reader = new StreamReader(dataStream);
            if (reader == null)
                return null;

            string jsonText = reader.ReadToEnd ();

            return  Newtonsoft.Json.JsonConvert.DeserializeObject<List<BusinessLayer.TaskTyp>> (jsonText);
        }
Beispiel #14
0
        /// <inheritdoc />
        public void Configure()
        {
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
            PacketHandler <LoginClient> .Initialize();

            var dbConfig = ConfigurationHelper.Load <DatabaseConfiguration>(DatabaseConfigFile);

            DependencyContainer.Instance
            .GetServiceCollection()
            .RegisterDatabaseServices(dbConfig);

            BusinessLayer.Initialize();
            DependencyContainer.Instance.Register <ILoginServer, LoginServer>(ServiceLifetime.Singleton);
            DependencyContainer.Instance.Configure(services => services.AddLogging(builder =>
            {
                builder.AddFilter("Microsoft", LogLevel.Warning);
                builder.SetMinimumLevel(LogLevel.Trace);
                builder.AddNLog(new NLogProviderOptions
                {
                    CaptureMessageTemplates  = true,
                    CaptureMessageProperties = true
                });
            }));
            DependencyContainer.Instance.Configure(services =>
            {
                var worldConfiguration = ConfigurationHelper.Load <LoginConfiguration>(LoginConfigFile, true);
                services.AddSingleton(worldConfiguration);
            });
            DependencyContainer.Instance.BuildServiceProvider();
        }
        protected void btnPlaceOrd_Click(object sender, EventArgs e)
        {
            if (chkNew.Checked)
            {
                shipaddress.Shipname   = txtCompanyName.Text;
                shipaddress.Address    = txtAddress.Text;
                shipaddress.City       = txtCity.Text;
                shipaddress.Country    = txtCountry.Text;
                shipaddress.PostalCode = txtPostalCode.Text;
                shipaddress.Region     = txtRegion.Text;
            }
            else
            {
                shipaddress.Shipname   = Cust.CompanyName;
                shipaddress.Address    = Cust.Address;
                shipaddress.City       = Cust.City;
                shipaddress.Country    = Cust.Country;
                shipaddress.PostalCode = Cust.PostalCode;
                shipaddress.Region     = Cust.Region;
            }
            BusinessLayer.PlaceOrder(CustomerID, shipaddress, DateTime.Now, DateTime.Now.AddDays(7), ShipVia, Freight);
            string str = "Saved Successfully into the Database";

            Response.Write("<script>alert('" + str + "')</script>");
            Response.Redirect("Login.aspx");
        }
Beispiel #16
0
        public ActionResult StopVoting()
        {
            BusinessLayer bal = new BusinessLayer();
            DataTable     dt  = bal.StopVoting();

            return(View("FinalVoteResults", dt));
        }
Beispiel #17
0
        // POST: api/LPRetrieve
        public HttpResponseMessage Post([FromBody] RetrieveFromStorage entity)
        {
            try
            {
                if (entity != null)
                {
                    BusinessLayer BL  = new BusinessLayer();
                    string        msg = BL.InsertLPRetrieveFromStorage(entity);

                    if (msg == "")
                    {
                        return(Request.CreateResponse(HttpStatusCode.OK, msg));
                    }
                    else
                    {
                        return(Request.CreateResponse(HttpStatusCode.NotAcceptable, msg));
                    }
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Entity Is Null!"));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message.ToString()));
            }
        }
        public PartialViewResult GetEquipmentInsertView()
        {
            List <MaintenanceData> mdl = new BusinessLayer <MaintenanceData>(new CapaNavDocDal()).GetList();
            List <ActivityField>   afl = new BusinessLayer <ActivityField>(new CapaNavDocDal()).GetList();

            if (mdl.Count == 0)
            {
                return(PartialView("ErrorMessageView", new ErrorMessageViewModel {
                    ErrorMessage = "Aucune donnée d'entretien définie."
                }));
            }

            if (afl.Count == 0)
            {
                return(PartialView("ErrorMessageView", new ErrorMessageViewModel {
                    ErrorMessage = "Aucun domaine d'activité défini."
                }));
            }

            return(PartialView("EquipmentEditionView", new EquipmentEditionViewModel
            {
                EditionMode = EditionMode.Insert,
                DocumentsReferences = mdl.Select(md => md.Name).ToList(),
                ActivityFieldDescriptions = afl.Select(a => a.Description).ToList()
            }));
        }
Beispiel #19
0
        public ActionResult AdminIndex()
        {
            BusinessLayer bal = new BusinessLayer();

            User currentLogged = bal.GetUserByUsername(User.Identity.Name);

            if (bal.IsUserAlreadyVoted(currentLogged.UserID))
            {
                VoteListViewModel vlvm = new VoteListViewModel();
                vlvm.VoteViewModels = this.GetVoteViewModel(bal.GetVotes());
                return(View("VotingResultsAdmin", vlvm));
            }
            int                  userID       = bal.GetBirthdayUserID();
            User                 birthdayUser = bal.GetUserById(userID);
            UserViewModel        uvm          = new UserViewModel(birthdayUser.UserID, birthdayUser.Username, birthdayUser.Birthdate);
            PresentListViewModel plvm         = new PresentListViewModel();

            plvm.Presents = this.GetPresentsViewModel(bal.GetPresents());
            VotingUserViewModel vvm = new VotingUserViewModel();

            vvm.User     = uvm;
            vvm.Presents = plvm;

            //bal.InitializeVoting(currentLogged.UserID, birthdayUser.UserID);

            return(View("IndexAdmin", vvm));
        }
        public PartialViewResult GetEquipmentMonitoringView(string id)
        {
            Equipment equipment = new BusinessLayer <Equipment>(new CapaNavDocDal()).Get(id.ToInt32());
            EquipmentMonitoringViewModel model = equipment.ToEquipmentMonitoringViewModel();

            return(PartialView("EquipmentMonitoringView", model));
        }
        public ActionResult EditEquipment(EquipmentEditionViewModel model)
        {
            if (!ModelState.IsValid)
            {
                model.DocumentsReferences       = new BusinessLayer <MaintenanceData>(new CapaNavDocDal()).GetList().Select(m => m.Name).ToList();
                model.ActivityFieldDescriptions = new BusinessLayer <ActivityField>(new CapaNavDocDal()).GetList().Select(a => a.Description).ToList();
                return(PartialView("EquipmentEditionView", model));
            }
            MaintenanceData md = new BusinessLayer <MaintenanceData>(new CapaNavDocDal()).GetList().FirstOrDefault(m => m.Name == model.MaintenanceDataId);

            if (md != null)
            {
                model.MaintenanceDataId = md.Id.ToString();
            }

            ActivityField af = new BusinessLayer <ActivityField>(new CapaNavDocDal()).GetList().FirstOrDefault(a => a.Description == model.ActivityFieldId);

            if (af != null)
            {
                model.ActivityFieldId = af.Id.ToString();
            }

            new DefaultController <Equipment>().Edit(model);
            return(Json(new { success = true }));
        }
Beispiel #22
0
    public string SaveQuery()
    {
        string connectionString = ConfigurationManager.AppSettings.Get("connString");
        ListItem li = new ListItem();
        string symptoms = string.Empty ;

        Query queryObj = new Query();
        int i = 0; int counter = 0;

        int max = counter;
        counter = 0;

        queryObj.Username = Session["Username"].ToString();
        queryObj.QueryAreaOfInterest = ddlInterestList.SelectedItem.Value;
        queryObj.Symptoms = txtSymptoms.Text;
        queryObj.MedicalHistory = txtMedHistory.Text;
        queryObj.Status = "Unanswered";
        queryObj.IsAttendedTo = false;
        queryObj.PostedDatetime = DateTime.Now;

        //passing to business layer

        //string message;
        BusinessLayer businessLayerObj = new BusinessLayer();
        try
        {
            businessLayerObj.InsertQuery(queryObj, connectionString);
        }
        catch(Exception ex)
        {
            return ex.Message;
        }

        return "noerror";
    }
        public ActionResult AjaxHandler(JQueryDataTableParam param)
        {
            BusinessLayer <Equipment>        bl    = new BusinessLayer <Equipment>(new CapaNavDocDal());
            BusinessLayer <MaintenanceData>  mbl   = new BusinessLayer <MaintenanceData>(new CapaNavDocDal());
            BusinessLayer <ActivityField>    afbl  = new BusinessLayer <ActivityField>(new CapaNavDocDal());
            List <EquipmentDetailsViewModel> model = new List <EquipmentDetailsViewModel>(bl.GetList().Select(e => (EquipmentDetailsViewModel)e.ToModel(new EquipmentDetailsViewModel())));

            model = TableDataAdapter.Search(model, param);
            model = TableDataAdapter.SortList(model, param);
            model = TableDataAdapter.PageList(model, param);

            string[][] data = model.Select(m => new[] { m.Id.ToString(), m.PartNumber, m.Manufacturer, m.Name, m.Type,
                                                        m.Ata.ToString(),
                                                        m.ActivityFieldId.ToInt32() == 0 ? "" : afbl.Get(m.ActivityFieldId.ToInt32()).Description,
                                                        m.MechanicsGroup,
                                                        m.MaintenanceDataId.ToInt32() == 0 ? "" : mbl.Get(m.MaintenanceDataId.ToInt32()).Name,
                                                        m.MonitoringDate, m.MaintenanceDataId }).ToArray();

            return(Json(new
            {
                param.sEcho,
                iTotalRecords = model.Count,
                iTotalDisplayRecords = param.iDisplayLength,
                aaData = data
            }, JsonRequestBehavior.AllowGet));
        }
Beispiel #24
0
        //// GET: api/LPPalletSelection
        //public IEnumerable<string> Get()
        //{
        //    return new string[] { "value1", "value2" };
        //}

        // GET: api/LPPalletSelection/5
        public HttpResponseMessage Get(string Company = null, int SONum = 0, DateTime?ShipByDate = null)
        {
            try
            {
                if (SONum > 0 && !string.IsNullOrEmpty(Company) && ShipByDate != null)
                {
                    //Get PalletSelection Data by Company, UD108Key1,sysRowId - params are from LPDtls object
                    BusinessLayer          BL     = new BusinessLayer();
                    List <PalletSelection> entity = BL.GetLstPalletSelectionByPKeys(Company, SONum, Convert.ToDateTime(ShipByDate));
                    if (entity != null && entity.Any())
                    {
                        return(Request.CreateResponse(HttpStatusCode.OK, entity));
                    }
                    else
                    {
                        return(Request.CreateErrorResponse(HttpStatusCode.NotFound,
                                                           $"Company: {Company} And SONum : {SONum} And ShipByDate : {ShipByDate} data not found!"));
                    }
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.BadRequest,
                                                       $"Company Or SONum Or ShipByDate is Zero Or Null!"));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
            }
        }
Beispiel #25
0
        /// <inheritdoc />
        public void Configure()
        {
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
            PacketHandler <ISCClient> .Initialize();

            PacketHandler <WorldClient> .Initialize();

            DatabaseFactory.Instance.Initialize(DatabaseConfigFile);
            BusinessLayer.Initialize();
            DependencyContainer.Instance.Register <IWorldServer, WorldServer>(ServiceLifetime.Singleton);
            DependencyContainer.Instance.Register(typeof(PartyManager), ServiceLifetime.Singleton);
            DependencyContainer.Instance.Configure(services => services.AddLogging(builder =>
            {
                builder.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
                builder.AddNLog(new NLogProviderOptions
                {
                    CaptureMessageTemplates  = true,
                    CaptureMessageProperties = true
                });
            }));
            DependencyContainer.Instance.Configure(services =>
            {
                var worldConfiguration = ConfigurationHelper.Load <WorldConfiguration>(WorldConfigFile, true);
                services.AddSingleton(worldConfiguration);
            });
            GameResources.Instance.Initialize(this._loaders);
            DependencyContainer.Instance.BuildServiceProvider();
        }
Beispiel #26
0
        public static void Initialize(TestContext _)
        {
            var options = new DbContextOptionsBuilder <MailingApiContext>().UseInMemoryDatabase(databaseName: "BusinessLayerTests")
                          .ConfigureWarnings(x => x.Ignore(InMemoryEventId.TransactionIgnoredWarning)).Options;
            var context         = new MailingApiContext(options);
            var owner           = DataLayerTestHelper.CreateMailUser("name", "password");
            var serviceProvider = new ServiceCollection().AddLogging().BuildServiceProvider();
            var factory         = serviceProvider.GetService <ILoggerFactory>();

            _data     = new DataLayer(context, factory);
            _buisness = new BusinessLayer(_data);
            _data.InsertUser(owner);
            var groups = new List <MailingGroup>()
            {
                DataLayerTestHelper.CreateMailingGroup("name1", owner.Id),
                DataLayerTestHelper.CreateMailingGroup("name2", owner.Id),
                DataLayerTestHelper.CreateMailingGroup("nameToDelete3", owner.Id),
                DataLayerTestHelper.CreateMailingGroup("nameToDelete4", owner.Id),
            };

            foreach (var g in groups)
            {
                var consumers = new List <MailConsumer>()
                {
                    DataLayerTestHelper.CreateMailConsumer("*****@*****.**", g.Id),
                };
                _data.InsertGroup(g, consumers);
            }
        }
        public static string GetTownViaPLZ (string PLZ, ref BusinessLayer.User user)
		{
			Stream dataStream;

			// Use the ServiceManager to build send the data to the SOA services			
			// The ServiceManager is responsible to send the data to the SOA services 		
			// Run the service and return the value as a Datastream	
			// EXECUSERPERMISSION.JSON

			SOAServiceManager sm = new SOAServiceManager (DataAccessLayer.Utilities.ServerIP + "/GetTownViaPLZ.json",user.IdSession, DataAccessLayer.HTTPMethod.POST);					

			// Add the Values 							
			sm.AddCriteriaValue ("PLZ", PLZ);

			// Now it's show time	
            dataStream = sm.CommitPost ();													

            if (dataStream == null)
                return "";
            
            StreamReader reader = new StreamReader(dataStream);
			string jsonText = reader.ReadToEnd ();		

			/*	JavaScriptSerializer js = new JavaScriptSerializer();
			Person [] persons =  js.Deserialize<Person[]>(json);
*/

			return   jsonText.Trim ();
		}
    public string SaveAdvice()
    {
        string connectionString = ConfigurationManager.AppSettings.Get("connString");
        Advice adviceObj = new Advice();

        //creating an advice object
        adviceObj.QueryId = Convert.ToInt32(Request.QueryString["QueryId"]);

        adviceObj.Username = Session["Username"].ToString() ;

        adviceObj.Likes = 0;

        adviceObj.Dislikes = 0;

        adviceObj.AdviceTitle = txtAdviceTitle.Text;

        adviceObj.AdviceDescription = txtAdvice.Text;

        adviceObj.AdviceDateTime = DateTime.Now;

        //inserting data through business layer
        BusinessLayer businessLayerObj = new BusinessLayer();

        try
        {
            businessLayerObj.InsertAdvice(adviceObj, connectionString);
        }
        catch(Exception ex)
        {
            return ex.Message;
        }

        return "noerror";
    }
Beispiel #29
0
        static void Delete(BusinessLayer myBusinessLayer, LayerType layerType)
        {
            Console.WriteLine("Id to delete:");
            int Id = Int32.Parse(Console.ReadLine());

            switch (layerType)
            {
            case LayerType.STANDARD:

                if (myBusinessLayer.GetStandardByID(Id) == null)
                {
                    Console.WriteLine("No standard by that ID or Name was found.");
                }
                else
                {
                    Console.WriteLine("Standard: " + myBusinessLayer.GetStandardByID(Id).StandardName + " has been deleted");
                }
                myBusinessLayer.RemoveStandard(myBusinessLayer.GetStandardByID(Id));
                break;

            case LayerType.STUDENT:
                if (myBusinessLayer.GetStudentByID(Id) == null)
                {
                    Console.WriteLine("No student by that ID or Name was found. Returning to main menu");
                }
                else
                {
                    Console.WriteLine("Student: " + myBusinessLayer.GetStudentByID(Id).StudentName + " has been deleted");
                    myBusinessLayer.RemoveStudent(myBusinessLayer.GetStudentByID(Id));
                }
                break;

            case LayerType.TEACHER:
                if (myBusinessLayer.GetTeacherByID(Id) == null)
                {
                    Console.WriteLine("No teacher by that ID or Name was found. Returning to main menu");
                }
                else
                {
                    Console.WriteLine("Teacher: " + myBusinessLayer.GetTeacherByID(Id).TeacherName + " has been deleted");
                    myBusinessLayer.RemoveTeacher(myBusinessLayer.GetTeacherByID(Id));
                }
                break;

            case LayerType.COURSE:
                if (myBusinessLayer.GetCourseByID(Id) == null)
                {
                    Console.WriteLine("No Course by that ID or Name was found. Returning to main menu");
                }
                else
                {
                    Console.WriteLine("Course: " + myBusinessLayer.GetCourseByID(Id).CourseName + " has been deleted");
                    myBusinessLayer.RemoveCourse(myBusinessLayer.GetCourseByID(Id));
                }
                break;

            default:
                break;
            }
        }
Beispiel #30
0
 // GET: api/PilotToTruckInfo/5
 public HttpResponseMessage Get(string Company, string type, string pilotID, string loadingBay)
 {
     if (!string.IsNullOrEmpty(Company))
     {
         BusinessLayer BL = new BusinessLayer();
         if (type == "LoadingBay")
         {
             List <LoadingBayList1> _loadingBayList = BL.GetLoadingBayListByPilot(Company, pilotID);
             return(Request.CreateResponse(HttpStatusCode.OK, _loadingBayList));
         }
         else if (type == "Truck")
         {
             List <TruckList> _truckList = BL.GetTruckListByLoadingBay(Company, loadingBay);
             return(Request.CreateResponse(HttpStatusCode.OK, _truckList));
         }
         else
         {
             return(Request.CreateErrorResponse(HttpStatusCode.BadRequest,
                                                "Invalid Request type!"));
         }
     }
     else
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest,
                                            $"Company is Null!"));
     }
 }
        public ActionResult DownloadExcel()
        {
            BusinessLayer BAL      = new BusinessLayer();
            var           workbook = new Spire.Xls.Workbook();

            workbook.LoadFromFile(Server.MapPath("~/DetailFormatInExcel/DetailsFormat.xlsx"));
            var worksheet1 = workbook.Worksheets[0];
            var worksheet2 = workbook.Worksheets[1];

            byte[] array = null;
            var    dt1   = BAL.GetXlsTableBooks();

            worksheet1.InsertDataTable(dt1, false, 3, 1);
            var dt2 = BAL.GetXlsTableCourse();

            worksheet2.InsertDataTable(dt2, false, 3, 1);
            var dt3 = BAL.GetXlsTableTeacher();

            worksheet2.InsertDataTable(dt3, false, 3, 3);

            using (var ms = new System.IO.MemoryStream())
            {
                workbook.SaveToStream(ms, FileFormat.Version2010);
                ms.Seek(0, System.IO.SeekOrigin.Begin);
                array = ms.ToArray();
            }

            return(File(array, "application / vnd.openxmlformats - officedocument.spreadsheetml.sheet", " Detail.xlsx"));
        }
Beispiel #32
0
        public ActionResult Create()
        {
            //get all the deptid from DB using Business layer
            BusinessLayer bll  = new BusinessLayer();
            var           dids = bll.GetAllEmps()
                                 .Select(o => o.Deptid)
                                 .Distinct()
                                 .Select(o => new SelectListItem
            {
                Text  = o.ToString(),
                Value = o.ToString()
            }).ToList();

            //var selectItemDids = new List<SelectListItem>();
            //foreach (var item in dids)
            //{
            //    selectItemDids.Add(new SelectListItem { Text = item.ToString(), Value = item.ToString() });
            //}

            var emp = new Models.Employee
            {
                Deptids = dids
            };

            return(View(emp));
        }
Beispiel #33
0
 //POST: api/FGPickingInfo
 public HttpResponseMessage Post([FromBody] List <PickingDtl> entitys)
 {
     try
     {
         if (entitys != null && entitys.Any())
         {
             BusinessLayer BL  = new BusinessLayer();
             string        msg = BL.createPickingDtl(entitys);
             if (msg == "")
             {
                 return(Request.CreateResponse(HttpStatusCode.OK, msg));
             }
             else
             {
                 return(Request.CreateResponse(HttpStatusCode.NotAcceptable, msg));
             }
         }
         else
         {
             throw new Exception("Object is Null!");
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
     }
 }
Beispiel #34
0
 //POST: api/FGPickingInfo
 public HttpResponseMessage Post(LoosePickingDtl entitys)
 {
     try
     {
         if (entitys != null)
         {
             BusinessLayer BL  = new BusinessLayer();
             string        msg = BL.updateLoosePicking(entitys);
             if (msg == "")
             {
                 return(Request.CreateResponse(HttpStatusCode.OK, msg));
             }
             else
             {
                 return(Request.CreateResponse(HttpStatusCode.NotAcceptable, msg));
             }
         }
         else
         {
             throw new Exception("Object is Null!");
         }
         //return Request.CreateResponse(HttpStatusCode.NotAcceptable, "");
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
     }
 }
Beispiel #35
0
        //// GET: api/LPLotNum
        //public IEnumerable<string> Get()
        //{
        //    return new string[] { "value1", "value2" };
        //}

        //// GET: api/LPLotNum/5
        //public string Get(int id)
        //{
        //    return "value";
        //}

        public HttpResponseMessage Get(string Company = null, string PartNum = null, string LotNum = null)
        {
            try
            {
                if (!string.IsNullOrEmpty(PartNum) && !string.IsNullOrEmpty(Company) && !string.IsNullOrEmpty(LotNum))
                {
                    string          errMsg = "";
                    BusinessLayer   BL     = new BusinessLayer();
                    PalletSelection entity = BL.GetLotFromLoose(Company, PartNum, LotNum, ref errMsg);
                    if (entity != null && errMsg == "")
                    {
                        return(Request.CreateResponse(HttpStatusCode.OK, entity));
                    }
                    else if (errMsg != "")
                    {
                        return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, errMsg));
                    }
                    else
                    {
                        return(Request.CreateErrorResponse(HttpStatusCode.NotFound,
                                                           $"LotNum {LotNum} was not belong to the selected product!"));
                    }
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.BadRequest,
                                                       $"PartNum Or Company Or LotNum is Null!"));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message.ToString()));
            }
        }
Beispiel #36
0
        public IBusinessLayer GetBusinessLayer()
        {
            BusinessLayer bl = new BusinessLayer();

            bl.Sync();
            return(bl);
        }
Beispiel #37
0
        public Form1()
        {
            InitializeComponent();
            _businessLayer     = new BusinessLayer();
            dekalbPersons      = new List <Person>();
            dekalbHouses       = _businessLayer.lstDekalbHouses;
            dekalbApartments   = _businessLayer.lstDekalbApartments;
            sycamorePersons    = new List <Person>();
            sycamoreHouses     = _businessLayer.lstSycamoreHouses;
            sycamoreApartments = _businessLayer.lstSycamoreApartments;
            CommunitiesList    = _businessLayer.Communities;
            dekalbPersons      = _businessLayer.lstDekalbPersons;
            sycamorePersons    = _businessLayer.lstSycamorePersons;
            dekalbSchools      = new List <School>();
            dekalbSchools      = _businessLayer.lstDekalbSchools;
            dekalbBusinesses   = _businessLayer.lstDekalbBusiness;
            sycamoreSchools    = new List <School>();
            sycamoreSchools    = _businessLayer.lstSycamoreSchools;
            sycamoreBusinesses = _businessLayer.lstSycamoreBusiness;

            trackBarMin.Minimum       = 0;
            trackBarMin.Maximum       = 350000;
            trackBarMax.Minimum       = 0;
            trackBarMax.Maximum       = 350000;
            trackBarMin.Value         = 0;
            trackBarMax.Value         = 0;
            trackBarMin.TickFrequency = (int)(350000 - 0) / 15;
            trackBarMax.TickFrequency = (int)(350000 - 0) / 15;
            label1.Text = "Min Price: " + String.Format("{0:$#,0}", trackBarMin.Value);
            label2.Text = "Max Price: " + String.Format("{0:$#,0}", trackBarMax.Value);


            Load_School_Information();
            Load_ForSale_Information();
        }
 /// <summary>
 /// Sets the controls.
 /// </summary>
 /// <param name="anschrift">Anschrift.</param>
 /// <param name="image">Image.</param>
 public void SetControls(BusinessLayer.Person person)
 {
     // fill the controls
     //            MainImageView.Image = UIImage.FromFile(image);
     PersonNameLabel.Text = person.Name;
     PersonNummerLabel.Text = person.Nummer;
 }
        public IHttpActionResult HasConflict(int DayId, int HourId,
                                             int TeacherId, int ClassId)
        {
            List <ClassSchedule> Conflicts = BusinessLayer.Conflicts(DayId, HourId, TeacherId, ClassId);

            return(Ok(Conflicts));
        }
 public IHttpActionResult SaveItem(Model item)
 {
     if (item.Id == 0)
     {
         int newID = BusinessLayer.AddModel(item);
         if (newID == 0)
         {
             return(Conflict());
         }
         else if (newID == -1)
         {
             return(InternalServerError());
         }
         item.Id = newID;
     }
     else
     {
         bool editSucceeded = BusinessLayer.EditModel(item);
         if (!editSucceeded)
         {
             return(InternalServerError());
         }
     }
     return(Ok());
 }
        public IHttpActionResult PostItem(JObject itemm)
        {
            Model item = (Model)itemm.ToObject(modelType);

            if (item.Id == 0)
            {
                int newID = BusinessLayer.AddModel(item);
                if (newID == 0)
                {
                    return(Conflict());
                }
                else if (newID == -1)
                {
                    return(InternalServerError());
                }
                item.Id = newID;
            }
            else
            {
                bool editSucceeded = BusinessLayer.EditModel(item);
                if (!editSucceeded)
                {
                    return(InternalServerError());
                }
            }
            return(Ok(item.Id));
        }
Beispiel #42
0
 // GET: api/LPLotSuggestions/5
 public HttpResponseMessage Get(string Company = null, string PartNum = null)
 {
     try
     {
         if (!string.IsNullOrEmpty(PartNum) && !string.IsNullOrEmpty(Company))
         {
             string msg = "";
             List <PRMLotSuggestions> lotSuggestions = new List <PRMLotSuggestions>();
             BusinessLayer            BL             = new BusinessLayer();
             msg = BL.GetPRMLotSuggestions(Company, PartNum, ref lotSuggestions);
             if (msg == "" && lotSuggestions != null)
             {
                 return(Request.CreateResponse(HttpStatusCode.OK, lotSuggestions));
             }
             else if (lotSuggestions == null)
             {
                 return(Request.CreateErrorResponse(HttpStatusCode.NotFound,
                                                    $"Part doesnt have any lots for suggestions" + Environment.NewLine + msg));
             }
             else
             {
                 return(Request.CreateErrorResponse(HttpStatusCode.NotFound, msg));
             }
         }
         else
         {
             return(Request.CreateErrorResponse(HttpStatusCode.BadRequest,
                                                $"PartNum Or Company Or LotNum is Null!"));
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
     }
 }
Beispiel #43
0
        public void ItShallSaveOrUpdateIPTC()
        {
            BusinessLayer.SaveIPTC(defaultIPTC);
            var sut = BusinessLayer.GetIPTC(Id.Default);

            Assert.Equal(sut, defaultIPTC);
        }
Beispiel #44
0
        public static async System.Threading.Tasks.Task<List<Lieferant>>   GetLieferantenAsync( string Name , string deviceLanguage , BusinessLayer.User User)
		{

			DataAccessLayer.DAL_Lieferant dal_Lieferant = new DataAccessLayer.DAL_Lieferant ();
            var lieferanten =await dal_Lieferant.GetLieferantenAsync (Name, deviceLanguage, User);
			return lieferanten;

		}
Beispiel #45
0
        public static Lieferant Create(string id , string deviceLanguage ,ref BusinessLayer.User user)
		{
			// das Objekt wird mit einem vorhandenen Lieferantn initializiert
			DataAccessLayer.DAL_Lieferant dal_Lieferant = new DataAccessLayer.DAL_Lieferant ();
			var lieferant = dal_Lieferant.GetLieferant (id, deviceLanguage, ref user);
			return lieferant;

		} 
Beispiel #46
0
        public static async System.Threading.Tasks.Task<List<Kunde>>   GetKundenAsync( string Name ,  string deviceLanguage ,BusinessLayer.User User)
		{

			DataAccessLayer.DAL_Kunde dal_Kunde = new DataAccessLayer.DAL_Kunde ();
            var kunden =await dal_Kunde.GetKundenAsync (Name, deviceLanguage,  User);
			return kunden;

		}
Beispiel #47
0
        public static Kunde Create(string id , string deviceLanguage ,ref BusinessLayer.User user)
		{
			// das Objekt wird mit einem vorhandenen Kunden initializiert
			DataAccessLayer.DAL_Kunde dal_Kunde = new DataAccessLayer.DAL_Kunde ();
            var kunde = dal_Kunde.GetKunde (id, deviceLanguage, ref user);
			return kunde;

		} 
        public static Ansprechpartner Create(string id ,string deviceLanguage , ref BusinessLayer.User user)
		{
			// das Objekt wird mit einem vorhandenen Ansprechpartnern initializiert
			DataAccessLayer.DAL_Ansprechpartner dal_Ansprechpartner = new DataAccessLayer.DAL_Ansprechpartner ();
            var Ansprechpartner = dal_Ansprechpartner.GetAnsprechpartner (id, deviceLanguage,ref user );
			return Ansprechpartner;

		}
		public void FillControls(BusinessLayer.Person person)
		{
			TxtMainName.Text = person.Name;
			TxtMainEmail.Text = person.Email;
			TxtMainTelefon.Text = person.Telefon;
			TxtMainUmsatz.Text = person.Umsatz;

		}
Beispiel #50
0
        public static Interessent Create(string id , string deviceLanguage ,ref BusinessLayer.User user)
        {
            // das Objekt wird mit einem vorhandenen Interessenten initializiert
            DataAccessLayer.DAL_Interessent dal_Interessent = new DataAccessLayer.DAL_Interessent ();
            var interessent = dal_Interessent.GetInteressent (id, deviceLanguage, ref user);
            return interessent;

        } 
		public void TVMainRowSelected(BusinessLayer.Person person)
		{
			// Fill the main Controls of the page
			_person = person;
			FillControls (person);
			// Fill the childview controls

		}
Beispiel #52
0
 protected void AdminUserView_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     //Datakey is retrieved using AdminDoctorView.DataKeys[0].Value
     BusinessLayer businessLyerObj = new BusinessLayer();
     string connectString = ConfigurationManager.AppSettings.Get("connString");
     int index = e.RowIndex + (AdminUserView.PageIndex * 4);
     businessLyerObj.DeleteUser(AdminUserView.DataKeys[index].Value.ToString(), connectString);
 }
        public void SetControls(BusinessLayer.Artikel.StaffelPreis staffelPreis, string image)
        {

            MainImageView.Image = UIImage.FromFile(image);
            LblMengeEinheit.Text = staffelPreis.Menge + " " + staffelPreis.Einheit;
            LblDatum.Text = staffelPreis.Datum;
            LblPreis.Text = staffelPreis.Preis + " " + staffelPreis.Waehrung;
        }
        public static async System.Threading.Tasks.Task<List<Ansprechpartner>>  GetAnsprechpartnernAsync( string kundeId , string deviceLanguage, BusinessLayer.User User)
		{

			DataAccessLayer.DAL_Ansprechpartner dal_Ansprechpartner = new DataAccessLayer.DAL_Ansprechpartner ();
            var Ansprechpartnern =await dal_Ansprechpartner.GetAnsprechpartnernAsync (kundeId, deviceLanguage, User);
            return Ansprechpartnern;

		}
 private bool Changing;                                              // a flag to know if the user is able to change something or just read 
 public TransactionDialog(FragmentActivity activity,BusinessLayer.Person person, BusinessLayer.Transaction transaction, bool ChangePermission): base(activity)
 {
     _context = activity;
     _transaction = transaction;
     _person = person;
     _person.FillAddressen(Utilities.GetCurrentLanguage(MainActivity._mainActivity), MainActivity.User);
     Changing = ChangePermission;
 }
Beispiel #56
0
        public static List<Lieferant> GetLieferanten ( string name ,string deviceLanguage , BusinessLayer.User user)
		{

			// Alle Lieferantn, die in dem Namen den Begriff <name> enthalten
			DataAccessLayer.DAL_Lieferant dal_Lieferant = new DataAccessLayer.DAL_Lieferant ();
            var lieferanten = dal_Lieferant.GetLieferanten (name , deviceLanguage,ref user);
			return lieferanten;

		}
Beispiel #57
0
        public static List<Auftrag> GetAuftraege ( string kundeID, string deviceLanguage , BusinessLayer.User user)
        {

            // Alle Kunden, die in dem Namen den Begriff <name> enthalten
            DataAccessLayer.DAL_Auftrag dal_Auftrag = new DataAccessLayer.DAL_Auftrag ();
            var auftrag  = dal_Auftrag.GetAuftraege (kundeID, deviceLanguage ,ref user);
            return auftrag;

        }
		public static Task Create(string id , ref BusinessLayer.User user)
		{
			// das Objekt wird mit einem vorhandenen Kunden initializiert
			/*DataAccessLayer.DAL_Task dal_task = new DataAccessLayer.DAL_Task ();
			var task = dal_task.GetTasks (id, ref user);
			return task;*/
			return null;

		} 
        public static List<Task> GetTasks ( string kundeId ,ref BusinessLayer.User user)
		{

			// Alle Kunden, die in dem Namen den Begriff <name> enthalten
			DataAccessLayer.DAL_Task dal_Task = new DataAccessLayer.DAL_Task ();
            var tasks  = dal_Task.GetTasks (kundeId ,ref user);
			return tasks;

		}
		public static async System.Threading.Tasks.Task<List<Task>> GetTasksAsync ( string name , BusinessLayer.User user)
		{

			// Alle Kunden, die in dem Namen den Begriff <name> enthalten
			DataAccessLayer.DAL_Task dal_Task = new DataAccessLayer.DAL_Task ();
			var tasks  = await dal_Task.GetTasksAsync (name , user);
			return tasks;

		}