public InventoryViewModel()
        {
            DatabaseInteraction dbi = new DatabaseInteraction();

            Items = new ObservableCollection <Item>(dbi.GetItems());
            //generateTempData();
        }
        //This method allows the user to make a reservation on the journey
        private async void MakeReservation(object sender, EventArgs e)
        {
            DatabaseInteraction.Reserve(j.Eid, InfoExchanger.Email);
            await DisplayAlert("Votre trajet a bien été réservé", "Vous pouvez continuer vos recherches", "OK");

            await Shell.Current.Navigation.PopAsync();
        }
예제 #3
0
        public Statistics(string financialYear)
        {
            InitializeComponent();

            DataSet _dsReportDetails = new DataSet();

            dataAccess = new DatabaseInteraction(_connectionstring);

            string _sqlQuery = "AC_GetStatisticsReport";

            _dsReportDetails = dataAccess.RunSQLWithDataSet(_sqlQuery);
            if (_dsReportDetails.Tables.Count > 1)
            {
                if (_dsReportDetails.Tables[0].Rows.Count > 0) // condition is using for bind company name.
                {
                    txtCtyCompName.Value = _dsReportDetails.Tables[0].Rows[0]["CompanyName"].ToString() + " FY" + financialYear;
                    txtClsCompName.Value = _dsReportDetails.Tables[0].Rows[0]["CompanyName"].ToString() + " FY" + financialYear;
                }

                if (_dsReportDetails.Tables[1].Rows.Count > 0) // condition is using for country table.
                {
                    dtCountry.Visible    = true;
                    dtCountry.DataSource = _dsReportDetails.Tables[1];
                }

                if (_dsReportDetails.Tables[2].Rows.Count > 0) // condition is using for sub class table.
                {
                    dtSubClass.Visible    = true;
                    dtSubClass.DataSource = _dsReportDetails.Tables[2];
                }
            }
        }
예제 #4
0
        public OrdersViewModel()
        {
            DatabaseInteraction dbi = new DatabaseInteraction();

            Orders = new ObservableCollection <Order>(dbi.GetOrders());
            //generateTempData();
        }
        private void Apply(object obj)
        {
            double _sumDouble = 0;

            if (Sum != null && IsDigitsOnly(Sum))
            {
                _sumDouble = double.Parse(Sum);
            }
            if (SelectedSender != string.Empty && SelectedDestination != string.Empty && _sumDouble > 0)
            {
                foreach (var account in UserAccounts)
                {
                    if (SelectedSender == account.IBAN)
                    {
                        if (_sumDouble <= account.SumaCont)
                        {
                            DatabaseInteraction.CreateTranzaction(SelectedSender, SelectedDestination, Details, _sumDouble, "Catre utilizator");
                            DatabaseInteraction.UpdateAccounts(SelectedSender, SelectedDestination, _sumDouble);
                            PageManager.Instance.CurrentPage = new PlatiPage();
                        }
                        else
                        {
                            ErrorText = "Nu aveti bani suficienti in cont!";
                        }
                    }
                }
            }
            else
            {
                ErrorText = "Toate campurile sunt obligatorii, in afara de detalii. Suma trebuie sa fie mai mare decat 0";
            }
        }
        //This method is called when the reset password button is pressed. Once again we check if all the entries are not null
        private async void ConfirmPasswordReset(object sender, EventArgs e)
        {
            string Email  = mail.Text;
            string numtel = telephone.Text;

            bool canReset = true;

            // /!\/!\/!\/!\/!\/!\ BIEN VERIFIER QUE TOUS LES CHAMPS TEXTES NE SONT PAS NULL SOUS PEINE DE NULLPOINTEREXCEPTION /!\/!\/!\ 
            if (NewPassword.Text == null || NewPasswordConfirmation == null || mail == null || telephone == null)
            {
                IncorrectPasswordText.Text      = "Veuillez renseigner tous les champs";
                IncorrectPasswordText.TextColor = Color.Red;
                canReset = false;
            }
            else
            {
                //As in the inscription, the two passwords must be the same in the new password and the confirmation entry
                if (NewPassword.Text != NewPasswordConfirmation.Text)
                {
                    IncorrectPasswordText.Text      = "Les deux mots de passes que vous avez entrés ne se correspondent pas, veuillez réessayer";
                    IncorrectPasswordText.TextColor = Color.Red;
                    canReset = false;
                }
                //The password's length cant be 0
                if (NewPassword.Text.Length == 0)
                {
                    IncorrectPasswordText.Text      = "Votre mot de passe a une longueur de 0, veuillez rentrer un mot de passe plus long";
                    IncorrectPasswordText.TextColor = Color.Red;
                    canReset = false;
                }
                //The mail must contain an @
                if (!(mail.Text.Contains("@")))
                {
                    IncorrectPasswordText.Text      = "Votre adresse email a un format invalide. (il manque un @)";
                    IncorrectPasswordText.TextColor = Color.Red;
                    canReset = false;
                }
                //The phone must contain 10 digits
                if (telephone.Text.Length != 10)
                {
                    IncorrectPasswordText.Text      = "Votre numéro de téléphone ne fait pas 10 chiffres, veuillez réessayer";
                    IncorrectPasswordText.TextColor = Color.Red;
                    canReset = false;
                }
                //The email and phone must both match
                if (!(DatabaseInteraction.CheckEmailAndPhone(Email, numtel)))
                {
                    IncorrectPasswordText.Text      = "Aucun lien entre l'adresse mail et le mot de passe, veuillez réessayer";
                    IncorrectPasswordText.TextColor = Color.Red;
                    canReset = false;
                }
            }
            if (canReset)
            {
                DatabaseInteraction.ChangePassword(Email, NewPassword.Text);
                await DisplayAlert("Réinitialisation du mot de passe", "Votre mot de passe a bien été changé", "OK");

                await Shell.Current.Navigation.PopAsync();
            }
        }
예제 #7
0
 private static string PrivateKeySelect(string publicKey)
 {
     try
     {
         SqlParameter[] param =
         {
             new SqlParameter {
                 ParameterName = "@PrivateKey", Direction = System.Data.ParameterDirection.Output, SqlDbType = System.Data.SqlDbType.VarChar
             },
             DatabaseInteraction.CreateOutputParameter("@ReturnCode")
         };
         SqlParameterCollection collection = DatabaseInteraction.ExecuteCommand("uspWebServicePrivateKeySelect", param);
         int ReturnCode = Convert.ToInt32(collection["@ReturnCode"]);
         if (ReturnCode == 0)
         {
             return(collection["@PrivateKey"].ToString());
         }
         return(null);
     }
     catch (Exception ex)
     {
         Error.InsertException(ex.ToXml(), -1);
         throw ex;
     }
 }
예제 #8
0
        /**
         * Sets whether a (dataTYpeId, companyId) tuple is enabled. This is done by hashset removal or addition, but
         * this is a useful abstraction
         */
        public async void SetEnabled(int dataTypeId, int companyId, bool setting)
        {
            IdPair idPair = new IdPair()
            {
                data_type = dataTypeId, enterprise = companyId
            };

            if (setting && !InEnabledSet(dataTypeId, companyId))
            {
                enabledSet.Add(idPair); //update the value locally
                //update the value on the server
                var jsonString  = JsonConvert.SerializeObject(idPair);
                var jsonContent = new StringContent(jsonString, Encoding.UTF8, "application/json");
                await DatabaseInteraction.SendDatabaseRequest(DatabaseInteraction.DatabaseRequest.ALLOW_PERMISSION,
                                                              DatabaseInteraction.HttpRequestType.POST, jsonContent, true, true);

                //error checking done in the request
            }
            else if (!setting && InEnabledSet(dataTypeId, companyId))
            {
                enabledSet.Remove(idPair);
                //update the value on the server
                var jsonString  = JsonConvert.SerializeObject(idPair);
                var jsonContent = new StringContent(jsonString, Encoding.UTF8, "application/json");
                await DatabaseInteraction.SendDatabaseRequest(DatabaseInteraction.DatabaseRequest.DENY_PERMISSION,
                                                              DatabaseInteraction.HttpRequestType.POST, jsonContent, true, true);

                //error checking done in the request
            }
        }
예제 #9
0
        public IActionResult GetPostingByName(string Name)
        {
            DatabaseInteraction dbObj   = new DatabaseInteraction();
            TodoJobPosting      posting = dbObj.GetPostingByName(Name);

            return(new ObjectResult(posting));
        }
예제 #10
0
        public IActionResult CreateJobPosting(string JobTitle,
                                              string Company,
                                              string Location,
                                              string Description,
                                              string[] Keywords,
                                              string[][] UserAndScore)
        {
            Console.WriteLine("Inside CreateJobPosting");
            string name  = JobTitle;
            string comp  = Company;
            string loc   = Location;
            string descr = Description;

            string[]   keywords     = Keywords;     // new string[] { "ect" };// Keywords;
            string[][] userAndScore = UserAndScore; //= new string[UserAndScore.Length, 2];// = UserAndScore;// new string[] { "ect" };// Keywords;

            DatabaseInteraction dbObj = new DatabaseInteraction();

            var posting = new TodoJobPosting
            {
                JobTitle     = name,
                Company      = comp,
                Location     = loc,
                Description  = descr,
                Keywords     = keywords, // keywords
                UserAndScore = userAndScore
            };

            dbObj.CreateNewJobPosting(posting);
            return(new ObjectResult(posting));
        }
예제 #11
0
        public IActionResult CreateNewStudent(string Name,
                                              string PhoneNumber,
                                              string Email,
                                              string Password,
                                              string UserType,
                                              string[] Resume)
        {
            //Console.WriteLine("Before building student");
            string name        = Name;
            string phoneNumber = PhoneNumber;
            string email       = Email;
            string password    = Password;
            string userType    = UserType;

            string[] res = Resume;        // new string[] { "ect" };// Keywords;
            Console.WriteLine("Before building student");
            var student = new TodoStudent
            {
                Name        = name,
                PhoneNumber = phoneNumber,
                Email       = email,
                Password    = password,
                UserType    = userType,
                Resume      = res
            };
            DatabaseInteraction dbObj = new DatabaseInteraction();

            Console.WriteLine("Before CreatNewCandidate");
            dbObj.CreateNewCandidate(student);
            return(new ObjectResult(student));
        }
예제 #12
0
 public override bool ValidateUser(string userName, string password)
 {
     //return true;
     try
     {
         string Hash = string.Empty;
         Hash = CalculateHashedPassword(password);
         SqlParameter[] param =
         {
             DatabaseInteraction.CreateOutputParameter("@ReturnCode"),
             new SqlParameter("@UserName",                            userName),
             new SqlParameter("@Password",                            Hash)
         };
         SqlParameterCollection results = DatabaseInteraction.ExecuteCommand("uspServiceUserValidate", param);
         int ReturnCode = Convert.ToInt32(results["@ReturnCode"].Value);
         //System.IO.File.WriteAllLines(@"C:\inetpub\wwwroot\ReturnCode.txt", new string[] { ReturnCode.ToString() });
         if (ReturnCode == 0)
         {
             //System.IO.File.WriteAllLines(@"C:\inetpub\wwwroot\ReturnCode2.txt", new string[] { ReturnCode.ToString() });
             return(true);
         }
         //System.IO.File.WriteAllLines(@"C:\inetpub\wwwroot\ReturnCode3.txt", new string[] { ReturnCode.ToString() });
         return(false);
     }
     catch (Exception ex)
     {
         //System.IO.File.WriteAllLines(@"C:\inetpub\wwwroot\Error.txt", new string[] { ex.Message, ex.StackTrace });
         return(false);
     }
 }
예제 #13
0
        private void InitializeConstellationFilters()
        {
            var dbResult = new DatabaseInteraction().GetConstellations(new System.Threading.CancellationToken());
            var list     = new AsyncObservableCollection <string>(dbResult.Result);

            list.Insert(0, string.Empty);
            Constellations = list;
        }
예제 #14
0
        public IActionResult GetByEmail(string Email)
        {
            DatabaseInteraction dbObj = new DatabaseInteraction();

            TodoStudent user = dbObj.GetUserByEmail(Email);

            return(new ObjectResult(user));
        }
예제 #15
0
 public SkyMapAnnotator(ITelescopeMediator mediator)
 {
     this.telescopeMediator   = mediator;
     dbInstance               = new DatabaseInteraction();
     DSOInViewport            = new List <FramingDSO>();
     ConstellationsInViewport = new List <FramingConstellation>();
     FrameLineMatrix          = new FrameLineMatrix2();
     ConstellationBoundaries  = new Dictionary <string, ConstellationBoundary>();
 }
예제 #16
0
        //This method is called when the journey is ready to be researched in the database. As for the Inscription page, all entries musnt be null
        private void Validate(object sender, EventArgs e)
        {
            bool canValidate = true;

            if (AddDep.Text == null || AddArr.Text == null || DepartureTime == null || ArrivalTime == null || DepartureDay == null || ArrivalDay == null)
            {
                Error.Text  = "Veuillez renseigner tous les champs";
                canValidate = false;
            }
            else
            {
                //We check if both departure and arrival cities exists in the database
                if (!DatabaseInteraction.DoesCityExist(AddDep.Text.ToUpper()))
                {
                    Error.Text  = "La ville de " + AddDep.Text + " n'existe pas dans notre base";
                    canValidate = false;
                }
                if (!DatabaseInteraction.DoesCityExist(AddArr.Text.ToUpper()))
                {
                    Error.Text  = "La ville de " + AddArr.Text + " n'existe pas dans notre base";
                    canValidate = false;
                }
                //We check that the hour of arrival is later than the the hour of departure
                if (DepartureTime.Time.Hours >= ArrivalTime.Time.Hours)
                {
                    Error.Text  = "Veuillez renseigner une heure d'arrivée après celle de départ";
                    canValidate = false;
                }
                //If the hour of arrival is the same as the our of departure, we check that the minutes given are different
                if (DepartureTime.Time.Hours == ArrivalTime.Time.Hours && DepartureTime.Time.Minutes > ArrivalTime.Time.Minutes)
                {
                    Error.Text  = "Veuillez renseigner une heure d'arrivée après celle de départ";
                    canValidate = false;
                }
                //If all the tests passed, the journey can be reserved and the interaction with the database can be done
                if (canValidate)
                {
                    Error.Text = "";
                    //From here all the given dates are transformed to match the database format, ie. "yyyy-MM-dd HH:mm:ss"
                    TimeSpan departureTime = DepartureTime.Time;
                    TimeSpan arrivalTime   = ArrivalTime.Time;
                    DateTime departureDate = DepartureDay.Date;
                    DateTime arrivalDate   = ArrivalDay.Date;
                    //string depTime = departureDate.Year + "-" + departureDate.Month.ToString("dd") + "-" + departureDate.Day.ToString("dd") + " " + departureTime.Hours.ToString("dd") + ":" + departureTime.Minutes.ToString("dd") + ":" + departureTime.Seconds.ToString("dd");
                    string depDate  = departureDate.ToString("yyyy-MM-dd");
                    string depTime  = departureTime.ToString();
                    string finalDep = depDate + " " + depTime;

                    //string arrTime = arrivalDate.Year + "-" + arrivalDate.Month.ToString("dd") + "-" + arrivalDate.Day.ToString("dd") + " " + arrivalTime.Hours.ToString("dd") + ":" + arrivalTime.Minutes.ToString("dd") + ":" + arrivalTime.Seconds.ToString("dd");
                    string arrDate  = arrivalDate.ToString("yyyy-MM-dd");
                    string arrTime  = arrivalTime.ToString();
                    string finalArr = arrDate + " " + arrTime;
                    Result = DatabaseInteraction.SearchJourney(AddDep.Text.ToUpper(), AddArr.Text.ToUpper(), finalDep, finalArr);
                    ResearchDisplay.ItemsSource = Result;
                }
            }
        }
예제 #17
0
        public async Task <DateTime> GetLastAvailableEarthRotationParameterDate()
        {
            long availableDataTimeStamp = 0;

            using (var context = new DatabaseInteraction().GetContext()) {
                availableDataTimeStamp = (await context.EarthRotationParameterSet.Where(x => x.lod != 0).OrderByDescending(x => x.date).FirstAsync()).date;
            }
            return(Utility.UnixTimeStampToDateTime(availableDataTimeStamp));
        }
예제 #18
0
        //This method handles the validation process of a journey. It checks if it is valid, and if it is, registers it into the database. If it isn't, an error message appears for the user, indicating what he must change.
        private async void Valider(object sender, EventArgs e)
        {
            //First check : the user must fill the values
            if (depAd.Text == null || arrAd.Text == null || pasNum == null || depVil == null || arrVil == null || disNum == null)
            {
                depAd.PlaceholderColor  = Color.PaleVioletRed;
                arrAd.PlaceholderColor  = Color.PaleVioletRed;
                depVil.PlaceholderColor = Color.PaleVioletRed;
                arrVil.PlaceholderColor = Color.PaleVioletRed;
                pasNum.PlaceholderColor = Color.PaleVioletRed;
                disNum.PlaceholderColor = Color.PaleVioletRed;
                await DisplayAlert("Erreur", "Veuillez remplir tous les champs.", "OK");

                return;
            }
            //Second check : the cities must exist
            if (!DatabaseInteraction.DoesCityExist(depVil.Text) || !DatabaseInteraction.DoesCityExist(arrVil.Text))
            {
                await DisplayAlert("Erreur", "Une des villes entrées n'existe pas.", "OK");

                return;
            }

            int passengers = 0;
            int km         = 0;

            try
            {
                passengers = int.Parse(pasNum.Text);
                km         = int.Parse(disNum.Text);
            }
            catch
            {
                await DisplayAlert("Erreur", "Les champs \"Passagers\" et/ou \"KM\" sont incorrects.", "OK");

                return;
            }

            Journey j = new Journey(0, depAd.Text, depVil.Text.ToUpper(), arrAd.Text, arrVil.Text.ToUpper(), DepartureDate.Date.ToString("yyyy-MM-dd") + " " + DepartureTime.Time.ToString(), ArrDate.Date.ToString("yyyy-MM-dd") + " " + ArrTime.Time.ToString(), km, passengers, comm.Text, dog.BackgroundColor == Color.Green, smoke.BackgroundColor == Color.Green, music.BackgroundColor == Color.Green, talk.BackgroundColor == Color.Green);

            try
            {   //Third check : the user must be an existing one on the database
                if (DatabaseInteraction.CheckIfClientExist(InfoExchanger.Email))
                {
                    DatabaseInteraction.ProposeNewJourney(InfoExchanger.Email, j);
                    await DisplayAlert("Trajet ajouté", "Votre trajet a bien été pris en compte", "OK");

                    depAd.Text          = ""; arrAd.Text = ""; DepartureTime.Time = DateTime.Now.TimeOfDay; pasNum.Text = ""; comm.Text = ""; depVil.Text = ""; arrVil.Text = ""; disNum.Text = "";
                    dog.BackgroundColor = Color.Green; smoke.BackgroundColor = Color.Green; music.BackgroundColor = Color.Green; talk.BackgroundColor = Color.Green;
                }
                else
                {
                    await DisplayAlert("Erreur de connexion", "Il semblerait que vous n'êtes pas connecté à un compte existant. Vérifiez et réessayez.", "OK");
                }
            }   //If something goes wrong with the databse, we display an alert popup to the user
            catch (Exception ex) { DatabaseInteraction.ConnectionCloser(); await DisplayAlert("Erreur de traitement", "Une erreur est survenue pendant le traitement de votre requête. Vérifiez que vous soyez connecté.", "OK"); }
        }
예제 #19
0
        private void InitializeObjectTypeFilters()
        {
            var task = new DatabaseInteraction().GetObjectTypes(new System.Threading.CancellationToken());
            var list = task.Result?.OrderBy(x => x).ToList();

            foreach (var type in list)
            {
                ObjectTypes.Add(new DSOObjectType(type));
            }
        }
예제 #20
0
        public NewOrderViewModel()
        {
            DatabaseInteraction dbi = new DatabaseInteraction();

            Purchaser     = new ObservableCollection <User>(dbi.GetUsers());
            ItemComboBox  = new ObservableCollection <Item>(dbi.GetItems());
            NewOrderItems = new ObservableCollection <OrderItem>();
            PurchaseDate  = DateTime.Today;
            GetOrderNumber();
            OrderTotal = 0.0M;
        }
예제 #21
0
        public IActionResult AddResumeToPosting(string Email,
                                                string JobTitle
                                                )
        {
            DatabaseInteraction dbObj = new DatabaseInteraction();

            TodoJobPosting posting = dbObj.GetPostingByName(JobTitle);
            TodoStudent    stu     = dbObj.GetUserByEmail(Email);

            dbObj.SubmitResumeToJob(posting, stu);

            return(new ObjectResult(posting));
        }
 public override string[] GetAllRoles()
 {
     try
     {
         DataSet ds = DatabaseInteraction.ExecuteStoredProc("uspServiceRoleSelect");
         IEnumerable <string> list = ds.Tables[0].AsEnumerable().Select(r => r.Field <string>("RoleName"));
         return(list.ToArray());
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
        public NonTradeDNVoucher(string type, string refNo, string _taxType = "")
        {
            InitializeComponent();
            _connectionString = System.Configuration.ConfigurationManager.AppSettings["DBConnectionString"];
            DatabaseInteraction _dataAccess = new DatabaseInteraction(_connectionString);
            DataSet             _ds         = new DataSet();

            //DataTable _dt = null;
            _ds = _dataAccess.RunSQLWithDataSet("AC_SQLREPORT_CompanyDetails");
            if (_ds != null && _ds.Tables[0].Rows.Count > 0)
            {
                clientLogo.Value           = ReportsUtility.ClientLogo;
                pictureBox1.Value          = ReportsUtility.OrinialStamp;
                txtClientCompanyName.Value = _ds.Tables[0].Rows[0]["CompName"].ToString().ToUpper();
                //clientLogo.Style.BackgroundImage = "../BIB/Logo/BIB.png";
                txtAccountFor.Value  = "MISC DEBIT NOTE";
                txtPrintedDate.Value = DateTime.Now.ToString("dd MMM yyyy");
                lblmpNoticeP3.Value  = "3.  All cheques should be crossed and made payable to " + _ds.Tables[0].Rows[0]["CompName"].ToString().ToUpper() + ".";
            }


            _ds = _dataAccess.RunSQLWithDataSet("AC_SQLREPORT_GetVoucherMain  '" + type + "','" + refNo + "'");
            if (_ds != null && _ds.Tables[0].Rows.Count > 0)
            {
                txtInvoiceNo.Value   = _ds.Tables[0].Rows[0]["DrCrNo"].ToString();
                txtInvoiceDate.Value = _ds.Tables[0].Rows[0]["DrCrDate"].ToString();
                txtAccountCode.Value = _ds.Tables[0].Rows[0]["CusM_ID"].ToString();
                txtClientName.Value  = _ds.Tables[0].Rows[0]["CusM_Name"].ToString();
                txtAddr1.Value       = _ds.Tables[0].Rows[0]["CusM_Address1"].ToString();
                txtAddr2.Value       = _ds.Tables[0].Rows[0]["CusM_Address2"].ToString();
                txtAddr3.Value       = _ds.Tables[0].Rows[0]["CusM_Address3"].ToString();
                txtAddr4.Value       = _ds.Tables[0].Rows[0]["CusM_Address4"].ToString();

                tblVoucher.DataSource = _ds.Tables[0];
                if (_taxType.ToUpper() == "SST")
                {
                    txtGSTRate.Value          = String.Empty;
                    txtCreditGSTBalance.Value = String.Empty;
                }
                else
                {
                    txtGSTRate.Value          = _ds.Tables[1].Rows[0]["CreditGSTRate"].ToString();
                    txtCreditGSTBalance.Value = _ds.Tables[1].Rows[0]["CreditGSTBalance"].ToString();
                    if (txtCreditGSTBalance.Value == "0.00")
                    {
                        txtCreditGSTBalance.Value = String.Empty;
                    }
                }
                txtTotalAmountDue.Value = Convert.ToDecimal(_ds.Tables[1].Rows[0]["TotalAmount"].ToString()).ToString("n2");
            }
        }
예제 #24
0
        public void ReturnPlata(object obj)
        {
            NumePlata = string.Empty;
            PlataSalvata returnPlata = new PlataSalvata();

            if (SearchBar != string.Empty)
            {
                returnPlata = DatabaseInteraction.GetPlata(SearchBar.ToString());
                if (returnPlata != null)
                {
                    NumePlata = returnPlata.NumePlata;
                    ToSave    = returnPlata;
                }
            }
        }
예제 #25
0
        //This methods allows us to interact with the database and to display the journeys the user proposed or reserved
        private void DisplayJourney()
        {
            ReservedJourney = new List <Journey>();
            ProposedJourney = new List <Journey>();


            if (InfoExchanger.IsAuthentified)
            {
                ReservedJourney = DatabaseInteraction.GetReservedJourneyList(Client.Email);
                ProposedJourney = DatabaseInteraction.GetProposedJourneyList(Client.Email);
            }

            ReservedView.ItemsSource = ReservedJourney;
            ProposedView.ItemsSource = ProposedJourney;
        }
 public override string[] GetRolesForUser(string username)
 {
     try
     {
         SqlParameter[] param =
         {
             new SqlParameter("@UserName", username)
         };
         DataSet ds = DatabaseInteraction.ExecuteStoredProc("uspServiceUserRoleSelect", param);
         IEnumerable <string> list = ds.Tables[0].AsEnumerable().Select(r => r.Field <string>("RoleName"));
         return(list.ToArray());
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
 public override bool IsUserInRole(string username, string roleName)
 {
     try
     {
         SqlParameter[] param =
         {
             new SqlParameter("@UserName", username),
             new SqlParameter("@RoleName", roleName)
         };
         DataSet ds = DatabaseInteraction.ExecuteStoredProc("uspRoleSelectByServiceUserName", param);
         return(ds.Tables[0].Rows.Count > 0);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
예제 #28
0
        private void DoIt(object obj)
        {
            double _sumDouble = 0;

            if (Sum != null && IsDigitsOnly(Sum))
            {
                _sumDouble = double.Parse(Sum);
            }
            if (SelectedAccount != string.Empty && FurnizorIBAN != string.Empty && _sumDouble > 0)
            {
                foreach (var account in MasterUserAccounts)
                {
                    if (SelectedAccount == account.IBAN)
                    {
                        if (_sumDouble <= account.SumaCont)
                        {
                            foreach (var furnizor in Furnizors)
                            {
                                if (furnizor.NumeFurnizor == SelectedName)
                                {
                                    foreach (var abonat in furnizor.CoduriAbonati)
                                    {
                                        if (abonat == CodAbonat)
                                        {
                                            DatabaseInteraction.CreateTranzaction(SelectedAccount, FurnizorIBAN, Details, _sumDouble, "Catre furnizor");
                                            DatabaseInteraction.UpdateAccounts(SelectedAccount, null, _sumDouble);
                                            PageManager.Instance.CurrentPage = new PlatiPage();
                                            return;
                                        }
                                    }
                                    ErrorText = "Nu sunteti abonat la acest furnizor!";
                                }
                            }
                        }
                        else
                        {
                            ErrorText = "Nu aveti bani suficienti in cont!";
                        }
                    }
                }
            }
            else
            {
                ErrorText = "Toate campurile sunt obligatorii, in afara de detalii. Suma trebuie sa fie mai mare decat 0";
            }
        }
예제 #29
0
        private void DoIt(object obj)
        {
            double _sumDouble = 0;

            if (Sum != null && IsDigitsOnly(Sum))
            {
                _sumDouble = double.Parse(Sum);
            }
            if (SelectedAccount != string.Empty && FurnizorIBAN != string.Empty && _sumDouble > 0)
            {
                foreach (var account in MasterUserAccounts)
                {
                    if (SelectedAccount == account.IBAN)
                    {
                        if (_sumDouble <= account.SumaCont)
                        {
                            foreach (var furnizor in Furnizors)
                            {
                                if (furnizor.NumeFurnizor == SelectedName)
                                {
                                    foreach (var abonat in furnizor.CoduriAbonati)
                                    {
                                        if (abonat == CodAbonat)
                                        {
                                            DatabaseInteraction.AddPlataPlanificataFurnizor(FurnizorIBAN, _sumDouble, DateTime.Today, Int32.Parse(SelectedFrequency), SelectedAccount);
                                            PageManager.Instance.CurrentPage = new ListaPlatiRecurentePage();
                                            return;
                                        }
                                    }
                                    ErrorText = "Nu sunteti abonat la acest furnizor!";
                                }
                            }
                        }
                        else
                        {
                            ErrorText = "Nu aveti bani suficienti in cont!";
                        }
                    }
                }
            }
            else
            {
                ErrorText = "Toate campurile sunt obligatorii, in afara de detalii. Suma trebuie sa fie mai mare decat 0";
            }
        }
예제 #30
0
 public static List <User> ListUsers()
 {
     try
     {
         SqlParameter[] param =
         {
             new SqlParameter("@UserID", Convert.ToInt32(0))
         };
         DataSet ds = DatabaseInteraction.ExecuteStoredProc("uspUserSelect", param);
         return(ConvertToObject(ds.Tables[0]));
     }
     catch (Exception ex)
     {
         //You would do error handling here.
         //throw new Exception("Your friendly neighborhood error message.");
         throw ex;
     }
 }