public ActionResult Login(Login_Data LD)
        {
            if (ModelState.IsValid)
            {

                Service1Client client = new Service1Client();
                LoginData auth = new LoginData();
                auth.Email = LD.Email;
                auth.Password = LD.Password;
                if (client.AuthenticateUser(auth))
                {
                    Session["Email"] = LD.Email;
                    return index();
                }
                else
                {
                    string error_message = "Wrong Email or Password";
                    ViewBag.LoginError = error_message;
                    return View();
                }

            }
            else
            {
                return View();
            }
        }
        // GET: Jerarquia
        public ActionResult AddJefe()
        {
            if (Session["User"] != null)
            {
                Service1Client client = new Service1Client();
                var query = client.getTbl_usuarios();
                List<string> emple = new List<string>();
                foreach (var item in query)
                {
                    emple.Add(item.primer_nombre + " " + item.primer_apellido + "|" + item.talento_humano);
                }
                ViewBag.Empleados = emple;

                var quer = client.getTbl_departamentos();
                List<string> depto = new List<string>();
                foreach (var item in quer)
                {
                    depto.Add(item.descripcion+ "|" + item.departamentoid);
                }
                client.Close();
                ViewBag.Empleados = emple;
                ViewBag.Departamentos = depto;

                return View();
            }

            else
                return RedirectToAction("Login", "Home");
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            Service1Client ip = new Service1Client();
            int t1 = 0;
            string name = null;
            string t = TextBox1.Text;         //Stores the input string

            if (t.Trim() == "" || t.Trim() == "." || t.Trim() == "-")
            {

                RegisterStartupScript("startupScript", "<script language=JavaScript>alert('Please enter a valid ZipCode or Address');</script>");

            }
            else
            {
                string d = String.Join("", ip.GetData(name,t,t1));
                if (string.IsNullOrEmpty(d))     //If no store available
                {
                    Label4.Text = "No station available";
                    //ViewState["Acc"] = 1;
                }
                else
                {
                    Label4.Text = d;
                   // ViewState["Acc"] = 1;
                }
            }
        }
Beispiel #4
0
 private void SaveButton_Click(object sender, EventArgs e)
 {
     List<Car> a = new List<Car>();
     Car b = new Car();
     Service1Client client = new Service1Client();
     bool success = true;
     for(int i=0; i<Table1.RowCount-1; i++)
     {
         try
         {
             b.manufacturer = (string)Table1.Rows[i].Cells[0].Value;
             b.model = (string)Table1.Rows[i].Cells[1].Value;
             b.dat = DateTime.Parse((string)Table1.Rows[i].Cells[2].Value);
             string str = (string)Table1.Rows[i].Cells[3].Value;
             str = str.Replace('.', ',');
             b.volume = double.Parse(str);
             b.power = Int32.Parse((string)Table1.Rows[i].Cells[4].Value);
             b.trancemission = (string)Table1.Rows[i].Cells[5].Value;
             a.Add(b);
             b = new Car();
         }
         catch (Exception ex) { MessageBox.Show(ex.Message+" в строке "+ (i+1)); success = false; }
     }
     if (success)
         if (client.save(a.ToArray()))
             MessageBox.Show("сохранение успешно");
         else MessageBox.Show("что то пошло не так");
     else MessageBox.Show("сохранение работает только если нет ошибок в таблице");
 }
        protected void Button2_Click(object sender, EventArgs e)
        {
            int t3 = 1;

            if (Label4.Text==null)
            {
                RegisterStartupScript("startupScript", "<script language=JavaScript>alert('Please find the Bus stations first....');</script>");
            }
            Service1Client ip1 = new Service1Client();
            string t1 = TextBox1.Text;
            string t2 = TextBox2.Text;         //Stores the input string
            string d=null;
            if (t2.Trim() == "" || t2.Trim() == "." || t2.Trim() == "-")
            {
                RegisterStartupScript("startupScript", "<script language=JavaScript>alert('Please enter a valid name from the list');</script>");
            }
            else
            {
                 d = String.Join("", ip1.GetData(t2,t1,t3));
            }
            if (string.IsNullOrEmpty(d))     //If no store available
            {
                Label6.Text = "No station available";

            }
            else
            {
                Label6.Text = d;

            }
        }
        public ActionResult Eventos(EventosModel calendario)
        {
            if (Session["User"] != null)
            {
                if (ModelState.IsValid)
                {
                    Service1Client client = new Service1Client();
                    client.addTipo_dia(calendario.descripcion);
                    List<string> fecha = splitCadenaID(calendario.Fecha);
                    calendario.Tipo_dia_id = client.getultimoid_tipodia();
                    int talento = int.Parse(Session["Talento_Humano"].ToString());

                    foreach (var item in fecha)
                    {
                        string fechas = getFecha(item);
                        client.addCalendario(talento,fechas, calendario.Tipo_dia_id);

                    }
                   client.Close();
                }
                return View();
            }
            else
            {
                return RedirectToAction("Login", "Home");
            }
        }
        public ActionResult JSonEvento()
        {
            string json = "";
            Service1Client client = new Service1Client();
            var query = client.get_eventos();

            if (query == null)
            {
                json += "{" + String.Format("\"descripcion\":\"{0}\",\"fecha\":\"{1}\"", "0", "Null") + "}";
                json = "{\"draw\": 1,\"recordsTotal\": 1,\"recordsFiltered\": 1,\"data\": [" + json + "]}";
                return Content(json);
            }
            for (int i = 0; i < query.Count(); i++)
            {
                var f = client.get_fecha_eventos(query.ElementAt(i));
                List<string> fechas = new List<string>();
                foreach (var item in f) {
                    fechas.Add(item);
                }
                string cadenaf = concatenar_fechas(fechas);
                if (!json.Equals("")) { json += ","; }
                json += "{" + String.Format("\"descripcion\":\"{0}\",\"fecha\":\"{1}\"", query.ElementAt(i), cadenaf) + "}";
            }

            json = "{\"draw\": 1,\"recordsTotal\": 1,\"recordsFiltered\": 1,\"data\": [" + json + "]}";
            return Content(json);
        }
Beispiel #8
0
        static void Main(string[] args)
        {
            //wcf

            IUtilsService iu = new UtilsServiceClient();
            iu.DoWork("a");

            IService1 i1 = new Service1Client();
            i1.DoWork();
            //ITestSrvice

            //CommonHelper.DES des = new CommonHelper.DES();
            //string key = des.GenerateKey();
            //string s0 = "中国软件 - csdn.net";
            //string s1 = des.EncryptString(s0, key);

            //string key1 = des.GenerateKey();

            //string s2 = des.DecryptString(s1, key);

            //var result= System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile("12345678", "MD5");

            //var ss = result == "25d55ad283aa400af464c76d713c07ad".ToUpper();

            //ThreadPool.QueueUserWorkItem(new WaitCallback(o => { Write(); }));

            //ThreadPool.QueueUserWorkItem(new WaitCallback(o => { Read(); }));

            //IUtilsService svic = new UtilsServiceClient();
            //svic.DoWork("cipher_by_randy");
            var sss = "qerqwerwqr".GetHashCode();
            var sss1 = "qerqwerwqr".GetHashCode();
            var q1 = "1".GetHashCode();
            Console.ReadLine();
        }
    /*
    protected void GridBagla(int FirmaId)
    {
        //rdgvFairmadanGelenIstekler.DataSource = spFirmaIDdenIstekleriDon(FirmaId);
        //rdgvFairmadanGelenIstekler.DataBind();
        using (Service1Client client = new Service1Client())
        {
            rdgvFairmadanGelenIstekler.DataSource = client.FirmaIddenFirmayaAitIstekleriDon(FirmaId);
            rdgvFairmadanGelenIstekler.DataBind();
        }
    }
     */
    protected void GridBagla(int FirmaId,int Yil, int IstekNo)
    {
        using (Service1Client client = new Service1Client())
        {
            //if (txtFilterYil.Text.Trim() == string.Empty && txtFilterIstekNo.Text.Trim() == string.Empty)//Tüm istekler
            //    rdgvFairmadanGelenIstekler.DataSource = client.FirmaIddenFirmayaAitIstekleriDon(FirmaId);
            //if (txtFilterYil.Text.Trim() != string.Empty && txtFilterIstekNo.Text.Trim() == string.Empty)//Belli bir yıl
            //    rdgvFairmadanGelenIstekler.DataSource = client.FirmaIDdenFirmadanGelenIstekleriDonGenel(FirmaId,int.Parse(txtFilterYil.Text),0);
            //if (txtFilterYil.Text.Trim() != string.Empty && txtFilterIstekNo.Text.Trim() == string.Empty)//Belli bir yıl ve belli bir istekno
            //    rdgvFairmadanGelenIstekler.DataSource = client.FirmaIDdenFirmadanGelenIstekleriDonGenel(FirmaId, int.Parse(txtFilterYil.Text), int.Parse(txtFilterIstekNo.Text));

            //int Yil = 0;
            //int IstekNo = 0;
            if (txtFilterYil.Text.Trim() != string.Empty)
            {
                Yil = int.Parse(txtFilterYil.Text.Trim());
            }
            else
            {
                Yil = 0;
            }
            if (txtFilterIstekNo.Text.Trim() != string.Empty)
            {
                IstekNo = int.Parse(txtFilterIstekNo.Text.Trim());
            }
            else
            {
                IstekNo = 0;
            }
            int FirmID = int.Parse(Session["IstekleriGosterilecekFirmaId"].ToString());
            rdgvFairmadanGelenIstekler.DataSource = client.FirmaIDdenFirmadanGelenIstekleriDonGenel(FirmID, Yil,IstekNo);

            rdgvFairmadanGelenIstekler.DataBind();
        }
    }
		public ConvidarEvento()
		{
			InitializeComponent();
			ws = new Service1Client();
			ws.EventoAbrirCompleted += Ws_EventoAbrirCompleted;
			ws.EventoConvidarParticipanteCompleted += Ws_EventoConvidarParticipanteCompleted;
		}
 private void inputButton_Click(object sender, RoutedEventArgs e)
 {
     string str = inputbox.Text;
     Service1Client client1 = new Service1Client();
     client1.SeePatientDataCompleted += new EventHandler<SeePatientDataCompletedEventArgs>(client1_SeePatientDataCompleted);
     client1.SeePatientDataAsync(str);
 }
Beispiel #12
0
 static void Main(string[] args)
 {
     Service1Client prx = new Service1Client();
     byte[] buf = prx.getBytes(100);
     foreach (byte b in buf)
         Console.Write("{0:x} ", b);
 }
Beispiel #13
0
        protected void ach_Click(object sender, EventArgs e)
        {
            int compostAchievemetn = Convert.ToInt32(txtVan.Text);
            int showPowAchievement = Convert.ToInt32(txtTruck.Text);
            int teleAchievement = Convert.ToInt32(txtBus.Text);
            int forestSaverAch = Convert.ToInt32(TextBox2.Text);
            int cruisAch = Convert.ToInt32(TextBox3.Text);
            int profid = Convert.ToInt32(Session["id"]);

            int addCompost = Convert.ToInt32(compost.Text);
            int sumCompost = addCompost + compostAchievemetn;
            int addShowPow = Convert.ToInt32(shower.Text);
            int sumShowPow = showPowAchievement + addShowPow;
            int addTele = Convert.ToInt32(telecommute.Text);
            int sumTele = teleAchievement + addTele;
            int addForest = Convert.ToInt32(forest.Text);
            int sumForest = forestSaverAch + addForest;
            int addCruis = Convert.ToInt32(cruise.Text);
            int sumCruise = cruisAch + addCruis;

            Service1Client datamine = new Service1Client();
            datamine.updateAchievements(profid, 2212, sumCompost.ToString());
            datamine.updateAchievements(profid, 3234, sumShowPow.ToString());
            datamine.updateAchievements(profid, 3333, sumTele.ToString());
            datamine.updateAchievements(profid, 6666, sumForest.ToString());
            datamine.updateAchievements(profid, 7777, sumCruise.ToString());
            Response.Redirect("~/Pages/UserPage.aspx#Link2");
        }
 public CustomTaskManager()
 {
     fastClient = new Service1Client();
     slowClient = new ToDoManagerClient();
     items = new List<IToDoItem>();
     isAdded = false;
 }
Beispiel #15
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            var Cl = new Service1Client();
            Cl.CreateTask(this.Description.Text, this.DropDownListWorkers.Text, int.Parse(this.DropDownListTools.Text), DateTime.Now);

            Description.Text = "";
        }
    protected void grdFaturaTarihce_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem dataItem = e.Item as GridDataItem;

            using (Service1Client proxy = new Service1Client())
            {
                if (!proxy.IstIdDahaOnceBolunmusBirFaturaKapsaminaAlinmimi(int.Parse(dataItem["ISTID"].Text)))
                {
                    dataItem["Cikart"].Enabled = false;
                    dataItem["Cikart"].ToolTip = "Bölünmüş fatura kapsamında değil. Çıkartma işlemi yapılamaz!";
                }
            }

            if (dataItem["EkBolgemi"].Text == "False")
            {
                dataItem["EkBolgemi"].BackColor = System.Drawing.Color.Bisque;
                dataItem["EkBolgemi"].Text = "Hayır";
                dataItem["EkBolgemi"].ToolTip = "Ek bölge değil";
            }
            if (dataItem["EkBolgemi"].Text == "True")
            {
                dataItem["EkBolgemi"].BackColor = System.Drawing.Color.LightSalmon;
                dataItem["EkBolgemi"].Text = "Evet";
                dataItem["EkBolgemi"].ToolTip = "Ek bölge";
            }
            //dataItem["PAKETNOID"].ForeColor = System.Drawing.Color.Red;
        }
    }
        protected void CreateTutoringTimeBtn_Click(object sender, EventArgs e)
        {
            DateTime date = Calendar.SelectedDate.Date;
            string time = TimesCB.SelectedValue.ToString();
            int teacherId = securityHelper.Id;

            Service1Client client = new Service1Client();
            TutoringTime existingTt = client.GetExactTutoringTime(date, time, teacherId);
            if (existingTt == null)
            {
                int i = client.CreateTutoringTime(date, time, teacherId);

                if (i == 1)
                {
                    Response.Write("<script>alert('Tutoring time successufully created')</script>");
                }
                else
                {
                    Response.Write("<script>alert('Something went wrong. Please try again.')</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('There is a tutoring time already created with the specified date and time')</script>");
            }
        }
Beispiel #18
0
 static void Main(string[] args)
 {
     var client = new Service1Client();
     var a = client.GetData(43);
     Console.WriteLine(a);
     Console.ReadLine();
 }
Beispiel #19
0
 protected void invoke_Click(object sender, EventArgs e)
 {
     Service1Client s = new Service1Client();
     int send = Convert.ToInt32(tb1.Text.ToString());
     double ans = s.taxCalculator(send);
     tb2.Text = ans.ToString();
 }
    protected void RadComboBoxFirma_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)
    {
        if (e.Text.Length > 3)
        {
            using (Service1Client client = new Service1Client())
            {
                intBolgeKodu = client.BolgeKoduDon(Context.User.Identity.Name);
            }
            string BolgeKodu = intBolgeKodu.ToString();
            string sqlSelectCommand = "";
            sqlSelectCommand = "SELECT [FIRMAID],[MUSTNO], [FIRMAADI], [IL_ILCE] from [firma] WHERE [FIRMAADI] LIKE '%'+ @text + '%' and SILINDI=0 and BOLGEKODU=" + BolgeKodu + " ORDER BY [FIRMAADI]";
            SqlDataAdapter adapter = new SqlDataAdapter(sqlSelectCommand, ConfigurationManager.ConnectionStrings["KalData"].ConnectionString);
            adapter.SelectCommand.Parameters.AddWithValue("@text", e.Text);
            DataTable dataTable = new DataTable();
            adapter.Fill(dataTable);

            RadComboBoxFirma.Items.Clear();
            foreach (DataRow dataRow in dataTable.Rows)
            {
                string IlIlce = "";
                RadComboBoxItem item = new RadComboBoxItem();
                item.Text = (string)dataRow["MUSTNO"].ToString();
                item.Value = dataRow["FIRMAID"].ToString();
                string FirmaAdi = (string)dataRow["FIRMAADI"];
                if (dataRow["IL_ILCE"] != System.DBNull.Value)
                    {
                        IlIlce = (string)dataRow["IL_ILCE"];
                    }
                item.Attributes.Add("FIRMAADI", FirmaAdi);
                item.Attributes.Add("IL_ILCE", IlIlce);
                RadComboBoxFirma.Items.Add(item);
                item.DataBind();
            }
        }
    }
Beispiel #21
0
 public void TestSync()
 {
     using (Service1Client proxy = new Service1Client())
     {
         proxy.GetDataUsingDataContract(new CompositeType());
     }
 }
 void CheckPvMessage()
 {
     if (Context.User.Identity.IsAuthenticated)
     {
         using (Service1Client proxy = new Service1Client())
         {
             try
             {
                 Guid UserId = proxy.UserNamedenUserIdDon(Context.User.Identity.Name);
                 //Guid UserId = proxy.UserNamedenUserIdDon("hhhhhhhhhhh");
                 List<kal_RecievedPvMessages_Result> OkunmamisMesajlar = proxy.OkunmamisPvtMesajlariDon(UserId).ToList();
                 if (OkunmamisMesajlar.Count > 0)
                 {
                     imgMsgOkunmamis.Visible = true;
                     imgMsgOkunmamis.ToolTip = OkunmamisMesajlar.Count.ToString() + " adet okunmamış özel mesajınız var";
                     lblMessageUyari.Text = OkunmamisMesajlar.Count + " adet  mesajınız var.";
                     string url = HttpContext.Current.Request.Url.AbsoluteUri;
                     if (url.IndexOf("OzelMesajOku") == -1)
                     {
                         RadNotification1.Text = " <font color='red'>" + OkunmamisMesajlar.Count.ToString() + " adet okunmamış özel mesajınız var.<br>Mesajlarınızı online kullanıcılar kısmının hemen üzerinde yer alan özel mesajlarım linkine tıklayarak okuyabilirsiniz." + "</font>";
                         RadNotification1.Show();
                     }
                 }
             }
             catch (CommunicationException e)
             {
                 proxy.Abort();
             }
         }
     }
 }
        private async void CallService1(object sender, EventArgs e)
        {
            BasicHttpBinding binding = DataModel.CreateBasicHttp();

            //Service1Client client = new Service1Client(binding, new EndpointAddress("http://localhost:59074/Service1.svc"));
            Service1Client client = new Service1Client(binding, new EndpointAddress("http://192.168.1.96:59075/Service1.svc"));

            count++;

            CompositeType parm = new CompositeType();
            parm.BoolValue = true;
            parm.StringValue = "Hello " + count.ToString() + " ";

            try
            {
                CompositeType s = await Task<CompositeType>.Factory.FromAsync((asyncCallback, asyncState) => client.BeginGetDataUsingDataContract(parm, asyncCallback, asyncState),
                                                                       (asyncResult) => client.EndGetDataUsingDataContract(asyncResult), null);

                MyText.Text = s.StringValue;
            }
            catch(Exception ex)
            {
                Android.Util.Log.Debug("", ex.ToString());
            }


        }
Beispiel #24
0
 public Service1Client(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
     base(Service1Client.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
Beispiel #25
0
        public void CreateAssignmentTest()
        {
            ServiceReference1.Service1Client testService = new Service1Client();

            Assert.AreEqual(1, testService.CreateAssignment(1, "English", "TestAssignment", "Test", DateTime.Now, DateTime.Now));
        }
Beispiel #26
0
        private void exportButton_Click(object sender, EventArgs e)
        {
            Service1Client client        = new Service1Client();
            List <int>     idSelecionado = new List <int>();
            int            tipo          = 3;


            if (xmlCheckBox.Checked && !jsonCheckBox.Checked)
            {
                tipo = 0;
            }
            else if (!xmlCheckBox.Checked && jsonCheckBox.Checked)
            {
                tipo = 1;
            }
            else if (xmlCheckBox.Checked && jsonCheckBox.Checked)
            {
                tipo = 2;
            }
            if (xmlCheckBox.Checked || jsonCheckBox.Checked)
            {
                if (listView1.SelectedItems.Count > 0)
                {
                    if (MessageBox.Show("Are you sure you want to export " + listView1.SelectedItems.Count +
                                        " donator(s) from blood donators database ?",
                                        "Export donator!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        foreach (ListViewItem item in listView1.SelectedItems)
                        {
                            idSelecionado.Add(Convert.ToInt32(item.Text));
                        }


                        ExportDonators.ExportDonator(client.GetDonators(), tipo, idSelecionado);

                        listView1.SelectedItems.Clear();
                    }
                    else
                    {
                        listView1.SelectedItems.Clear();
                    }
                }
                else
                {
                    if (MessageBox.Show("Are you sure you want to export all donators from blood donators database ?",
                                        "Export donators!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        for (int i = 0; i < listView1.Items.Count; i++)
                        {
                            idSelecionado.Add(i);
                        }
                        ExportDonators.ExportDonator(client.GetDonators(), tipo, idSelecionado);
                    }
                }
            }
            else
            {
                MessageBox.Show("Please select a export format!");
            }
            client.Close();
        }
Beispiel #27
0
        static void Main(string[] args)
        {
            Service1Client client = null;

            try
            {
                client = new Service1Client();
                var test = client.GetEarthquakeData();
                var data = new List <Earthquake>();
                foreach (var earthquake in test)
                {
                    var when = earthquake.When;
                    var where = earthquake.Location;
                    var magnitude = earthquake.Magnitude;
                    var depth     = earthquake.Depth;
                    var magType   = earthquake.MagType;
                    var nbStation = earthquake.NbStation;
                    var gap       = earthquake.Gap;
                    var distance  = earthquake.Distance;
                    var rms       = earthquake.RMS;
                    var source    = earthquake.Source;
                    var eventId   = earthquake.EventID;
                    var version   = earthquake.Version;
                    var title     = earthquake.Title;
                    Console.WriteLine("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}", when, where, magnitude, depth, magType, nbStation, gap, distance, rms, source, eventId, version, title);
                    data.Add(new Earthquake(when, where, magnitude, depth, magType, nbStation, gap, distance, rms, source, eventId, version, title));
                }

                var test2 = client.GetEarthquakeDataBBox(-145, 0, -75, 45);
                var data2 = new List <Earthquake>();
                foreach (var earthquake in test2)
                {
                    var when = earthquake.When;
                    var where = earthquake.Location;
                    var magnitude = earthquake.Magnitude;
                    var depth     = earthquake.Depth;
                    var magType   = earthquake.MagType;
                    var nbStation = earthquake.NbStation;
                    var gap       = earthquake.Gap;
                    var distance  = earthquake.Distance;
                    var rms       = earthquake.RMS;
                    var source    = earthquake.Source;
                    var eventId   = earthquake.EventID;
                    var version   = earthquake.Version;
                    var title     = earthquake.Title;
                    Console.WriteLine("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}", when, where, magnitude, depth, magType, nbStation, gap, distance, rms, source, eventId, version, title);
                    data2.Add(new Earthquake(when, where, magnitude, depth, magType, nbStation, gap, distance, rms, source, eventId, version, title));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception encounter: {0}", e.Message);
            }
            finally
            {
                Console.WriteLine("Done!");
                Console.ReadLine();
                if (null != client)
                {
                    client.Close();
                }
            }
        }
Beispiel #28
0
        private void btnTcp_Click(object sender, EventArgs e)
        {
            Service1Client svcT = new Service1Client("Tcp");

            dataGridView1.DataSource = svcT.GetAll();
        }
Beispiel #29
0
        protected void CreateUser_Click(object sender, EventArgs e)
        {
            if (checkMail(Email.Text))
            {
                GetPersonRequest rqt = new GetPersonRequest()
                {
                    Username = Email.Text
                };
                using (Service1Client client = new Service1Client())
                {
                    GetPersonResponse rsp = client.GetPerson(rqt);
                    //Check mail is not already used
                    if (rsp.Errored)
                    {
                        //Check password and Hash
                        if (check_password(Password.Text) && Password.Text == ConfirmPassword.Text)
                        {
                            // Add to database
                            Person user = new Person()
                            {
                                Username  = Email.Text,
                                Company   = Company.Text,
                                FirstName = FirstName.Text,
                                LastName  = LastName.Text,
                                IsAdmin   = false,
                                Password  = Password.Text
                            };

                            RegisterUserResponse response = client.RegisterUser(new RegisterUserRequest()
                            {
                                User = user
                            });
                            if (!response.Errored)
                            {
                                ErrorMessage.Text = "Your account has been created";
                                // clear all the fields

                                Email.Text           = "";
                                Password.Text        = "";
                                ConfirmPassword.Text = "";
                                Company.Text         = "";
                                FirstName.Text       = "";
                                LastName.Text        = "";
                            }
                            else
                            {
                                ErrorMessage.Text = "Fail to create your account";
                            }
                        }
                        else
                        {
                            ErrorMessage.Text = "Wrong Password";
                        }
                    }
                    else
                    {
                        ErrorMessage.Text = "This email adress is already used";
                    }
                }
            }
            else
            {
                ErrorMessage.Text = "Wrong email address format";
            }
        }
        private void GetReportData()
        {
            DbContext = new Service1Client(Service1Client.EndpointConfiguration.BasicHttpBinding_IService1);
            var data = DbContext.GetQualityReportById(Application.Current.Properties["UN"].ToString(),
                                                      Application.Current.Properties["PW"].ToString(), Application.Current.Properties["Ucid"].ToString(), IniQRId);

            ReportData = new QualityReport();
            QualityReport qualityReport = new QualityReport();

            qualityReport.Id          = data.Id;
            qualityReport.ReportNr    = data.ReportNr;
            qualityReport.DateCreated = data.Created;
            qualityReport.Status      = data.Status;

            TimeSpan span = DateTime.Now - data.Created;

            qualityReport.Interval = span.Days + " dag " + span.Hours + " tim";

            if (data.CreatedByEmployee != null)
            {
                Employee createdBy = new Employee();
                createdBy.Id   = data.CreatedByEmployee.Id;
                createdBy.Name = data.CreatedByEmployee.FName + " " + data.CreatedByEmployee.LName;
                qualityReport.CreatedByEmployee = createdBy;
            }

            if (data.OfficeData != null)
            {
                Office off = new Office();
                off.Id               = data.OfficeData.Id;
                off.Name             = data.OfficeData.Name;
                qualityReport.Office = off;
            }

            //"Felbeskrivning" the following 3 properties
            qualityReport.Department             = data.OfficeDepartment;
            qualityReport.DepartmentTask         = data.OfficeDepartmentTask;
            qualityReport.OfficeDepartmentTaskId = data.OfficeDepartmentTaskId;
            qualityReport.Description            = data.Description;

            //"Trolig orsak" the following 3 properties
            qualityReport.QRAnalysisHeaderId = data.QRAnalysisHeaderId;
            qualityReport.QRAnalysisHeader   = data.QRAnalysisHeader;
            qualityReport.AnalysisText       = data.AnalysisText;
            qualityReport.AnalysisCausedById = data.AnalysisCausedById;
            if (data.CausedByEmployees != null)
            {
                qualityReport.CausedByEmployees = new ObservableCollection <Employee>();
                Employee causedBy;
                foreach (var emp in data.CausedByEmployees)
                {
                    causedBy      = new Employee();
                    causedBy.Id   = emp.Id;
                    causedBy.Name = emp.FName + " " + emp.LName;
                    qualityReport.CausedByEmployees.Add(causedBy);
                }
            }

            //"Slutlig åtgärd" the following 4 properties
            qualityReport.QRFinalDecisionHeader = data.QRFinalDecisionHeader;
            qualityReport.FinalDecisionText     = data.FinalDecisionText;
            qualityReport.FinalDecisionCost     = data.FinalDecisionCost;
            qualityReport.IsRepeatRepair        = data.IsRepeatRepair;

            if (data.ResponsibleEmployee != null)
            {
                Employee responsible = new Employee();
                responsible.Id   = data.ResponsibleEmployee.Id;
                responsible.Name = data.ResponsibleEmployee.FName + " " + data.ResponsibleEmployee.LName;
                qualityReport.ResponsibleEmployee = responsible;
            }

            if (data.QRAttachedFileData != null)
            {
                QRAttachedFile attachedFile;
                AllImages = new ObservableCollection <QRAttachedFile>();
                foreach (var img in data.QRAttachedFileData)
                {
                    attachedFile          = new QRAttachedFile();
                    attachedFile.Id       = img.Id;
                    attachedFile.FileName = img.FileName;
                    attachedFile.FilePath = img.FilePath;

                    AllImages.Add(attachedFile);
                }
            }

            qualityReport.AoNr      = data.AoNr;
            qualityReport.RegNr     = data.RegNr;
            qualityReport.TotalCost = data.TotalCost;
            qualityReport.Year      = data.Year;
            qualityReport.Deleted   = data.Deleted;

            if (data.QRLogs != null)
            {
                qualityReport.QRLog = new ObservableCollection <QRLog>();
                QRLog qrlog;
                foreach (var log in data.QRLogs.OrderBy(o => o.Id))
                {
                    qrlog             = new QRLog();
                    qrlog.QRId        = log.QualityReportId;
                    qrlog.Id          = log.Id;
                    qrlog.LogTypeId   = log.LogTypeId;
                    qrlog.LogTypeText = log.LogTypeText;
                    qrlog.Subject     = log.Subject;
                    qrlog.Created     = log.Created;
                    qrlog.Description = log.Description;
                    if (log.CreatedEmployee != null)
                    {
                        Employee emp = new Employee();
                        emp.Id   = log.CreatedEmployee.Id;
                        emp.Name = log.CreatedEmployee.FName + " " + log.CreatedEmployee.LName;
                        qrlog.CreatedByEmployee = emp;
                    }
                    qualityReport.QRLog.Add(qrlog);
                }
            }

            ReportData = qualityReport;
        }
Beispiel #31
0
        private void RenderMessage(MessageDTO[] messages)
        {
            Messages.Children.Clear();
            if (messages == null || messages.Length == 0)
            {
                return;
            }
            Service1Client client = new Service1Client();

            foreach (MessageDTO item in messages)
            {
                string SenderLogin = client.GetLoginById(item.SenderId);
                //SenderLogin = (SenderLogin == null) ? "Server" : SenderLogin;
                ThicknessConverter tc = new ThicknessConverter();
                Card card             = new Card {
                    Background          = GetDesignColorBrush(DesignColor.PrimaryDark),
                    Foreground          = new SolidColorBrush(Colors.White),
                    Padding             = (Thickness)tc.ConvertFromString("8px"),
                    UniformCornerRadius = 6,
                    //Content = new TextBlock { Text = $"{item.Text}", TextWrapping = TextWrapping.Wrap }
                };
                if (item.FileName != String.Empty)
                {
                    StackPanel stack = new StackPanel();
                    stack.Children.Add(new TextBox {
                        Text            = ((SenderLogin != UserLoger.Login) ? $"{SenderLogin}: " : "") + $"{item.Text}",
                        TextWrapping    = TextWrapping.Wrap,
                        IsReadOnly      = true, Background = new SolidColorBrush(Colors.Transparent),
                        BorderThickness = (Thickness)tc.ConvertFromString("0px"),
                        BorderBrush     = new SolidColorBrush(Colors.Transparent)
                    });
                    Button        button = new Button();
                    StyleSelector style  = new StyleSelector();
                    button.Style   = (Style)this.TryFindResource("MaterialDesignFloatingActionMiniButton");
                    button.Content = new PackIcon {
                        Kind = PackIconKind.Download
                    };
                    button.Click += new RoutedEventHandler(DownloadFile);
                    button.HorizontalAlignment = HorizontalAlignment.Left;
                    button.Tag = item;
                    TextBlock text = new TextBlock {
                        Text = item.FileName, TextWrapping = TextWrapping.Wrap
                    };
                    text.HorizontalAlignment = HorizontalAlignment.Right;
                    text.Foreground          = (Brush)this.TryFindResource("PrimaryHueLightForegroundBrush");
                    StackPanel stack2 = new StackPanel {
                        Orientation = Orientation.Horizontal
                    };
                    stack2.Background = (Brush)this.TryFindResource("PrimaryHueLightBrush");
                    stack2.Children.Add(button);
                    stack2.Children.Add(text);
                    stack.Children.Add(stack2);
                    card.Content = stack;
                }
                else
                {
                    card.Content = new TextBox
                    {
                        Text            = ((SenderLogin != UserLoger.Login)?$"{SenderLogin}: ":"") + $"{item.Text}",
                        TextWrapping    = TextWrapping.Wrap,
                        IsReadOnly      = true,
                        Background      = new SolidColorBrush(Colors.Transparent),
                        BorderThickness = (Thickness)tc.ConvertFromString("0px"),
                        BorderBrush     = new SolidColorBrush(Colors.Transparent),
                        //TextDecorations =
                    };
                }
                //Paragraph paragraph = new Paragraph(new InlineUIContainer( card ));
                //paragraph.BorderThickness = (Thickness)tc.ConvertFromString("1px");
                card.Margin = (Thickness)tc.ConvertFromString("3px");
                if (SenderLogin == UserLoger.Login)
                {
                    card.HorizontalAlignment = HorizontalAlignment.Right;
                    //paragraph.FlowDirection = FlowDirection.RightToLeft;
                    //paragraph.BorderBrush = Brushes.Red;
                }
                else
                {
                    card.HorizontalAlignment = HorizontalAlignment.Left;
                    //paragraph.FlowDirection = FlowDirection.LeftToRight;
                    //paragraph.BorderBrush = Brushes.Blue;
                }
                Messages.Children.Add(card);
            }
            client.Close();
        }
Beispiel #32
0
        private void GetCarPresalesMaintenance()
        {
            try
            {
                int?empId = null;

                if (SelectedEmployee != null)
                {
                    empId = SelectedEmployee.Id;
                }

                DbContext = new Service1Client(Service1Client.EndpointConfiguration.BasicHttpBinding_IService1);

                var result = DbContext.GetCarPreSalesmaintenanceByOffice(Application.Current.Properties["UN"].ToString(), Application.Current.Properties["PW"].ToString(),
                                                                         Application.Current.Properties["Ucid"].ToString(), SelectedOffice.Id, empId);
                ObservableCollection <CarPresalesMaintenance> temp = new ObservableCollection <CarPresalesMaintenance>();
                Employee          emp;
                PreSalesFlowGroup flowGroup;
                foreach (CarPreSalesMaintenanceData row in result)
                {
                    CarPresalesMaintenance cPM = new CarPresalesMaintenance();
                    cPM.Id         = row.Id;
                    cPM.KeyCabinet = row.KeyCabinet;
                    cPM.Parking    = row.Parking;
                    cPM.RegNr      = row.RegNr;
                    if (row.VehicelModel != null)
                    {
                        cPM.VehicleModel = row.VehicelModel.TrimStart();
                    }
                    else
                    {
                        cPM.VehicleModel = row.VehicelModel;
                    }
                    cPM.VehicleBrandId   = row.VehicleBrandId;
                    cPM.VehicleBrandName = row.VehicleBrandName;
                    if (row.CarPreSaleFlowGroupData != null)
                    {
                        flowGroup             = new PreSalesFlowGroup();
                        flowGroup.Id          = row.CarPreSaleFlowGroupData.Id;
                        flowGroup.Name        = row.CarPreSaleFlowGroupData.Name;
                        flowGroup.Color       = row.CarPreSaleFlowGroupData.Color;
                        cPM.PreSalesFlowGroup = flowGroup;
                    }
                    if (row.MaintenanceResponsible != null)
                    {
                        emp          = new Employee();
                        emp.Id       = row.MaintenanceResponsible.Id;
                        emp.Name     = row.MaintenanceResponsible.FName + " " + row.MaintenanceResponsible.LName;
                        cPM.Employee = emp;
                    }
                    cPM.MaintenanceFormId = row.MaintenanceFormId;
                    cPM.NextDate          = row.MaintenanceNext;
                    temp.Add(cPM);
                }
                AllMaintenance         = new ObservableCollection <CarPresalesMaintenance>(temp.OrderBy(o => o.NextDate));
                AllMaintenanceFiltered = new ObservableCollection <CarPresalesMaintenance>(AllMaintenance);
            }
            catch (Exception e)
            {
                Application.Current.MainPage.DisplayAlert("Fel", e.Message, "STÄNG");
            }
        }
Beispiel #33
0
        // GET: Bike
        //ispis svih motora u bazi
        public ActionResult Index(string search)
        {
            List <tblBike> allBikes = new List <tblBike>();

            using (Service1Client wcf = new Service1Client())
            {
                allBikes = wcf.GetBikeList().ToList();
            }
            if (allBikes == null)
            {
                TempData["Success"] = "U bazi podataka ne postoji ni jedan motor, mozete ga dodati";
                return(RedirectToAction("Create", "Bike"));
            }
            else
            {
                List <BikesAndMembers> list = new List <BikesAndMembers>();
                BikesAndMembers        bandm;
                foreach (tblBike b in allBikes)
                {
                    bandm        = new BikesAndMembers();
                    bandm.BikeID = b.BikeID;
                    if (b.Brand == null)
                    {
                        bandm.Brand = "";
                    }
                    else
                    {
                        bandm.Brand = b.Brand.ToUpper();
                    }
                    if (b.Model == null)
                    {
                        bandm.Model = "";
                    }
                    else
                    {
                        bandm.Model = b.Model.ToUpper();
                    }
                    bandm.Year     = b.Year;
                    bandm.MemberID = b.MemberID;
                    using (Service1Client wcf = new Service1Client())
                    {
                        if (b.MemberID != null)
                        {
                            var member = wcf.GetOneMember((int)b.MemberID);
                            bandm.Name     = member.Name.ToUpper();
                            bandm.Surname  = member.Surname.ToUpper();
                            ViewBag.Member = bandm.Name + " " + bandm.Surname;
                        }
                        else
                        {
                            TempData["Success"] = "Motor nema vlasnika";
                        }
                    }
                    list.Add(bandm);
                }
                if (search != null)
                {
                    return(View(list.Where(x => (x.Brand.ToUpper()).Contains(search.ToUpper()) ||
                                           (x.Model.ToUpper()).Contains(search.ToUpper()) ||
                                           (x.Name.ToUpper()).Contains(search.ToUpper()) ||
                                           (x.Surname.ToUpper()).Contains(search.ToUpper()) ||
                                           (x.Year.ToString()).Contains(search.ToUpper())).ToList()));
                }
                else
                {
                    return(View(list));
                }
            }
        }
Beispiel #34
0
        public Statistici()
        {
            InitializeComponent();
            Service1Client service1Client = new Service1Client();

            cititori.Text = ClassLibrary1.Program.get_nrCititori().ToString();

            var carti = ClassLibrary1.Program.clasament_carti();

            listCarti.Columns.Add("Titlu");
            listCarti.Columns.Add("Autor");
            listCarti.Columns.Add("Imprumuturi");
            listCarti.AutoArrange = false;
            listCarti.View        = View.Details;
            foreach (var c in carti)
            {
                string[]     arr = new string[3];
                ListViewItem itm;
                arr[0] = c.Titlu;
                var a = ClassLibrary1.Program.get_autor((int)c.AutorId);
                arr[1] = a.Nume + a.Prenume;
                arr[2] = ClassLibrary1.Program.imprumuturi_carte(c.CarteId).ToString();

                itm = new ListViewItem(arr);
                listCarti.Items.Add(itm);
            }


            //autori
            var autori = ClassLibrary1.Program.clasament_autori();

            listAutori.Columns.Add("Nume Autor");
            listAutori.Columns.Add("Prenume Autor");
            listAutori.Columns.Add("Imprumuturi");
            listAutori.AutoArrange = false;
            listAutori.View        = View.Details;
            foreach (var c in autori)
            {
                string[]     arr = new string[3];
                ListViewItem itm;
                arr[0] = c.Nume;
                arr[1] = c.Prenume;
                arr[2] = ClassLibrary1.Program.imprumuturi_autor(c.AutorId).ToString();

                itm = new ListViewItem(arr);
                listAutori.Items.Add(itm);
            }

            //genuri
            var genuri = ClassLibrary1.Program.clasament_genuri();

            listGenuri.Columns.Add("Gen");
            listGenuri.Columns.Add("Imprumuturi");
            listGenuri.AutoArrange = false;
            listGenuri.View        = View.Details;
            foreach (var c in genuri)
            {
                string[]     arr = new string[2];
                ListViewItem itm;
                arr[0] = c.Descriere;
                arr[1] = ClassLibrary1.Program.imprumuturi_gen(c.GenId).ToString();

                itm = new ListViewItem(arr);
                listGenuri.Items.Add(itm);
            }
        }
Beispiel #35
0
 public LoginPage()
 {
     InitializeComponent();
     sr = new Service1Client();
 }
Beispiel #36
0
 public Service1Client() :
     base(Service1Client.GetDefaultBinding(), Service1Client.GetDefaultEndpointAddress())
 {
     this.Endpoint.Name = EndpointConfiguration.TcpEndPoint.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
Beispiel #37
0
        protected void DeletePage(object sender, EventArgs e)
        {
            string todelete           = ((System.Web.UI.WebControls.LinkButton)sender).CommandArgument;
            List <TutorialPage> pages = new List <TutorialPage>();
            // Send everything to Service
            int i = 0;

            foreach (var item in LVTuto.Items)
            {
                i += 1;
                pages.Add(new TutorialPage()
                {
                    Text       = ((System.Web.UI.WebControls.TextBox)item.Controls[5]).Text,
                    Video      = checkVideo(((System.Web.UI.WebControls.TextBox)item.Controls[3]).Text),
                    PageNumber = int.Parse(((System.Web.UI.WebControls.TextBox)item.Controls[1]).Text),
                });
            }
            pages.RemoveAll(item => item.PageNumber.ToString() == todelete);

            if (pages.Count > 0)
            {
                pages.FindAll(x => x.PageNumber > int.Parse(todelete)).ForEach(x => x.PageNumber = x.PageNumber - 1);
                using (Service1Client client = new Service1Client())
                {
                    UpdateTutorialItemResponse response = client.UpdateTutorialItem(
                        new UpdateTutorialItemRequest()
                    {
                        TutorialItem = new TutorialItem()
                        {
                            // the new Tutorial item object (with same _id)
                            _id          = TutorialID.Text,
                            Title        = TutorialTitle.Text,
                            Author       = Author.Text,
                            DateModified = DateTime.Now,
                            Pages        = pages.ToArray()
                        }
                    });

                    if (!response.Errored)
                    {
                        // the Tutorial item is now updated
                        Response.Redirect("~/TutorialEditor?id=" + Request.QueryString["id"]);
                    }
                }
            }
            else
            {
                using (Service1Client client = new Service1Client())
                {
                    DeleteTutorialItemResponse response = client.DeleteTutorialItem(
                        new DeleteTutorialItemRequest()
                    {
                        _id = TutorialID.Text
                    });

                    if (!response.Errored)
                    {
                        Response.Redirect("~/Tutorials");
                    }
                }
            }
        }
Beispiel #38
0
 private static System.ServiceModel.Channels.Binding GetDefaultBinding()
 {
     return(Service1Client.GetBindingForEndpoint(EndpointConfiguration.TcpEndPoint));
 }
Beispiel #39
0
 public Service1Client(EndpointConfiguration endpointConfiguration) :
     base(Service1Client.GetBindingForEndpoint(endpointConfiguration), Service1Client.GetEndpointAddress(endpointConfiguration))
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
Beispiel #40
0
 private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress()
 {
     return(Service1Client.GetEndpointAddress(EndpointConfiguration.BasicHttpBinding_IService1));
 }
Beispiel #41
0
 private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress()
 {
     return(Service1Client.GetEndpointAddress(EndpointConfiguration.TcpEndPoint));
 }
 public frmCadastrarModelo()
 {
     InitializeComponent();
     wcf = new Service1Client();
 }
 public ListActorViewModel()
 {
     Serv       = new Service1Client();
     ListActors = new List <ActorViewModel>();
     listFilms  = new List <FilmViewModel>();
 }
Beispiel #44
0
        static void Main(string[] args)
        {
            var   redis      = new RedisClient("localhost:6379");
            var   sv1        = new Service1Client();
            var   sw         = new System.Diagnostics.Stopwatch();
            var   text       = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";
            var   text2      = "Zastita informacija";
            Image im         = new Bitmap("C:/Users/MICE/Documents/GitHub/MyCloudStore/MyCloudStore/TestConsole/sven.png");
            var   imageBytes = ImageToByteArray(im);
            var   fileinfo   = new FileInfo(@"C:\Users\MICE\Documents\GitHub\MyCloudStore\MyCloudStore\MyCloudService\Temp\WickeD\Adam Lambert - Ghost Town.mp3");
            var   file       = File.ReadAllBytes(@"C:/Users/MICE/Documents/GitHub/MyCloudStore/MyCloudStore/TestConsole/sven.png");
            var   CHUNK      = 1048576;

            sw.Start();
            var nChunks = fileinfo.Length / CHUNK + 1;
            var down    = new byte[fileinfo.Length];

            for (int i = 0; i < nChunks; i++)
            {
                var data = sv1.DownloadWithChunks(fileinfo.Name, "WickeD", i);
                Buffer.BlockCopy(data, 0, down, i * CHUNK, data.Length);
            }
            File.WriteAllBytes(@"C:\Users\MICE\Desktop\file.mp3", down);
            sw.Stop();
            Console.WriteLine(sw.ElapsedMilliseconds);
            //var ost = file.Length % 4;
            //var fileFixed = new byte[file.Length+ost];
            //file.CopyTo(fileFixed,0);
            var ch = Encoding.ASCII.GetBytes("X");

            var kn  = SimpleSub.Instance;
            var enc = kn.Encrypt(file);

            sw.Stop();
            Console.WriteLine(sw.ElapsedMilliseconds);
            File.WriteAllBytes(@"C:/Users/MICE/Desktop/sven.png", kn.Decrypt(enc));

            kn  = SimpleSub.Instance;
            enc = kn.Encrypt(Encoding.ASCII.GetBytes(text2));
            sw  = System.Diagnostics.Stopwatch.StartNew();
            sw.Stop();
            Console.WriteLine(sw.ElapsedMilliseconds);
            Console.WriteLine(Encoding.ASCII.GetString(enc));
            var file1 = Append(enc, ch);
            var lastB = file1.Length - 1;
            var dec2  = new byte[lastB];

            Buffer.BlockCopy(file1, 0, dec2, 0, lastB);
            var dec = kn.Decrypt(dec2);
            //var xx = new byte[dec.Length - 1];
            //Buffer.BlockCopy(dec,0,xx,0,dec.Length-1);
            //File.WriteAllBytes(@"C:\Users\MICE\Desktop\sven.png", dec2);
            //var fileinfo = new FileInfo(@"D:\ygopro.avi");
            //var file = File.ReadAllBytes(fileinfo.FullName);

            //var sw =System.Diagnostics.Stopwatch.StartNew();
            //var x = SHA2.Hash(file);
            //var y=SHA2.Hash(dec);
            //sw.Stop();
            //Console.WriteLine(sw.ElapsedMilliseconds);
            //if (x == y)
            //{
            //    Console.WriteLine("Radi");
            //}
            //else
            //{
            //    Console.WriteLine("Ne radi");
            //}


            //sv1.Upload($"{Path.GetFileNameWithoutExtension(fileinfo.Name)}{fileinfo.Extension}", XXTEA.Encrypt(file), "WickeD");
            //var filed = sv1.Download($"{Path.GetFileNameWithoutExtension(fileinfo.Name)}.txt", "WickeD");
            //var decoded = XXTEA.Decrypt(filed);
            //File.WriteAllBytes(@"D:\grapha2.mp3", decoded);

            // var knap = new KnapSack();
            // var sw =System.Diagnostics.Stopwatch.StartNew();
            // var x=knap.Encrypt(txtb);
            // sw.Stop();
            // Console.WriteLine(sw.ElapsedMilliseconds);
            // sw = System.Diagnostics.Stopwatch.StartNew();
            // knap.Decrypt(x);
            // sw.Stop();
            // Console.WriteLine(sw.ElapsedMilliseconds);
        }
Beispiel #45
0
        async Task <int> Upload()
        {
            using (Service1Client client = new Service1Client())
            {
                GetFileRecordResponse dbxKey = client.GetFileRecord();

                if (dbxKey.Errored)
                {
                    return(-1);
                }
                string logoPath = Server.MapPath("~/TemporaryFolder");
                string filename = FileInput.FileName;
                if (Directory.Exists(logoPath))
                {
                    System.IO.DirectoryInfo di = new DirectoryInfo(logoPath);
                    di.Delete(true);
                }

                DirectorySecurity securityRules = new DirectorySecurity();
                securityRules.AddAccessRule(new FileSystemAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null),
                                                                     FileSystemRights.FullControl, InheritanceFlags.ObjectInherit | InheritanceFlags.ContainerInherit,
                                                                     PropagationFlags.NoPropagateInherit, AccessControlType.Allow));
                DirectoryInfo dir = Directory.CreateDirectory(logoPath);
                dir.SetAccessControl(securityRules);

                using (var dbx = new DropboxClient(SysConfig.DBKey))
                {
                    string     folder   = Path.GetDirectoryName(Server.MapPath(FileInput.FileName)); // path to containing folder of file to be uploaded
                    string     fileName = FileInput.FileName;                                        // name of file to be uploaded
                    FileStream fs       = new FileStream(@logoPath + "\\data.dat", FileMode.CreateNew, FileAccess.ReadWrite);
                    FileInput.PostedFile.InputStream.CopyTo(fs);
                    fs.Close();
                    //128 kb chunks
                    const int chunkSize = 128 * 1024;
                    // create filestream
                    using (FileStream stream = new FileStream(@logoPath + "\\data.dat", FileMode.Open, FileAccess.ReadWrite))
                    //using (FileStream stream = File.Create(logoPath))
                    {
                        //FileInput.PostedFile.InputStream.CopyTo(stream);
                        // generate information for loop
                        int    numChunks = (int)Math.Ceiling((double)stream.Length / chunkSize);
                        byte[] buffer    = new byte[chunkSize];
                        string sessionId = null;
                        // chunk sessions
                        pValue = numChunks;

                        System.Diagnostics.Debug.WriteLine(numChunks.ToString());
                        for (int i = 0; i < numChunks; i++)
                        {
                            Console.WriteLine(i.ToString() + " / " + numChunks.ToString());

                            var byteRead = stream.Read(buffer, 0, chunkSize);
                            UploadSessionAppendArg arg = new UploadSessionAppendArg();

                            using (MemoryStream memStream = new MemoryStream(buffer, 0, byteRead))
                            {
                                if (i == 0)
                                {
                                    var result = await dbx.Files.UploadSessionStartAsync(false, memStream);

                                    sessionId = result.SessionId;
                                }
                                else
                                {
                                    var cursor = new UploadSessionCursor(sessionId, (ulong)(chunkSize * i));
                                    Status.Text = i.ToString() + " / " + numChunks.ToString();

                                    System.Diagnostics.Debug.WriteLine(i.ToString() + " / " + numChunks.ToString());
                                    if (i == numChunks - 1)
                                    {
                                        await dbx.Files.UploadSessionFinishAsync
                                            (cursor, new CommitInfo("/" + fileName), memStream);
                                    }
                                    else
                                    {
                                        await dbx.Files.UploadSessionAppendV2Async(cursor, false, memStream);
                                    }
                                }
                            }
                        }
                    }
                    // file upload finished log new file name
                    InsertFileRecordResponse frResp = client.InsertFileRecord(new InsertFileRecordRequest()
                    {
                        FileName = FileInput.PostedFile.FileName
                    });
                    if (frResp.Errored)
                    {
                        // handle it
                        ErreurMessage.Text = "Error";
                        return(0);
                    }

                    // if the file is a new version delete the old version
                    if (frResp.DeleteOldFile)
                    {
                        await dbx.Files.DeleteAsync(new DeleteArg("/" + frResp.OldFileName));
                    }
                    ///DELETE THE TEMPORARY FILE ///
                    if (Directory.Exists(logoPath))
                    {
                        System.IO.DirectoryInfo di = new DirectoryInfo(logoPath);
                        di.Delete(true);
                    }
                    Status.Text            = "100%";
                    EndMessage.Text        = "Upload Completed";
                    EndMessage.Visible     = true;
                    theProgressBar.Visible = false;
                    return(0);
                }
            }
        }
Beispiel #46
0
        protected void submit_Click(object sender, EventArgs e)
        {
            String         username = (String)tbUsername.Text.Trim().ToLower();
            String         password = (String)tbPassword.Text.Trim();
            String         role     = (String)Submit_Role_Value.Text.Trim();
            Service1Client client   = new Service1Client();

            if (role == "0")
            {
                CustomerClass cust = client.VerifyCustomer(username);
                if (cust.ID != Guid.Empty)
                {
                    if (client.VerifyPassword(cust.Email, password, "Customer"))
                    {
                        Boolean setSession = true;
                        if (cust.blackListed)
                        {
                            List <BlackListClass> resultOne = client.SelectAllBlacklist(username).ToList();
                            for (int i = 0; i < resultOne.Count; i++)
                            {
                                if (resultOne[i].Deleted == false)
                                {
                                    Int16 rtmpesult = client.UpdateBlacklistDeleted(resultOne[i].ID, resultOne[i].CustomerID, true);
                                    if (rtmpesult == -4)
                                    {
                                        divErrorMsg.Visible = true;
                                        lbErrorMsg.Text     = "You have been blacklisted. Reason: " + HttpUtility.HtmlEncode(resultOne[i].Reason);
                                        setSession          = false;
                                    }
                                    else if (rtmpesult > 0)
                                    {
                                        client.UpdateCustomerStatus(cust.ID, cust.Email, "blackListedStatus", false);
                                    }
                                    else if (rtmpesult != 1)
                                    {
                                        setSession = false;
                                    }
                                }
                            }
                        }
                        if (!cust.emailVerified)
                        {
                            divErrorMsg.Visible = true;
                            lbErrorMsg.Text     = "You have changed your email, please verify before proceeding";
                            setSession          = false;
                        }
                        if (cust.delete)
                        {
                            Int16 resultOne = client.DeleteCustomer(cust.ID, cust.Email, cust.deleteDate.AddDays(30));
                            if (resultOne != 1)
                            {
                                Int16 rtmpesult = client.UpdateCustomerStatus(cust.ID, cust.Email, "deleteStatus", false);
                                if (rtmpesult != 1)
                                {
                                    setSession = false;
                                }
                            }
                        }
                        if (setSession)
                        {
                            Boolean result = AuthRequire.SetUserSession(cust.ID, cust.Email, "Customer");
                            if (result == true)
                            {
                                Response.Redirect("~/CustomerProfile");
                            }
                        }
                    }
                    else
                    {
                        divErrorMsg.Visible = true;
                        lbErrorMsg.Text     = "Invalid email or password";
                    }
                }
                else
                {
                    Response.Redirect("~/CustomerRegistration");
                }
            }
            else if (role == "1")
            {
                BusinessUser business = client.GetBusinessUserByEmail(username);
                if (business != null)
                {
                    if (client.VerifyPassword(business.Email, password, "Business"))
                    {
                        Boolean setSession = true;
                        if (business.blackListed)
                        {
                            List <BlackListClass> resultOne = client.SelectAllBlacklist(username).ToList();
                            for (int i = 0; i < resultOne.Count; i++)
                            {
                                if (resultOne[i].Deleted == false)
                                {
                                    Int16 rtmpesult = client.UpdateBlacklistDeleted(resultOne[i].ID, resultOne[i].CustomerID, true);
                                    if (rtmpesult == -4)
                                    {
                                        divErrorMsg.Visible = true;
                                        lbErrorMsg.Text     = "You have been blacklisted. Reason: " + HttpUtility.HtmlEncode(resultOne[i].Reason);
                                        setSession          = false;
                                    }
                                    else if (rtmpesult > 0)
                                    {
                                        client.UpdateBusinessStatus(business.Email, "blackListedStatus", false);
                                    }
                                    else if (rtmpesult != 1)
                                    {
                                        setSession = false;
                                    }
                                }
                            }
                        }
                        if (!business.emailVerified)
                        {
                            divErrorMsg.Visible = true;
                            lbErrorMsg.Text     = "You have changed your email, please verify before proceeding";
                            setSession          = false;
                        }
                        if (business.delete)
                        {
                            Int16 resultOne = client.DeleteBusinessUser(business.Email, business.deleteDate.AddDays(30));
                            if (resultOne != 1)
                            {
                                Int16 rtmpesult = client.UpdateBusinessStatus(business.Email, "deleteStatus", false);
                                if (rtmpesult != 1)
                                {
                                    setSession = false;
                                }
                            }
                        }
                        if (setSession)
                        {
                            Boolean result = AuthRequire.SetUserSession(Guid.Parse(business.Id), business.Email, "Customer");
                            if (result == true)
                            {
                                Response.Redirect("/BDHome.aspx", false);
                            }
                        }
                    }
                    else
                    {
                        divErrorMsg.Visible = true;
                        lbErrorMsg.Text     = "Invalid email or password";
                    }
                }
            }
            else if (role == "2")
            {
                AdminClass admin = client.SelectOneAdmin(username);
                if (admin != null)
                {
                    if (client.VerifyPassword(admin.UserName, password, "Admin"))
                    {
                        Boolean result = AuthRequire.SetUserSession(admin.ID, admin.UserName, "Admin");
                        if (result == true)
                        {
                            Response.Redirect("~/AdminHome");
                        }
                    }
                    else
                    {
                        divErrorMsg.Visible = true;
                        lbErrorMsg.Text     = "Invalid email or password";
                    }
                }
            }
            else
            {
            }
        }
        protected void btn_changepwd_Click(object sender, EventArgs e)
        {
            string pwd        = HttpUtility.HtmlEncode(tb_newpwd.Text.ToString().Trim());
            string confirmpwd = HttpUtility.HtmlEncode(tb_confirmpwd.Text.ToString().Trim());

            if (ValidateCaptcha() && CheckPassword() && CheckPasswordScore(confirmpwd) > 3)
            {
                string         email  = (string)Session["AuthID"];
                Service1Client client = new Service1Client();
                User           usr    = client.GetUserByEmail(email);
                if (usr != null)
                {
                    string        dbHash  = usr.Password;
                    string        dbSalt  = usr.Salt;
                    SHA512Managed hashing = new SHA512Managed();
                    try
                    {
                        if (dbSalt != null && dbSalt.Length > 0 && dbHash != null && dbHash.Length > 0)
                        {
                            string pwdWithSalt  = pwd + dbSalt;
                            byte[] hashWithSalt = hashing.ComputeHash(Encoding.UTF8.GetBytes(pwdWithSalt));
                            string userHash     = Convert.ToBase64String(hashWithSalt);
                            if (userHash.Equals(dbHash))
                            {
                                lbl_pwdchecker.Text      = "Cannot change to the same password.";
                                lbl_pwdchecker.ForeColor = Color.Red;
                            }
                            else
                            {
                                if (pwd.Equals(confirmpwd))
                                {
                                    // Not functional
                                    // int result = client.ChangePassword(email, pwd);
                                    int result = 0;
                                    if (result == 1)
                                    {
                                        lbl_pwdchecker.Text      = "Password has been successfully changed.";
                                        lbl_pwdchecker.ForeColor = Color.Green;
                                    }
                                    else
                                    {
                                        lbl_pwdchecker.Text      = "Password did not meet the account policy requirements.";
                                        lbl_pwdchecker.ForeColor = Color.Red;
                                    }
                                }
                                else
                                {
                                    lbl_pwdchecker.Text      = "Make sure both passwords are the same.";
                                    lbl_pwdchecker.ForeColor = Color.Red;
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.ToString());
                    }
                    finally { }
                }
            }
        }
Beispiel #48
0
        static void Main(string[] args)
        {
            Service1Client cosmos = new Service1Client();

            ServiceReference2.Service1Client firstOrder = new ServiceReference2.Service1Client();
            cosmos.InitializeGame();
            while (true)
            {
                showMenu();
                string choice = Console.ReadLine();
                if (choice == "a")
                {
                    if (_imperiumMoneyAskCount > 0)
                    {
                        int goldFromEmpire = firstOrder.GetMoneyFromImperium();
                        _gold += goldFromEmpire;
                        _imperiumMoneyAskCount--;
                        Console.WriteLine("Dostales {0} hajsu", goldFromEmpire);
                    }
                    else
                    {
                        Console.WriteLine("Nie masz prosb");
                    }
                }
                else if (choice == "b")
                {
                    Console.WriteLine("Aktualne zloto:{0}. Wpisz za ile zlota chcesz kupic statek", _gold);
                    int money = 0;
                    if (Int32.TryParse(Console.ReadLine(), out money))
                    {
                        if (money <= _gold)
                        {
                            starships.Add(cosmos.GetStarship(money));
                            _gold -= money;
                        }
                        else
                        {
                            Console.WriteLine("Nie masz tyle hajsu");
                        }
                    }
                    else
                    {
                        Console.WriteLine("Zla kwota");
                    }
                }
                else if (choice == "c")
                {
                    SSystem toSend = cosmos.GetSystem();
                    if (toSend == null)
                    {
                        _anySystem = false;
                        Console.WriteLine("Brak systemow");
                    }
                    else
                    {
                        Console.WriteLine("System {0}. Odleglosc: {1}", toSend.Name, toSend.BaseDistance);
                        Console.WriteLine("Statkow gotowych do podrozy: {0}", starships.Count);
                        if (starships.Count == 0)
                        {
                            Console.WriteLine("Brak statkow");
                        }
                        else
                        {
                            Console.WriteLine("Wybierz statek wpisujac jego numer albo wyjdz uzywajac e");
                            for (int i = 1; i <= starships.Count; i++)
                            {
                                Starship ship = starships[i - 1];
                                Console.Write("{0} {1}", i, ship.ShipPower);
                                foreach (Person p in ship.crew)
                                {
                                    Console.Write(" {0} {1} {2} ", p.Name, p.Nick, p.Age);
                                }
                                Console.WriteLine();
                            }
                            string option = Console.ReadLine();
                            if (option == "e")
                            {
                                continue;
                            }
                            else
                            {
                                int shipNumber = 0;
                                if (Int32.TryParse(option, out shipNumber))
                                {
                                    if (shipNumber <= starships.Count && shipNumber != 0)
                                    {
                                        Starship starship = starships[shipNumber - 1];
                                        starships.RemoveAt(shipNumber - 1);
                                        Starship starshipAfterSend = cosmos.sendStarship(starship, toSend.Name);
                                        if (starshipAfterSend.Gold > 0)
                                        {
                                            _gold += starshipAfterSend.Gold;
                                            starshipAfterSend.Gold = 0;
                                        }
                                        if (starshipAfterSend.crew.Length > 0)
                                        {
                                            starships.Add(starshipAfterSend);
                                        }
                                        foreach (Person p in starshipAfterSend.crew)
                                        {
                                            Console.WriteLine(p.Age);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                else if (choice == "d")
                {
                    Console.WriteLine(!_anySystem?"Wygrana":"Przegrana");
                    break;
                }
            }
            Console.ReadLine();
        }
Beispiel #49
0
 public Marker()
 {
     InitializeComponent();
     WCF = new WebService.Service1Client();
 }
Beispiel #50
0
        void RunClient()
        {
            var binding       = new BasicHttpBinding();
            var remoteAddress = new EndpointAddress("http://localhost:37564/Service1");

            var normalClient     = new Service1Client(binding, remoteAddress);
            var collectionClient = new Service1Client(binding, remoteAddress);
            var nestedClient     = new Service1Client(binding, remoteAddress);
            var dbClient         = new Service1Client(binding, remoteAddress);

            var waits = new ManualResetEvent [4];

            for (int i = 0; i < waits.Length; i++)
            {
                waits [i] = new ManualResetEvent(false);
            }

            int passed = 0;

            normalClient.GetDataCompleted += delegate(object o, GetDataCompletedEventArgs e) {
                if (e.Error != null)
                {
                    Assert.Fail("Normal failed; error: {0}", e.Error);
                    throw e.Error;
                }
                Assert.AreEqual("A", ((DataType1)e.Result).Id, "Normal");
                Interlocked.Increment(ref passed);
                waits [0].Set();
            };
            normalClient.GetDataAsync();

            collectionClient.GetCollectionDataCompleted += delegate(object sender, GetCollectionDataCompletedEventArgs e) {
                if (e.Error != null)
                {
                    Assert.Fail("Collection failed; error: {0}", e.Error);
                    throw e.Error;
                }
                Assert.AreEqual("B,C", ItemsToString(e.Result.Cast <DataType1> ()), "Collection");
                Interlocked.Increment(ref passed);
                waits [1].Set();
            };
            collectionClient.GetCollectionDataAsync();

            nestedClient.GetNestedDataCompleted += delegate(object sender, GetNestedDataCompletedEventArgs e) {
                if (e.Error != null)
                {
                    Assert.Fail("Nested failed; error: {0}", e.Error);
                    throw e.Error;
                }
                Assert.AreEqual("D,E", ItemsToString(e.Result.Items.Cast <DataType1> ()), "Nested");
                Interlocked.Increment(ref passed);
                waits [2].Set();
            };
            nestedClient.GetNestedDataAsync();

            dbClient.JSMGetDatabasesCompleted += delegate(object sender, JSMGetDatabasesCompletedEventArgs e) {
                waits [3].Set();
                if (e.Error != null)
                {
                    throw e.Error;
                }
                Assert.AreEqual("databases", e.Result, "Databases");
                Interlocked.Increment(ref passed);
            };
            dbClient.JSMGetDatabasesAsync();

            WaitHandle.WaitAll(waits, TimeSpan.FromMinutes(1));
            if (passed != waits.Length)
            {
                Assert.Fail("Not all tests passed!");
            }
        }
Beispiel #51
0
        public void CreateTutoringTime()
        {
            ServiceReference1.Service1Client testService = new Service1Client();

            Assert.AreEqual(1, testService.CreateTutoringTime(DateTime.Now, 1, "10:00"));
        }
Beispiel #52
0
        private static void SaveMessage(string title, string textInput, DateTime date, Service1Client proxy, ref string choise)
        {
            if (title != "" || textInput != "")
            {
                try
                {
                    var message = new MessageModel()
                    {
                        Title         = title,
                        Body          = textInput,
                        DateOfMessage = date
                    };

                    proxy.SaveMessage(message);
                    Console.WriteLine("\nMessage saved!");

                    Console.Write("\nTo send another one push [y], else push any button " + "> ");
                    choise = Console.ReadLine().ToLower();
                }
                catch (FaultException ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
            else
            {
                Console.WriteLine("\nTitle or message body is missing, push any button to try again");
                Console.ReadKey();
            }
        }
Beispiel #53
0
        public void SubmitHomeworkTest()
        {
            ServiceReference1.Service1Client testService = new Service1Client();

            Assert.AreEqual(1, testService.SubmitHomework(2, 4, DateTime.Now, "Test Assignment"));
        }
        public ActionResult JSon()
        {
            string json = "";
            Service1Client client = new Service1Client();
            var query = client.getTbl_usuarios();
            if (query == null)
            {
                json += String.Format("\"{0}\"", "");
                json = "[" + json + "]";
                return Content(json);
            }
            List<string> lista = new List<string>();
            for (int i = 0; i < query.Count(); i++)
            {
                //if (!json.Equals("")) { json += ","; }
                string Usuario = query.ElementAt(i).primer_nombre + " " + query.ElementAt(i).primer_apellido + "|" + query.ElementAt(i).talento_humano;
                lista.Add(Usuario);
                //json += String.Format("\"{0}\"", Usuario);

            }

            json = "[" + json + "]";
               // return Content(json);
            return Json(lista, JsonRequestBehavior.AllowGet);
        }
 public ActionResult Edit(RolesModel model, string submitButton)
 {
     if (Session["User"] != null)
     {
         if (ModelState.IsValid)
         {
             Service1Client client = new Service1Client();
             switch (submitButton)
             {
                 case "Buscar":
                     var hola = client.getRol(model.id);
                     if (hola == null)
                     {
                         client.Close();
                         return View();
                     }
                     ViewBag.Desc = hola.descripcion;
                     ViewBag.id = hola.rolesid;
                     break;
                 case "Modificar":
                     client.editRol(model.id, model.descripcion);
                     break;
             }
             client.Close();
             return View();
         }
         return View();
     }
     else
         return RedirectToAction("Login", "Home");
 }
Beispiel #56
-5
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            window = new UIWindow (UIScreen.MainScreen.Bounds);
            navigation = new UINavigationController();
            dvc = new DialogViewController (createRoot ());
            navigation.PushViewController(dvc,false);
            window.RootViewController = navigation;
            window.MakeKeyAndVisible ();
            //Set a binding with a large timeout and allows a large data set
            var binding = new BasicHttpBinding (){Name= "basicHttp",MaxReceivedMessageSize = 67108864,};
            binding.ReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas(){
                MaxArrayLength = 2147483646,
                MaxDepth =32,
                MaxBytesPerRead = 4096,
                MaxNameTableCharCount = 5242880,
                MaxStringContentLength = 5242880,

            };
            //one hour timeout, this is way to long but you get the point
            var timeout = new TimeSpan(1,0,0);
            binding.SendTimeout= timeout;
            binding.OpenTimeout = timeout;
            binding.ReceiveTimeout = timeout;

            client = new Service1Client (binding, new EndpointAddress ("http://192.168.2.8/WcfWebApp/Service1.svc"));
            client.GetUsersCompleted += HandleClientGetUsersCompleted;
            client.GetTasksCompleted += HandleClientGetTasksCompleted;
            client.UploadImageCompleted += HandleClientUploadImageCompleted;
            client.ConvertToByteArrayCompleted += HandleClientConvertToByteArrayCompleted;

            loading = new MBProgressHUD();
            loading.TitleText = "Loading";
            return true;
        }
 public ActionResult Index(RolesModel model)
 {
     if (Session["User"] != null)
     {
         if (ModelState.IsValid)
         {
             Service1Client client = new Service1Client();
             List<int> idpermisos = splitCadenaID(model.permisosID);
             Session["Roles"] = model.descripcion;
             ViewBag.rol = Session["Roles"];
             if(idpermisos==null)
                 return View();
             client.addRole(model.descripcion);
             foreach (var item in idpermisos)
             {
                 client.addRoles_Permisos(client.getUltimoId_Roles(),item);
             }
            client.Close();
         }
         return View();
     }
     else
     {
         return RedirectToAction("Login", "Home");
     }
 }
 protected override void OnStartup(StartupEventArgs e)
 {
     var svcS1 = new Service1Client();
     var d = svcS1.GetData();
     var svcS2 = new Service2Client();
     svcS2.SetData(d);
 }
 protected void btnFilter_Click(object sender, EventArgs e)
 {
     using (Service1Client client = new Service1Client())
     {
         int Yil=0;
         int IstekNo=0;
         if(txtFilterYil.Text.Trim()!=string.Empty)
         {
             Yil=int.Parse(txtFilterYil.Text.Trim());
         }
         if(txtFilterIstekNo.Text.Trim()!=string.Empty)
         {
             IstekNo=int.Parse(txtFilterIstekNo.Text.Trim());
         }
         rdgvFairmadanGelenIstekler.DataSource = client.FirmaIDdenFirmadanGelenIstekleriDonGenel(int.Parse(Session["IstekleriGosterilecekFirmaId"].ToString()), Yil, IstekNo);
         rdgvFairmadanGelenIstekler.DataBind();
         if (TekIstekIcerigimiGoruntuleniyor())
         {
             lnkFirmaTeiketi.Enabled = true;
             lnkCihazTeslimRaporu.Enabled = true;
         }
         else
         {
             lnkFirmaTeiketi.Enabled = false;
             lnkCihazTeslimRaporu.Enabled = false;
         }
     }
 }
        // Constructor
        public MainPage()
        {
            InitializeComponent();
			if(App.Phone != null && App.Phone.Length > 0) GoToIndex();
			ws = new Service1Client();
			ws.ContatoAdicionarCompleted += Ws_ContatoAdicionarCompleted;
        }