Esempio n. 1
1
        async Task<bool> UploadDB()
        {
            try
            {
            ServiceReference1.IService1 s = new ServiceReference1.Service1Client();
            Windows.Storage.StorageFolder storageFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
            Windows.Storage.StorageFile sampleFile = await storageFolder.GetFileAsync("SQLITEV2.sqlite");

            byte[] result;
            using (Stream stream = await sampleFile.OpenStreamForReadAsync())
            {
                using (var memoryStream = new MemoryStream())
                {
                    stream.CopyTo(memoryStream);
                    result = memoryStream.ToArray();
                }
            }

            await s.UploadFileAsync(result);

                return true;
            }
            catch (Exception)
            {
                return false;
                throw;
            }


        }
Esempio n. 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     var client = new ServiceReference1.Service1Client();
     var list = client.getPreviews();
     gdPreview.DataSource = list;
     gdPreview.DataBind();
 }
Esempio n. 3
0
 private void AllContacts_Button_Click(object sender, RoutedEventArgs e)
 {
     using (var db = new ServiceReference1.Service1Client())
     {
         ContactsGrid.ItemsSource = db.GetFullAddrs();
     }
 }
Esempio n. 4
0
 private void Add_Button_Click(object sender, RoutedEventArgs e)
 {
     using (var db = new ServiceReference1.Service1Client())
     {
         LogBlock.Text+="Add new row: " + db.AddNewName(fio.Text, tel.Text) + ("\n");
     }
 }
Esempio n. 5
0
 static void Main(string[] args)
 {
     var client = new ServiceReference1.Service1Client();
     var result = client.GetData(5);
     Console.WriteLine(result);
     Console.ReadLine();
 }
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         ServiceReference1.Station station = new ServiceReference1.Station();
         station.Station_Name = txtNamestation.Text;
         station.Longtitude = Convert.ToDouble(txtLong.Text);
         station.Latitude = Convert.ToDouble(txtLa.Text);
         if (rbtn1.Checked)
         {
             station.Status = rbtn1.Text;
         }
         else
         {
             station.Status = rbtn2.Text;
         }
         ServiceReference1.Service1Client sr = new ServiceReference1.Service1Client();
         if (Check_Name() == false)
         {
             ScriptManager.RegisterStartupScript(this, GetType(), "Thông báo", "alert('This station has already existed. Please check the coordinate or the name of the station again !!!');", true);
         }
         else
         {
             if (sr.Add_Stations(station) == 1)
             {
                 ScriptManager.RegisterStartupScript(this, GetType(), "Thông báo", "alert('Add successed !!!');", true);
                 Reset();
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this, GetType(), "Thông báo", "alert('Add failed !!!');", true);
             }
         }
     }
 }
Esempio n. 7
0
 public MainPage()
 {
     InitializeComponent();
     ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();
     client.getUsernamesAsync();
     client.getUsernamesCompleted += client_getUsernamesCompleted;
 }
 protected void btnlogin_Click(object sender, EventArgs e)
 {
     var user = new ServiceReference1.Service1Client().Get_User_By_UserName_v2(txtusername.Text);
     if (user != null && txtmail.Text == user.Email)
     {
         try
         {
             new CheckValidate.CheckDataValidate().send_Mail(user.Username, user.Email, "Message from ONLINE RAILWAY RESERVATION SYSTEM", "<h2 style='color:#0091d4; text-align:center'>ONLINE RAILWAY RESERVATION SYSTEM</h2><br/> " + "<h3 style='text-align:center; font-weight:bold'>YOUR NEW PASSWORD</h3><br/><br/>" + "Username: "******"<br/>" + "Password: "******"SHA1"); // encrypt password
             ServiceReference1.User u = new ServiceReference1.User();
             u.Username = user.Username;
             u.Password = pass;
             if(new ServiceReference1.Service1Client().Update_Password(u) == 1){
                 lblkq.Text = "Check mail to receive new password";
             }
         }
         catch (Exception)
         {
             ScriptManager.RegisterStartupScript(this, GetType(), "Thông báo", "alert('Can not send mail !!!');", true);
         }
     }
     else
     {
         lblkq.Text = "Username or email are incorrect";
     }
 }
    protected void dgCoaches_ItemCommand(object source, DataGridCommandEventArgs e)
    {
        Label lbl = (Label)e.Item.FindControl("lblid");
        id = int.Parse(lbl.Text);
        ServiceReference1.Service1Client sv = new ServiceReference1.Service1Client();
        ServiceReference1.get_Coach_By_ID_Result coaches = sv.Get_Coach_By_ID(id);
        // get train name
        string trainname = sv.get_Train_By_ID(int.Parse(coaches.Train_ID.ToString())).Train_Name;
        // show data
        ddlTrainName.SelectedValue = coaches.Train_ID.ToString();
        ddlCoachesType.SelectedItem.Text = coaches.Coach_Type;
        txtSeats.Text = coaches.Number_Of_Seats.ToString();
        _train_id = int.Parse(coaches.Train_ID.ToString());
        txtPrices.Text = coaches.Price.ToString();
        if (coaches.Status.ToString() == "Active")
        {
            RadioButton1.Checked = true;
            RadioButton2.Checked = false;
        }
        else
        {
            RadioButton2.Checked = true;
            RadioButton1.Checked = false;
        }

        ddlTrainName.Enabled = false;
        ddlCoachesType.Enabled = false;
        btnUpdate.Visible = true;
        btnDelete.Visible = true;
        btnCancel.Visible = true;
        btnAdd.Visible = false;
    }
Esempio n. 10
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     ServiceReference1.Service1Client ob = new ServiceReference1.Service1Client();
     Label1.Text = searchkey;
     Label1.Text = ob.NewsFocusService(searchkey);
     Label1.Visible = true;
 }
Esempio n. 11
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     int check = 0;
     if (isEmail(username.Text) == false)
     {
         MessageBox.Show("Email is not correct!");
     }
     else if (userpass.Password.Trim().Length == 0)
     {
         MessageBox.Show("Write a password!");
     }
     else
     {
         for (int i = 0; i < userList.Count; i++)
         {
             if (username.Text == userList[i].username)
             {
                 if (userpass.Password == userList[i].password)
                 {
                     userID = userList[i].ID_user;
                     loginpanel.Visibility = Visibility.Collapsed;
                     tabPanel.Visibility = Visibility.Visible;
                     check = 1;
                     ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();
                     client.getSnakeScoreDataAsync(userID);
                     client.getSnakeScoreDataCompleted += client_getSnakeScoreDataCompleted;
                 }
             }
         }
         if (check == 0)
         {
             MessageBox.Show("Incorrect password or username!");
         }
     }
 }
        protected void btnAddOffice2_Click(object sender, EventArgs e)
        {
            setAttributes();

            ServiceReference1.Service1Client x = new ServiceReference1.Service1Client();

            ServiceReference1.CompositeOffice office = new ServiceReference1.CompositeOffice();
            office.Adress = Address;
            office.City = City;

            int CID = Convert.ToInt32(ddlCountry.SelectedValue);

            //office.Country = ddlCountry.SelectedItem;
            int n;
            bool r = int.TryParse(OrgNumber, out n);
            office.OrgNumber = n;
            int n2;
            bool r2 = int.TryParse(ZipCode, out n2);
            office.ZipCode = n2;
            office.Name = OfficeName;
            office.CID = CID;

            x.SaveOffice(office);

            buttonsAddOffice2();
            setFieldsEnabled(false);
            updateGW();
            resetFields();
        }
Esempio n. 13
0
        /// <summary>
        /// metod som hämtar alla kontakter för en viss användare
        /// beroende på om en förfrågan blivit accepterad eller ej
        /// sorteras resultatet i två listor som visas i en varsin
        /// gridviewv.
        /// </summary>
        private void dataBind()
        {
            var client = new ServiceReference1.Service1Client();
            var currentUser = WebProfile.Current.UserName;
            var kontakter = client.getKontakter(currentUser);
            var requestList = new List<ServiceReference1.Kontakter>();
            var friendsList = new List<ServiceReference1.Kontakter>();

            foreach (var k in kontakter)
            {

                if (k.Request == 1) //1 = förfrågan
                {
                        requestList.Add(k);
                }
                else // accepterade kontakter
                {
                        friendsList.Add(k);

                }
            }
            gdRequest.DataSource = requestList;
            gdRequest.DataBind();
            gdFriends.DataSource = friendsList;
            gdFriends.DataBind();
        }
Esempio n. 14
0
        static void Main(string[] args)
        {
            // client config..

            ServiceReference1.Service1Client myClient = new ServiceReference1.Service1Client();
            try
            {

                myClient.Open();

                for (int x = 2; x < 12; x++)
                {
                    Console.WriteLine(myClient.GetData(x));
                    Thread.Sleep(1000);
                }
            }
            catch(Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine("Stack Trace======================");
                Console.WriteLine(e.StackTrace);
            }


            myClient.Close();


        }
Esempio n. 15
0
        // GET: Jedi
        public ActionResult Index()
        {
         ServiceReference1.Service1Client name = new ServiceReference1.Service1Client();
         var list = name.GetJediList();

            return View(list);
        }
Esempio n. 16
0
 private void Form1_Load(object sender, EventArgs e)
 {
     ServiceReference1.Service1Client DataSvc = 
         new ServiceReference1.Service1Client();
     northwindDataSet.Customers.Merge(DataSvc.GetCustomers());
     northwindDataSet.Orders.Merge(DataSvc.GetOrders());
 }
Esempio n. 17
0
        static void Main(string[] args)
        {
            ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();

            try
            {
                string retorno = client.GetData(1232);

                Console.WriteLine(retorno);
            }
            catch (EndpointNotFoundException e)
            {
                Console.WriteLine("Servidor desligado");
            }
            catch (Exception e)
            {
                Console.WriteLine("Deu algo errado");
            }
            finally
            {
                Console.WriteLine("Finalizou");
            }

            Console.Read();
        }
Esempio n. 18
0
 public ActionResult Parse()
 {
     ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client();
     proxy.runParce();
     proxy.Close();
     return RedirectToAction("Index","Home");
 }
Esempio n. 19
0
        static void Main(string[] args)
        {
            Console.WriteLine("Processing Started at: " + DateTime.Now);
            ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client();
            //Web2String.ServiceClient proxy = new Web2String.ServiceClient();

            string websiteAddress = "http://www.example.com";
            string[] topTen;
            topTen = proxy.topTen(websiteAddress);

            //string[] wholeWebsiteParsed = wholeWebsite.Split(' ');
            foreach (string word in topTen)
            {
                Console.WriteLine(word);
            }
            Console.WriteLine("Processing Finished at: " + DateTime.Now);

            ServiceReference2.Service1Client proxy2 = new ServiceReference2.Service1Client();
            string test = "hello, i am the dude is the .... my bad <help>";
            string wordsFiltered = proxy2.WordFilter(test);

            Console.WriteLine("Unfiltered string:");
            Console.WriteLine(test);
            Console.WriteLine("Filtered string:");
            Console.WriteLine(wordsFiltered);
            Console.ReadLine();
        }
Esempio n. 20
0
        protected void LoadMissions()
        {
            using (var client = new ServiceReference1.Service1Client())
            {

                List<UppdragStatus> missionList = new List<UppdragStatus>();
                //String currUser = HttpContext.Current.User.Identity.Name;

                //int eid = client.GetEmployeeByIdNumber(currUser);

                //missionList = client.GetMissionsByEid(eid);

                uppdrag.Mission.Description = "CGI";
                uppdrag.Mission.StartDate = DateTime.Today;
                uppdrag.Mission.EID = 1;
                uppdrag.Mission.MID = 1;
                uppdrag.TravelOrder.Sent = false;
                uppdrag.TravelOrder.Approved = false;
                uppdrag.TravelOrder.Answered = false;

                //Sent, Ap, An
                // Skickad      1, 0, 0
                // Ej godkänd   1, 0, 1
                // Godkänd      1, 1, 1
                // Ej skickad   0, 0, 0

                missionList.Add(uppdrag);

                GridView1.DataSource = missionList;
                GridView1.DataBind();

            }
        }
Esempio n. 21
0
        static void Main(string[] args)
        {
            ServiceReference1.Service1Client SvcProxy = new ServiceReference1.Service1Client("tcpWcfSvcLib1EP");
            SvcProxy.Open();

            //2,147,483,647
            byte[] valuesBytes;
            valToTransfer[] mivs = null;

            for (int x = 0; x < TEST_COUNT; x++)
            {
                DateTime startTime = DateTime.Now;
                valuesBytes = SvcProxy.GetData();
                mivs = HandDeserialize(valuesBytes);
                DateTime endTime = DateTime.Now;
                TimeSpan ts = new TimeSpan(endTime.Ticks - startTime.Ticks);
                aggregateMilliseconds += ts.Milliseconds;

                Console.WriteLine("time for call:[" + ts.Milliseconds + "]");
                Console.WriteLine("size of data passed [" + valuesBytes.Length + "]");
                Console.WriteLine("packet number[" + mivs[0].struct2_data_len + "]"); // hijacked for testing purposes..
                Console.WriteLine("500th item audit[" + mivs[499].struct1_ulong1 + "]");
                Console.WriteLine("9000th item audit[" + mivs[8999].struct1_ulong1 + "]");
            }
            Console.WriteLine("avg time per call [" + aggregateMilliseconds/TEST_COUNT + "]");

            SvcProxy.Close();
        }
 protected void Button1_Click(object sender, EventArgs e)
 {
     string r = TextBox1.Text;
     ServiceReference1.Service1Client ob = new ServiceReference1.Service1Client();
     Label2.Text = ob.nearbyhotels(r);
     Label2.Visible = true;
 }
Esempio n. 23
0
 private void DangThucDon_Load(object sender, EventArgs e)
 {
     lv_dsketqua.Items.Clear();
     client = new ServiceReference1.Service1Client();
     client.TimnguoidangCompleted += new EventHandler<ServiceReference1.TimnguoidangCompletedEventArgs>(TimnguoidangCallBack);
     client.TimnguoidangAsync(Form1.username);
 }
        protected void btnAddMission2_Click(object sender, EventArgs e)
        {
            ServiceReference1.Service1Client x = new ServiceReference1.Service1Client();
            setFields();
            ServiceReference1.CompositeMission mission = new ServiceReference1.CompositeMission();
            mission.Description = Description;

            int oid = Convert.ToInt32(ddOffice.SelectedValue);
            ServiceReference1.CompositeOffice office = new ServiceReference1.CompositeOffice();
            office = x.GetOffice(oid);
            mission.OID = office.OID;

            int eid = Convert.ToInt32(ddEmployee.SelectedValue);
            ServiceReference1.CompositeEmployee employee = new ServiceReference1.CompositeEmployee();
            employee = x.GetEmployee(eid);
            mission.EID = employee.EID;

            mission.StartDate = Date;

            int manager = Convert.ToInt32(ddManager.SelectedValue);
            ServiceReference1.CompositeEmployee mana = new ServiceReference1.CompositeEmployee();
            mana = x.GetEmployee(manager);
            mission.Manager = mana.EID;

            x.SaveMission(mission);

            buttonsAddMission2();
            setFieldsEnabled(false);
            updateGW();
        }
 protected void btnAccess_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         string opass = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtCpass.Text, "SHA1");
         var oldpass = new ServiceReference1.Service1Client().Get_User_By_UserName_v2(Session["username"].ToString()).Password;
         if (opass != oldpass)
         {
             ScriptManager.RegisterStartupScript(this, GetType(), "Thông báo", "alert('Current Password is incorrect !!!');", true);
         }
         else
         {
             ServiceReference1.User user = new ServiceReference1.User();
             user.Username = Session["username"].ToString();
             string pass = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtNpass.Text, "SHA1");
             user.Password = pass;
             ServiceReference1.Service1Client sr = new ServiceReference1.Service1Client();
             if (sr.Update_Password(user) == 1)
             {
                 ScriptManager.RegisterStartupScript(this, GetType(), "Thông báo", "alert('Change successed !!!');", true);
                 Binding_data();
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this, GetType(), "Thông báo", "alert('Error: Try again !!!');", true);
             }
         }
     }        
 }
Esempio n. 26
0
 public ActionResult TestConnection()
 {
     ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client();
     ViewBag.Message = proxy.getResponse();
     proxy.Close();
     return View();
 }
Esempio n. 27
0
 private void bt_dangbai_Click(object sender, EventArgs e)
 {
     if (tb_monan.Text!=""&&tb_gia.Text!="")
     {
         ThucDon thd = new ThucDon();
         thd.IdNhaHang = nh.Id;
         thd.MonAn = tb_monan.Text;
         thd.NguyenLieu = tb_nguyenlieu.Text;
         thd.PhuongPhap = tb_phuongphap.Text;
         thd.Gia = int.Parse(tb_gia.Text);
         try
         {
             ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();
             client.DangThucDonCompleted += new EventHandler<ServiceReference1.DangThucDonCompletedEventArgs>(DangThucDonCallBack);
             client.DangThucDonAsync(thd);
         }
         catch
         {
             MessageBox.Show("Lỗi Dịch Vụ !", "Warning: ", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         MessageBox.Show("Bạn phải nhập tên và giá của món ăn");
     }
 }
 protected void Search_User(string user_name)
 {
     ServiceReference1.Get_User_By_UserName_v2_Result user = new ServiceReference1.Service1Client().Get_User_By_UserName_v2(user_name);
     username = user.Username;
     pass = user.Password;
     security_code = user.Security_Code;
     txtUsername.Text = user.Username;
     txtEmail.Text = user.Email;
     txtPhone.Text = user.Phone_Number;
     switch (user.Gender)
     {
         case "Male": rdMale.Checked = true;
             break;
         case "Female": rdFemale.Checked = true;
             break;
         case "Other": rdOther.Checked = true;
             break;
     }
     ddlUserType.SelectedValue = user.Role_ID.ToString();
     if (user.Role_Name == "Admin")
     {
         ddlUserType.Enabled = false;
         btnDelete.Visible = false;
     }
     else
     {
         ddlUserType.Enabled = true;
         btnDelete.Visible = true;
     }
     txtUsername.Enabled = false;
     btnAdd.Visible = false;
     btnUpdate.Visible = true;
     btnCancel.Visible = true;
 }
 // Constructor
 public MainPage()
 {
     InitializeComponent();
     ServiceReference1.Service1Client cliente = new ServiceReference1.Service1Client();
     cliente.GetDataCompleted += new EventHandler<ServiceReference1.GetDataCompletedEventArgs>(cliente_GetDataCompleted);
     cliente.GetDataAsync(100);
 }
 protected void Button2_Click(object sender, EventArgs e)
 {
     ServiceReference1.Service1Client crime = new ServiceReference1.Service1Client();
     string a = TextBox9.Text;
     int x= crime.CrimeData(a);
     TextBox10.Text = Convert.ToString(x);
 }
Esempio n. 31
0
 public ActionResult FollowedMember()
 {
     ServiceReference1.Service1Client      a       = new ServiceReference1.Service1Client();
     MvcProjesi.ServiceReference1.Member[] members = a.GetFollowed(Convert.ToInt32(Session["memberID"]));
     return(View(members));
 }
Esempio n. 32
0
 /// <summary>
 /// verifies if the email is in database or not
 /// </summary>
 /// <returns>a Bool value</returns>
 public bool verfiyEmail()
 {
     ServiceReference1.Service1Client serv = new ServiceReference1.Service1Client();
     isEMail = serv.verifyEmail(ReceiverEmail);
     return(isEMail);
 }
Esempio n. 33
0
 public JediController()
 {
     client = new ServiceReference1.Service1Client();
 }
Esempio n. 34
0
 public NewTerrainWindow()
 {
     InitializeComponent();
     client     = new ServiceReference1.Service1Client();
     addTerrain = new ServiceReference1.TerInfo();
 }
Esempio n. 35
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ServiceReference1.Service1Client service = new ServiceReference1.Service1Client();
            ServiceReference1.UserDetail     user    = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];

            if (user.AccessLvl == 1)
            {
                arrC = new string[9];
                arrP = new string[9];
                arrV = new int[9];

                ServiceReference1.reportVolunteers[] volunteers = service.getVolunteersByProvince();

                arrC[0] = "ZA-EC";
                arrC[1] = "ZA-FS";
                arrC[2] = "ZA-GT";
                arrC[3] = "ZA-NL";
                arrC[4] = "ZA-LP";
                arrC[5] = "ZA-MP";
                arrC[6] = "ZA-NC";
                arrC[7] = "ZA-NW";
                arrC[8] = "ZA-WC";

                arrP[0] = "Eastern Cape";
                arrP[1] = "Free State";
                arrP[2] = "Gauteng";
                arrP[3] = "KwaZulu-Natal";
                arrP[4] = "Limpopo";
                arrP[5] = "Mpumalanga";
                arrP[6] = "Northern Cape";
                arrP[7] = "North West";
                arrP[8] = "Western Cape";

                arrV[0] = 0;
                arrV[1] = 0;
                arrV[2] = 0;
                arrV[3] = 0;
                arrV[4] = 0;
                arrV[5] = 0;
                arrV[6] = 0;
                arrV[7] = 0;
                arrV[8] = 0;

                for (int a = 0; a < volunteers.Count(); a++)
                {
                    if (volunteers[a].Province.Equals("Eastern Cape"))
                    {
                        arrV[0] = volunteers[a].VolAmounts;
                    }
                    if (volunteers[a].Province.Equals("Free State"))
                    {
                        arrV[1] = volunteers[a].VolAmounts;
                    }
                    if (volunteers[a].Province.Equals("Gauteng"))
                    {
                        arrV[2] = volunteers[a].VolAmounts;
                    }
                    if (volunteers[a].Province.Equals("KwaZulu-Natal"))
                    {
                        arrV[3] = volunteers[a].VolAmounts;
                    }
                    if (volunteers[a].Province.Equals("Limpopo"))
                    {
                        arrV[4] = volunteers[a].VolAmounts;
                    }
                    if (volunteers[a].Province.Equals("Mpumalanga"))
                    {
                        arrV[5] = volunteers[a].VolAmounts;
                    }
                    if (volunteers[a].Province.Equals("Northern Cape"))
                    {
                        arrV[6] = volunteers[a].VolAmounts;
                    }
                    if (volunteers[a].Province.Equals("North West"))
                    {
                        arrV[7] = volunteers[a].VolAmounts;
                    }
                    if (volunteers[a].Province.Equals("Western Cape"))
                    {
                        arrV[8] = volunteers[a].VolAmounts;
                    }
                }
            }
        }
Esempio n. 36
0
 public JsonResult KategoriCek()
 {
     s = new ServiceReference1.Service1Client();
     s.Close();
     return(Json(s.KategoriListele()));
 }
Esempio n. 37
0
 public HomeController()
 {
     srv        = new ServiceReference1.Service1Client();
     rsaEncrypt = new RSACryptoServiceProvider(EncraptionKeySize);
 }
Esempio n. 38
0
 public ActionResult MemberTweets()
 {
     ServiceReference1.Service1Client     a      = new ServiceReference1.Service1Client();
     MvcProjesi.ServiceReference1.Tweet[] tweets = a.GetMemberTweet(Convert.ToInt32(Session["memberID"]));
     return(View(tweets));
 }
Esempio n. 39
0
 public ActionResult FavOfTweets(int id)
 {
     ServiceReference1.Service1Client a = new ServiceReference1.Service1Client();
     a.FavInsert(id, Convert.ToInt32(Session["memberID"]));
     return(RedirectToAction("Index"));
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            menu_statistics.Visible = false;
            menu_dashboard.Visible  = false;
            menu_home.Visible       = false;
            menu_login.Visible      = false;
            menu_register.Visible   = false;
            menu_user_list.Visible  = false;
            menu_login.Attributes.Remove("class");
            menu_home.Attributes.Remove("class");
            menu_register.Attributes.Remove("class");
            menu_faq.Attributes.Remove("class");
            menu_dashboard.Attributes.Remove("class");

            if (index.onPage)
            {
                menu_home.Attributes.Add("class", "current");

                menu_statistics.Visible = true;
            }
            if (login.onPage)
            {
                menu_login.Attributes.Add("class", "current");
            }
            if (RegisterPage.onPage)
            {
                menu_register.Attributes.Add("class", "current");
            }
            if (HelpPage.onPage)
            {
                menu_faq.Attributes.Add("class", "current");
            }
            if (DashboardPage.onPage)
            {
                menu_dashboard.Attributes.Add("class", "current");
            }
            if (UserListPage.onPage)
            {
                menu_user_list.Attributes.Add("class", "current");
            }
            if (ReportPage.onPage)
            {
            }
            if (HttpContext.Current.Session["User_lvl"] != null)
            {
                logo.HRef = "DashboardPage.aspx";
                menu_dashboard.Visible = true;
                menu_user_list.Visible = true;
                userPic.Visible        = true;

                ServiceReference1.UserDetail u = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
                viewProfile.HRef = "UserPage.aspx?userId=" + u.userValue.UserID;

                if (HttpContext.Current.Session["User_FistName"] == null)
                {
                    userNameP.InnerHtml = "Guest";
                }
                else
                {
                    userNameP.InnerHtml = (String)HttpContext.Current.Session["User_FistName"];
                }
            }
            else
            {
                logo.HRef = "HomePage.aspx";

                menu_home.Visible     = true;
                menu_login.Visible    = true;
                menu_register.Visible = true;
                userPic.Visible       = false;
            }

            try
            {
                ServiceReference1.Service1Client serv = new ServiceReference1.Service1Client();
                ServiceReference1.UserDetail     user = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
                ServiceReference1.FileClass      file = serv.getUserImage(user.userValue.UserID);
                MemoryStream ms = new MemoryStream(file.FileBytes, 0, file.FileBytes.Length);
                imgPP.ImageUrl = "data:image/jpg;base64," + Convert.ToBase64String(file.FileBytes);
            }
            catch (Exception ex)
            {
                imgPP.ImageUrl = "images/avatar1.png";
            }
        }
Esempio n. 41
0
 public ActionResult Index()
 {
     ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();
     return(View(client.HamtaAllaAnnonser()));
 }
        public ActionResult Details(int id, FormCollection formCollection)
        {
            Dictionary <string, string> objDictionary = new Dictionary <string, string>();

            Models.ProjectDetailsModel project = new Models.ProjectDetailsModel(id);
            foreach (string key in formCollection)
            {
                objDictionary.Add(key, formCollection.GetValue(key).AttemptedValue);
            }

            // make sure revenue exists
            if (!string.IsNullOrEmpty(objDictionary["Revenue_Percentage"]))
            {
                // make sure revenue is positive and non-zero
                if (decimal.Parse(objDictionary["Revenue_Percentage"]) <= 0)
                {
                    ModelState.AddModelError("Negative_Revenue_Return", "Please specify a positive non-zero value for revenue return");
                }
            }
            else
            {
                ModelState.AddModelError("Revenue_Return_NULL", "Please enter a revenue percentage to purchase with this PROC");
            }

            // make sure investment exists
            if (!string.IsNullOrEmpty(objDictionary["Investment_Amount"]))
            {
                // make sure investment is positive and nom-zero
                if (decimal.Parse(objDictionary["Investment_Amount"]) <= 0)
                {
                    ModelState.AddModelError("Negative_Investment", "Please enter a positive non-zero value for investment");
                }
            }
            else
            {
                ModelState.AddModelError("Investment_Amount_NULL", "Please enter a value for investment in this PROC");
            }

            // make sure we have a begin date
            if (string.IsNullOrEmpty(objDictionary["date_begin"]))
            {
                ModelState.AddModelError("begin_date_NULL", "please enter a start date");
            }

            // make sure we have an end date
            if (string.IsNullOrEmpty(objDictionary["date_end"]))
            {
                ModelState.AddModelError("end_date_NULL", "please enter an end date");
            }

            // make sure the dates make sense
            if (!string.IsNullOrEmpty(objDictionary["date_begin"]) && !string.IsNullOrEmpty(objDictionary["date_end"]))
            {
                if (DateTime.Parse(objDictionary["date_begin"]) > DateTime.Parse(objDictionary["date_end"]))
                {
                    ModelState.AddModelError("invalid_dates", "Please make sure the start date is before the end date for the PROC aggrement");
                }
            }

            // if no errors are present then submit the PROC
            if (!ModelState.Values.Any(x => x.Errors.Count > 0))
            {
                int new_PROC_Id = new ServiceReference1.Service1Client().create_PROC(
                    HttpContext.GetOwinContext().Authentication.User.FindFirst(ClaimTypes.Sid).Value,
                    //int.Parse(objDictionary["Investor_Id"]),
                    int.Parse(Session["Investor_Id"].ToString()),
                    int.Parse(objDictionary["Project_Id"]),
                    objDictionary
                    );
                return(Redirect(string.Format("/PROC/Details/{0}", new_PROC_Id)));
            }
            else
            {
                return(View(project));
            }
        }
Esempio n. 43
0
 public ActionResult TweetDelete(int id)
 {
     ServiceReference1.Service1Client a = new ServiceReference1.Service1Client();
     a.TweetDelete(id);
     return(RedirectToAction("Profile"));
 }
Esempio n. 44
0
 // GET: Customer
 public ActionResult Index()
 {
     ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();
     return(View(client.GetCustomers()));
 }
Esempio n. 45
0
 public ActionResult WhoAreInStaniel()
 {
     ServiceReference1.Service1Client      a       = new ServiceReference1.Service1Client();
     MvcProjesi.ServiceReference1.Member[] members = a.GetOtherMember(Convert.ToInt32(Session["memberID"]));
     return(View(members));
 }
Esempio n. 46
0
        public static void ComputeThread()
        {
            LogFileManager.ObjLog.info("计算线程开启");
            string path    = ConfigurationManager.AppSettings["ProjectFold"];
            string exename = ConfigurationManager.AppSettings["ComputeModelPath"];
            string proname = null;

            string[] Filenames = null;
            int      TaskID    = 0;
            string   path1     = null;
            string   path2     = null;

            string[] paths = null;
            while (true)
            {
                if (client != null)
                {
                    client.Close();
                }
                client = new ServiceReference1.Service1Client();
                ServiceReference1.TaskInfo Ti = null;
                try
                {
                    Ti = client.iGetMinTaskID();//取状态为零的最小ID值,没有的时候为什么不返回null
                }
                catch (System.TimeoutException e)
                {
                    LogFileManager.ObjLog.error(e.Message, e);
                    //client.iSetTaskState(Ti.TaskID, 0);
                    Thread.Sleep(10000);
                    continue;
                }
                catch (FaultException <ServiceReference1.WcfException> e)
                {
                    LogFileManager.ObjLog.error(e.Detail.message, e);
                    //client.iSetTaskState(Ti.TaskID, 0);
                    Thread.Sleep(10000);
                    continue;
                }
                catch (CommunicationException e)
                {
                    LogFileManager.ObjLog.error(e.Message, e);
                    //client.iSetTaskState(Ti.TaskID, 0);
                    Thread.Sleep(10000);
                    continue;
                }
                catch (Exception e)
                {
                    LogFileManager.ObjLog.error(e.Message, e);
                    //client.iSetTaskState(Ti.TaskID, 0);
                    Thread.Sleep(10000);
                    continue;
                }
                if (Ti == null)      //超时处理
                {
                    LogFileManager.ObjLog.debug("没有任务分配");
                    Thread.Sleep(10000);
                    continue;
                }

                try
                {
                    client.iSetTaskState(TaskID, 1);
                    Filenames = Ti.filenames;
                    TaskID    = Ti.TaskID;
                    proname   = Ti.ProName;
                    path1     = path + "\\" + proname + "\\";
                    //这里加一个迭代删除文件即可
                    if (Directory.Exists(path1))
                    {
                        DeleteDir(path1);
                        //Directory.Delete(filePath);
                    }
                    Directory.CreateDirectory(path1);
                    path2 = path1 + "result\\";
                    if (Directory.Exists(path2))
                    {
                        DeleteDir(path2);
                        //Directory.Delete(filePath);
                    }
                    Directory.CreateDirectory(path2);
                    paths = Ti.filepaths;
                    //  paths[3] = @"D:\projects\wang3\qifu2.ter";
                    LogFileManager.ObjLog.info("任务" + TaskID.ToString() + "开始");
                    LogFileManager.ObjLog.info("下载文件开始");
                    for (int i = 0; i < paths.Length; i++)            //下载工程文件
                    {
                        string       data = client.GetData(paths[i]); //异常检查
                        StreamWriter sw   = new StreamWriter(path1 + Filenames[i]);
                        sw.Write(data);
                        sw.Close();
                    }
                    LogFileManager.ObjLog.info("下载文件完毕");
                }
                catch (System.TimeoutException e)
                {
                    client.iSetTaskState(TaskID, 0);
                    LogFileManager.ObjLog.debug(e.Message, e);
                    LogFileManager.ObjLog.info("任务失败");
                    Directory.Delete(path1, true);
                    Thread.Sleep(10000);
                    continue;
                }
                catch (FaultException <ServiceReference1.WcfException> e)
                {
                    client.iSetTaskState(TaskID, 0);
                    LogFileManager.ObjLog.debug(e.Detail.message, e);
                    LogFileManager.ObjLog.info("任务失败");
                    Directory.Delete(path1, true);
                    Thread.Sleep(10000);
                    continue;
                }
                catch (CommunicationException e)
                {
                    client.iSetTaskState(TaskID, 0);
                    LogFileManager.ObjLog.debug(e.Message, e);
                    LogFileManager.ObjLog.info("任务失败");
                    Directory.Delete(path1, true);
                    Thread.Sleep(10000);
                    continue;
                }
                catch (Exception e)
                {
                    client.iSetTaskState(TaskID, 0);
                    LogFileManager.ObjLog.debug(e.Message, e);
                    LogFileManager.ObjLog.info("任务失败");
                    Directory.Delete(path1, true);
                    Thread.Sleep(10000);
                    continue;
                }
                //修改状态之前检测是否出现异常,出现异常进行删除重新请求

                //计算出现错误异常检测

                DirectoryInfo di       = new DirectoryInfo(path1);
                FileInfo[]    txfile   = di.GetFiles("*.tx");
                FileInfo[]    setupdir = di.GetFiles("*.setup");
                FileInfo[]    rxfile   = di.GetFiles("*.rx");
                FileInfo[]    terfile  = di.GetFiles("*.ter");
                if (txfile.Length != 0 && setupdir.Length != 0 && rxfile.Length != 0 && terfile.Length != 0)
                {
                    //RXSplit.FileSplit(rxfile[0].FullName);
                    //FileInfo[] srxfile = di.GetFiles("*.rx");
                    //for (int i = 0; i < srxfile.Length; i++)
                    //{
                    //ComputeContral CC = new ComputeContral(path1, setupdir[0].Name, terfile[0].Name, txfile[0].Name, srxfile[i].Name, path2, exename);
                    ComputeContral CC = new ComputeContral(path1, setupdir[0].Name, terfile[0].Name, txfile[0].Name, rxfile[0].Name, path2, exename);
                    LogFileManager.ObjLog.info("计算开始");
                    int a = CC.Compute();
                    LogFileManager.ObjLog.info("计算模块返回值是" + a.ToString());
                    if (a != 0)//检查计算模块,若出现问题退出本次循环,并将任务状态改为未处理  判断计算是否完成,计算超时处理还没处理
                    {
                        switch (a)
                        {
                        case -1:
                            LogFileManager.ObjLog.debug("计算内部失败");
                            break;

                        case 1:
                            LogFileManager.ObjLog.debug("计算文件读取失败");
                            break;

                        case 2:
                            LogFileManager.ObjLog.debug("计算文件内容错误");
                            break;

                        case 3:
                            LogFileManager.ObjLog.debug("计算API调用错误");
                            break;

                        case 21:
                            LogFileManager.ObjLog.debug("计算缺少licence");
                            break;

                        default: break;
                        }
                        LogFileManager.ObjLog.info("任务失败");
                        client.iSetTaskState(TaskID, 0);
                        Directory.Delete(path1, true);
                        Thread.Sleep(10000);
                        continue;
                    }
                    LogFileManager.ObjLog.info("计算结束");
                    //}
                }
                else
                {
                    LogFileManager.ObjLog.debug("缺少仿真必要文件");
                    client.iSetTaskState(TaskID, 0);
                    Directory.Delete(path1, true);
                    Thread.Sleep(10000);
                    continue;
                }
                try
                {
                    di = new DirectoryInfo(path2);
                    FileInfo[] resultfile = di.GetFiles();
                    string     resultpath = client.iGetTaskResultDir(TaskID);
                    if (resultfile.Length == 0)
                    {
                        LogFileManager.ObjLog.debug("没有计算结果");
                        client.iSetTaskState(TaskID, 0);
                        LogFileManager.ObjLog.info("任务失败");
                        Directory.Delete(path1, true);
                        Thread.Sleep(10000);
                        continue;
                    }
                    LogFileManager.ObjLog.info("上传文件开始");


                    //加上频率信息,将不同频率的结果文件放在主控不同文件夹下
                    int    a         = txfile[0].Name.LastIndexOf("_");
                    int    b         = txfile[0].Name.LastIndexOf(".");
                    string frequence = txfile[0].Name.Substring(a + 1, b - a - 1);
                    for (int i = 0; i < resultfile.Length; i++)
                    {
                        StreamReader sr   = new StreamReader(resultfile[i].FullName);
                        string       data = sr.ReadToEnd();
                        client.PutData(resultpath + "\\temp\\" + frequence, resultfile[i].Name, data);//先保存在temp文件夹中待合并
                        sr.Close();
                    }
                    //主要修改上面的一段
                    LogFileManager.ObjLog.info("上传文件结束");
                    client.iSetTaskState(TaskID, 2);
                    LogFileManager.ObjLog.info("本任务结束");
                }
                catch (System.TimeoutException e)
                {
                    client.iSetTaskState(TaskID, 0);
                    LogFileManager.ObjLog.debug(e.Message, e);
                    LogFileManager.ObjLog.info("任务失败");
                    Directory.Delete(path1, true);
                    Thread.Sleep(10000);
                    continue;
                }
                catch (FaultException <ServiceReference1.WcfException> e)
                {
                    client.iSetTaskState(TaskID, 0);
                    LogFileManager.ObjLog.debug(e.Detail.message, e);
                    LogFileManager.ObjLog.info("任务失败");
                    Directory.Delete(path1, true);
                    Thread.Sleep(10000);
                    continue;
                }
                catch (CommunicationException e)
                {
                    client.iSetTaskState(TaskID, 0);
                    LogFileManager.ObjLog.debug(e.Message, e);
                    LogFileManager.ObjLog.info("任务失败");
                    Directory.Delete(path1, true);
                    Thread.Sleep(10000);
                    continue;
                }
                catch (Exception e)
                {
                    client.iSetTaskState(TaskID, 0);
                    LogFileManager.ObjLog.debug(e.Message, e);
                    LogFileManager.ObjLog.info("任务失败");
                    Directory.Delete(path1, true);
                    Thread.Sleep(10000);
                    continue;
                }
                //要不要删除工程文件
            }
        }
Esempio n. 47
0
        /// <summary>
        /// This method is called and executed when the btnUpdate button is clicked.
        /// The user's information is updated
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnUpdata_Click(object sender, EventArgs e)
        {
            if ((int)HttpContext.Current.Session["User_lvl"] > 0 && (int)HttpContext.Current.Session["User_lvl"] < 8)
            {
                serv = new ServiceReference1.Service1Client();
                ServiceReference1.UserDetail user = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
                user.userValue.FirstName = txtFirstName.Text;
                user.userValue.LastName  = txtLastName.Text;

                if (ddlTitle.SelectedIndex > 0)
                {
                    user.userValue.Title = ddlTitle.SelectedItem.Text;
                }

                if (ddlDay1.SelectedIndex > 0 && ddlDay2.SelectedIndex > 0 && ddlMonth.SelectedIndex > 0 && ddlYear1.SelectedIndex > 0 && ddlYear2.SelectedIndex > 0 && ddlYear3.SelectedIndex > 0)
                {
                    string dateStr = ddlYear1.SelectedValue + ddlYear2.SelectedValue + ddlYear3.SelectedValue + "-" + ddlMonth.SelectedValue + "-" + ddlDay1.SelectedValue + ddlDay2.SelectedValue;
                    user.userValue.DateOfBirth = Convert.ToDateTime(dateStr);
                }

                if (ddlProvince.SelectedIndex > 0)
                {
                    user.userValue.Province = ddlProvince.SelectedItem.Text;
                }

                if (rbGender.SelectedIndex == 1)
                {
                    user.userValue.Gender = 'F';
                }
                if (rbGender.SelectedIndex == 0)
                {
                    user.userValue.Gender = 'M';
                }
                if (rbGender.SelectedIndex == 2)
                {
                    user.userValue.Gender = 'O';
                }

                if (fileUpProfilePic.HasFile)
                {
                    try
                    {
                        string filename = Path.GetFileName(fileUpProfilePic.FileName);
                        ServiceReference1.FileClass file = new ServiceReference1.FileClass();
                        file.FilePath  = filename;
                        file.FileBytes = fileUpProfilePic.FileBytes;
                        serv.addUserImage(file, user.userValue.UserID);
                    }
                    catch (Exception ex)
                    {
                    }
                }

                if (serv.UpdateProfile(user))
                {
                    HttpContext.Current.Session["User_FistName"] = user.userValue.FirstName;
                    lblIsValid.Text = "Updated";
                }
                else
                {
                    lblIsValid.Text = "Failed";
                }
            }
        }
Esempio n. 48
0
 public ActionResult GameDetails()
 {
     ServiceReference1.Service1Client obj = new ServiceReference1.Service1Client();
     return(View(obj.GetGameDetails()));
 }
        /// <summary>
        /// This method is called and executed when the page is loaded.
        /// This method retrieves and displays the donations that are specific to a user.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((int)HttpContext.Current.Session["User_lvl"] == 1 || (int)HttpContext.Current.Session["User_lvl"] == 2)
            {
                ServiceReference1.Service1Client      service   = new ServiceReference1.Service1Client();
                ServiceReference1.UserDetail          user      = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
                ServiceReference1.DonationRequester[] donations = service.getAllNDonationRequest(service.getNPOWithManager(user.userValue.UserID));

                DonationsTable.InnerHtml  = "";
                DonationsTable.InnerHtml += "<table style='width: 100%; border: solid #ddd; border-width: 1px 1px 1px 1px; clear: both; margin: 10px 0 30px; height: 0;'><tr style='border-bottom: solid #ddd; border-bottom-width: 1px; clear: both; margin: 10px 0 30px; height: 0;'><th style='text-align: left; margin-right: 10px'>Type</th><th style='text-align: left; margin-right: 10px'>Amount</th><th style='text-align: left; margin-right: 10px'>Description</th><th style='text-align: left; margin-right: 10px; width: 100px;'>Donation request date</th></tr>";

                DonationsTableOld.InnerHtml  = "";
                DonationsTableOld.InnerHtml += "<table style='width: 100%; border: solid #ddd; border-width: 1px 1px 1px 1px; clear: both; margin: 10px 0 30px; height: 0;'><tr style='border-bottom: solid #ddd; border-bottom-width: 1px; clear: both; margin: 10px 0 30px; height: 0;'><th style='text-align: left; margin-right: 10px'>Type</th><th style='text-align: left; margin-right: 10px'>Amount</th><th style='text-align: left; margin-right: 10px'>Description</th><th style='text-align: left; margin-right: 10px; width: 100px;'>Donation request date</th></tr>";

                numOfDons    = 0;
                numOfDonsOld = 0;

                foreach (ServiceReference1.DonationRequester r in donations)
                {
                    if (r.Inprogress)
                    {
                        numOfDonsOld++;
                    }
                    else
                    {
                        numOfDons++;
                    }
                }

                ServiceReference1.DonationRequester[] donationsNew = new ServiceReference1.DonationRequester[numOfDons];
                ServiceReference1.DonationRequester[] donationsOld = new ServiceReference1.DonationRequester[numOfDonsOld];
                int oldCount = 0;
                int newCount = 0;

                foreach (ServiceReference1.DonationRequester r in donations)
                {
                    if (r.Inprogress)
                    {
                        donationsOld[oldCount] = r;
                        oldCount++;
                    }
                    else
                    {
                        donationsNew[newCount] = r;
                        newCount++;
                    }
                }

                for (int a = 0; a < donations.Count(); a++)
                {
                    if (donations[a].Inprogress)
                    {
                        donationCSV += donations[a].Date.ToShortDateString() + "," + donations[a].Discription + "," + donations[a].Amount + "\n";
                    }
                }

                for (int a = (pageCount - 1) * 8; a < pageCount * 8; a++)
                {
                    if (a >= numOfDons)
                    {
                        break;
                    }

                    string type = "";

                    if (donationsNew[a].Donate.Type == 1)
                    {
                        type = "Monetary donation";
                    }
                    else if (donationsNew[a].Donate.Type == 2)
                    {
                        type = "Equipment donation";
                    }

                    if (!donationsNew[a].Inprogress)
                    {
                        if (searchStr.Equals(""))
                        {
                            DonationsTable.InnerHtml += "<tr><th style='text-align: left; margin-right: 10px;'>" + type + "</th><th style='text-align: right; padding-right: 10px;'>R " + donationsNew[a].Donate.Amount + "</th><th style='text-align: left; margin-right: 10px;'>" + donationsNew[a].Donate.Description + "</th><th style='text-align: left; margin-right: 10px;'>" + donationsNew[a].Donate.DonationDate.Value.ToShortDateString() + "</th></tr>";
                        }
                        else
                        {
                            int numOfDonsAdded = 0;
                            for (int b = 0; b < numOfDons; b++)
                            {
                                if (numOfDonsAdded > 7)
                                {
                                    break;
                                }
                                if (donationsNew[b].Donate.Description.Contains(searchStr))
                                {
                                    if (!donationsNew[b].Inprogress)
                                    {
                                        DonationsTable.InnerHtml += "<tr><th style='text-align: left; margin-right: 10px;'>" + type + "</th><th style='text-align: right; padding-right: 10px;'>R " + donationsNew[b].Donate.Amount + "</th><th style='text-align: left; margin-right: 10px;'>" + donationsNew[b].Donate.Description + "</th><th style='text-align: left; margin-right: 10px;'>" + donationsNew[b].Donate.DonationDate.Value.ToShortDateString() + "</th></tr>";
                                        numOfDonsAdded++;
                                    }
                                }
                            }

                            searchStr      = "";
                            txtSearch.Text = "";
                            break;
                        }
                    }
                }

                DonationsTable.InnerHtml += "</table>";

                for (int a = (pageCountOld - 1) * 8; a < pageCountOld * 8; a++)
                {
                    if (a >= numOfDonsOld)
                    {
                        break;
                    }

                    string type = "";

                    if (donationsOld[a].Donate.Type == 1)
                    {
                        type = "Monetary donation";
                    }
                    else if (donationsOld[a].Donate.Type == 2)
                    {
                        type = "Equipment donation";
                    }

                    if (donationsOld[a].Inprogress)
                    {
                        if (searchStrOld.Equals(""))
                        {
                            DonationsTableOld.InnerHtml += "<tr><th style='text-align: left; margin-right: 10px;'>" + type + "</th><th style='text-align: right; padding-right: 10px;'>R " + donationsOld[a].Donate.Amount + "</th><th style='text-align: left; margin-right: 10px;'>" + donationsOld[a].Donate.Description + "</th><th style='text-align: left; margin-right: 10px;'>" + donationsOld[a].Donate.DonationDate.Value.ToShortDateString() + "</th></tr>";
                        }
                        else
                        {
                            int numOfDonsAdded = 0;
                            for (int b = 0; b < numOfDonsOld; b++)
                            {
                                if (numOfDonsAdded > 7)
                                {
                                    break;
                                }
                                if (donationsOld[b].Donate.Description.Contains(searchStrOld))
                                {
                                    if (donationsOld[b].Inprogress)
                                    {
                                        DonationsTableOld.InnerHtml += "<tr><th style='text-align: left; margin-right: 10px;'>" + type + "</th><th style='text-align: right; padding-right: 10px;'>R " + donationsOld[b].Donate.Amount + "</th><th style='text-align: left; margin-right: 10px;'>" + donationsOld[b].Donate.Description + "</th><th style='text-align: left; margin-right: 10px;'>" + donationsOld[b].Donate.DonationDate.Value.ToShortDateString() + "</th></tr>";
                                        numOfDonsAdded++;
                                    }
                                }
                            }

                            searchStrOld      = "";
                            txtSearchOld.Text = "";
                            break;
                        }
                    }
                }

                DonationsTableOld.InnerHtml += "</table>";
            }
        }
Esempio n. 50
0
        private void addTransmitterOk_button1_Click(object sender, EventArgs e)
        {
            client       = new ServiceReference1.Service1Client();
            matchAntenna = new ServiceReference1.Antenna();
            string matchAntennaName = null;

            if (MainWindow.mProjectFullName == null)
            {
                this.Close();
                return;
            }
            //判断添加辐射源之前是否添加了地形
            if (!ConditionIsAll(MainWindow.nodeInfoFullPath))
            {
                MessageBox.Show("请先添加地形之后再添加辐射源!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MainWindow.IsReturnMidwayInNewProcess = true;
                return;
            }
            //判断工程波形中是否添加波形
            if (addTransmitterWaveformName_comboBox1.Items.Count > 0)
            {
                if (addTransmitterWaveformName_comboBox1.SelectedItem == null)
                {
                    MessageBox.Show("辐射源未设置波形", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    MainWindow.IsReturnMidwayInNewProcess = true;
                    return;
                }
            }
            else
            {
                MessageBox.Show("请先在工程中添加波形!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MainWindow.IsReturnMidwayInNewProcess = true;
                return;
            }
            if (addTransmitterName_comboBox4.SelectedItem == null || addTransmitterCoordinateSystem_comboBox1.SelectedItem == null || addTransmitterLongitude_textBox2.Text == "" || addTransmitterLatitude_textBox3.Text == "" || addTransimtterReferencePlane_comboBox2.SelectedItem == null || addTransmitterInputPower_textBox11.Text == "" || addTransmitterAntennaName_textBox1.Text == "" || addTransmitterWaveformName_comboBox1.SelectedItem == null || addTransmitterAntennaRotateX_textBox7.Text == "" || addTransmitterAntennaRotateY_textBox6.Text == "" || addTransmitterAntennaRotateZ_textBox5.Text == "")
            {
                MessageBox.Show("窗口中有未设置的信息", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MainWindow.IsReturnMidwayInNewProcess = true;
                return;
            }
            if (!BoudingLimition.IsScienceFigure(addTransmitterInputPower_textBox11.Text))
            {
                MessageBox.Show("发射功率值输入必须是实数", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MainWindow.IsReturnMidwayInNewProcess = true;
                return;
            }
            if (double.Parse(addTransmitterInputPower_textBox11.Text) < 0.000)
            {
                MessageBox.Show("发射功率值需大于0.000", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MainWindow.IsReturnMidwayInNewProcess = true;
                return;
            }
            if (!BoudingLimition.IsScienceFigure(addTransmitterAntennaRotateX_textBox7.Text))
            {
                MessageBox.Show("天线关于X轴旋转角度值输入必须是实数", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MainWindow.IsReturnMidwayInNewProcess = true;
                return;
            }
            if (!BoudingLimition.IsScienceFigure(addTransmitterAntennaRotateY_textBox6.Text))
            {
                MessageBox.Show("天线关于Y轴旋转角度值输入必须是实数", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MainWindow.IsReturnMidwayInNewProcess = true;
                return;
            }
            if (!BoudingLimition.IsScienceFigure(addTransmitterAntennaRotateZ_textBox5.Text))
            {
                MessageBox.Show("天线关于Z轴旋转角度值输入必须是实数", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MainWindow.IsReturnMidwayInNewProcess = true;
                return;
            }
            if (BoudingLimition.RotationLimition(addTransmitterAntennaRotateX_textBox7))
            {
                MessageBox.Show("天线关于X轴旋转角度值需在0度至360度之间", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MainWindow.IsReturnMidwayInNewProcess = true;
                return;
            }
            if (BoudingLimition.RotationLimition(addTransmitterAntennaRotateY_textBox6))
            {
                MessageBox.Show("天线关于Y轴旋转角度值需在0度至360度之间", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MainWindow.IsReturnMidwayInNewProcess = true;
                return;
            }
            if (BoudingLimition.RotationLimition(addTransmitterAntennaRotateZ_textBox5))
            {
                MessageBox.Show("天线关于Z轴旋转角度值需在0度至360度之间", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MainWindow.IsReturnMidwayInNewProcess = true;
                return;
            }
            //判断是否存在.tx文件
            if (File.Exists(MainWindow.projectRealPath + "\\" + MainWindow.onlyProjectName + ".tx"))
            {
                WaveformWriting transm = new WaveformWriting(FileOperation.ReadFile(MainWindow.nodeInfoFullPath));
                //注意 新建的辐射源个数不能超过1000
                string[] transmitterNames = new string[1000];
                //判断是否存在重名的辐射源
                transmitterNames = transm.waveformNames(SetupContent.transmitterIndeStr);
                if (transm.judge((string)addTransmitterName_comboBox4.SelectedItem, transmitterNames))
                {
                    MessageBox.Show("此辐射源已存在", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            //将数据库中与辐射源匹配的天线写入setupStr中
            try
            {
                matchAntenna = client.iGetAntenna(addTransmitterAntennaName_textBox1.Text);
                //与辐射源匹配的天线名称
                matchAntennaName = matchAntenna.Name + "_DB" + (string)addTransmitterName_comboBox4.SelectedItem;

                //准备好插入的内容
                string[] AntennaStr = new string[8];
                AntennaStr[0] = SetupContent.antennaStr1 + " " + matchAntennaName + "\r\n";
                AntennaStr[1] = matchAntenna.Type + "\r\n";
                AntennaStr[3] = "power_threshold " + matchAntenna.RecieveThrehold + "\r\n";
                AntennaStr[4] = "cable_loss " + matchAntenna.TransmissionLoss + "\r\n";
                AntennaStr[5] = "VSWR " + matchAntenna.VSWR + "\r\n";
                AntennaStr[6] = "temperature " + matchAntenna.Temperature + "\r\n";
                switch (matchAntenna.Type)
                {
                case "type HalfWaveDipole":
                {
                    AntennaStr[2] = "polarization " + matchAntenna.Polarization + "\r\n";
                    AntennaStr[7] = SetupContent.antennaStr2 + "\r\n" + SetupContent.antennaStr3 + "\r\n";

                    //将天线信息存储到.waveinfo文件中
                    string antennaInfoStr = SetupContent.antennaStr1 + " " + matchAntennaName + "\r\n"
                                            + Translate.KeyWordsDictionary_DB(matchAntenna.Type) + "\r\n"
                                            //+ (string)addTransmitterWaveformName_comboBox1.SelectedItem + "\r\n"
                                            + matchAntenna.MaxGain + "\r\n"
                                            + matchAntenna.Polarization + "\r\n"
                                            + matchAntenna.RecieveThrehold + "\r\n"
                                            + matchAntenna.TransmissionLoss + "\r\n"
                                            + matchAntenna.VSWR + "\r\n"
                                            + matchAntenna.Temperature + "\r\n"
                                            + "END" + SetupContent.antennaStr1 + " " + matchAntennaName + "\r\n";
                    FileOperation.WriteFile(antennaInfoStr, MainWindow.waveinfoFilePath, true);
                }
                break;

                case "type linear_monopole":
                {
                    AntennaStr[2] = "";
                    AntennaStr[7] = SetupContent.antennaStr2 + "\r\n" + "length " + matchAntenna.Length + "\r\n" + SetupContent.antennaStr3 + "\r\n";

                    //将单极天线的参数按相应的顺序记录到waveinfo文件中
                    string antennaInfoStr = SetupContent.antennaStr1 + " " + matchAntennaName + "\r\n"
                                            + Translate.KeyWordsDictionary_DB(matchAntenna.Type) + "\r\n"
                                            + (string)addTransmitterWaveformName_comboBox1.SelectedItem + "\r\n"
                                            + matchAntenna.Length + "\r\n"
                                            + matchAntenna.MaxGain + "\r\n"
                                            + matchAntenna.RecieveThrehold + "\r\n"
                                            + matchAntenna.TransmissionLoss + "\r\n"
                                            + matchAntenna.VSWR + "\r\n"
                                            + matchAntenna.Temperature + "\r\n"
                                            + "END" + SetupContent.antennaStr1 + " " + matchAntennaName + "\r\n";
                    FileOperation.WriteFile(antennaInfoStr, MainWindow.waveinfoFilePath, true);
                }
                break;

                case "type Helical":
                {
                    AntennaStr[2] = "polarization " + matchAntenna.Polarization + "\r\n";
                    AntennaStr[7] = SetupContent.antennaStr2 + "\r\n"
                                    + "radius " + matchAntenna.Radius + "\r\n"
                                    + "length " + matchAntenna.Length + "\r\n"
                                    + "pitch " + matchAntenna.Pitch + "\r\n"
                                    + SetupContent.antennaStr3 + "\r\n";

                    string antennaInfoStr = SetupContent.antennaStr1 + " " + matchAntennaName + "\r\n"
                                            + Translate.KeyWordsDictionary_DB(matchAntenna.Type) + "\r\n"
                                            + (string)addTransmitterWaveformName_comboBox1.SelectedItem + "\r\n"
                                            + matchAntenna.Polarization + "\r\n"
                                            + matchAntenna.MaxGain + "\r\n"
                                            + matchAntenna.Radius + "\r\n"
                                            + matchAntenna.Length + "\r\n"
                                            + matchAntenna.Pitch + "\r\n"
                                            + matchAntenna.RecieveThrehold + "\r\n"
                                            + matchAntenna.TransmissionLoss + "\r\n"
                                            + matchAntenna.VSWR + "\r\n"
                                            + matchAntenna.Temperature + "\r\n"
                                            + "END" + SetupContent.antennaStr1 + " " + matchAntennaName + "\r\n";
                    FileOperation.WriteFile(antennaInfoStr, MainWindow.waveinfoFilePath, true);
                }
                break;

                case "type ParabolicReflector":
                {
                    AntennaStr[2] = "polarization " + matchAntenna.Polarization + "\r\n";
                    AntennaStr[7] = SetupContent.antennaStr2 + "\r\n"
                                    + "radius " + matchAntenna.Radius + "\r\n"
                                    + "blockageradius " + matchAntenna.BlockageRadius + "\r\n"
                                    + "EFieldDistribution " + matchAntenna.ApertureDistribution + "\r\n"
                                    + "EdgeTaper " + matchAntenna.EdgeTeper + "\r\n"
                                    + SetupContent.antennaStr3 + "\r\n";
                    //将抛物线天线相应的参数按控件顺序记录到waveinfo文件中
                    string antennaInfoStr = SetupContent.antennaStr1 + " " + matchAntennaName + "\r\n"
                                            + Translate.KeyWordsDictionary_DB(matchAntenna.Type) + "\r\n"
                                            + (string)addTransmitterWaveformName_comboBox1.SelectedItem + "\r\n"
                                            + matchAntenna.Polarization + "\r\n"
                                            + matchAntenna.Radius + "\r\n"
                                            + matchAntenna.BlockageRadius + "\r\n"
                                            + matchAntenna.ApertureDistribution + "\r\n"
                                            + matchAntenna.EdgeTeper + "\r\n"
                                            + matchAntenna.RecieveThrehold + "\r\n"
                                            + matchAntenna.TransmissionLoss + "\r\n"
                                            + matchAntenna.VSWR + "\r\n"
                                            + matchAntenna.Temperature + "\r\n"
                                            + "END" + SetupContent.antennaStr1 + " " + matchAntennaName + "\r\n";
                    FileOperation.WriteFile(antennaInfoStr, MainWindow.waveinfoFilePath, true);
                }
                break;

                case "对数周期天线":
                {
                }
                break;

                default:
                    break;
                }
                WaveformWriting Annt = new WaveformWriting(MainWindow.setupStr);
                MainWindow.setupStr = Annt.InsertAntenna8(AntennaStr, (string)addTransmitterWaveformName_comboBox1.SelectedItem, SetupContent.antennaStr3, SetupContent.waveFormStr3);
                //将与辐射源匹配的天线添加到工程树子节点
                MainWindow.staticTreeView.Nodes[0].Nodes[0].Nodes[2].Nodes.Add(matchAntennaName);
                //将天线的信息存储到.setup.info文件中
                FileOperation.WriteLineFile(SetupContent.antennaIndeStr + " " + matchAntennaName, MainWindow.nodeInfoFullPath, true);
            }
            catch (System.TimeoutException ex)
            {
                MessageBox.Show(ex.Message);
                LogFileManager.ObjLog.fatal(ex.Message, ex);
                client.Abort();
            }
            catch (FaultException <WcfException> ex)
            {
                MessageBox.Show(ex.Detail.message);
                LogFileManager.ObjLog.fatal(ex.Message, ex);
                client.Abort();
            }
            catch (CommunicationException ex)
            {
                MessageBox.Show(ex.Message);
                LogFileManager.ObjLog.fatal(ex.Message, ex);
                client.Abort();
            }
            catch (Exception exm)
            {
                MessageBox.Show(exm.Message);
                LogFileManager.ObjLog.fatal(exm.Message, exm);
                client.Abort();
            }

            string transmitterCount = GetTransmitterNum(MainWindow.projectRealPath + "\\" + MainWindow.onlyProjectName + ".tx", SetupContent.transmitterStr2OfTr);
            string sourceStr        = FileOperation.ReadFile(MainWindow.waveinfoFilePath);

            string trFileStr = SetupContent.transmitterStr1OfTr + " " + (string)addTransmitterName_comboBox4.SelectedItem + "\r\n"
                               + SetupContent.transmitterStr2OfTr + transmitterCount + "\r\n"
                               + SetupContent.transmitterStr3OfTr + "\r\n" + SetupContent.transmitterStr4OfTr + "\r\n"
                               + SetupContent.transmitterStr5OfTr + "\r\n" + SetupContent.transmitterStr6OfTr + "\r\n"
                               + SetupContent.transmitterStr7OfTr + "\r\n" + SetupContent.transmitterStr8OfTr + "\r\n"
                               + SetupContent.transmitterStr9OfTr + "\r\n" + SetupContent.transmitterStr10OfTr + "\r\n"
                               + SetupContent.transmitterStr11OfTr + "\r\n"
                               + SetupContent.transmitterStr12OfTr + MainWindow.longitudeStr + "\r\n"
                               + SetupContent.transmitterStr13OfTr + MainWindow.latitudeStr + "\r\n"
                               + SetupContent.transmitterStr14OfTr + "\r\n"
                               + Translate.KeyWordsDictionary(addTransimtterReferencePlane_comboBox2) + "\r\n"
                               + SetupContent.transmitterStr15OfTr + "\r\n"
                               + SetupContent.transmitterStr16OfTr + "\r\n"
                               //+ SetupContent.transmitterStr17OfTr + "\r\n"
                               + GetAntennaStr(MainWindow.transInfoFullPath, matchAntennaName)
                               + SetupContent.transmitterStr18OfTr + addTransmitterAntennaRotateX_textBox7.Text + "\r\n"
                               + SetupContent.transmitterStr19OfTr + addTransmitterAntennaRotateY_textBox6.Text + "\r\n"
                               + SetupContent.transmitterStr20OfTr + addTransmitterAntennaRotateZ_textBox5.Text + "\r\n"
                               + SetupContent.transmitterStr21OfTr + addTransmitterInputPower_textBox11.Text + "\r\n"
                               + SetupContent.transmitterStr22OfTr + "\r\n"
                               + SetupContent.transmitterStr23OfTr + "\r\n"
                               + SetupContent.transmitterStr24OfTr + " "
                               + WaveformNodeOfConMenu.GetWaveformNumLine((string)addTransmitterWaveformName_comboBox1.SelectedItem, sourceStr) + "MHZ" + "\r\n";

            FileOperation.WriteFile(trFileStr, MainWindow.projectRealPath + "\\" + MainWindow.onlyProjectName + ".tx", true);
            //写到setup文件中
            string sourceStrOfTr = FileOperation.ReadFile(MainWindow.projectRealPath + "\\" + MainWindow.onlyProjectName + ".tx");
            //找出辐射源的个数
            int transmitCount = WaveformWriting.GetCountOfMatchStr("begin_<points>", sourceStrOfTr);

            //如果已经存在了transmitter块,则先删除
            if (MainWindow.setupStr.LastIndexOf("end_<transmitter>") != -1)
            {
                MainWindow.setupStr = MainWindow.setupStr.Remove(MainWindow.setupStr.IndexOf("begin_<transmitter>"), MainWindow.setupStr.IndexOf("end_<transmitter>") - MainWindow.setupStr.IndexOf("begin_<transmitter>") + 19);
            }
            //将.tx路径信息插入到全局字符串setupStr中
            int    insertSiteOfTr = MainWindow.setupStr.LastIndexOf("end_<feature>") + 15;//15是end_<feature>\r\n后的第一个字符
            string insertStr      = SetupContent.transmitterStr1Ofsetup + "\r\n" + SetupContent.transmitterStr2Ofsetup
                                    + MainWindow.projectRealPath + "\\" + MainWindow.onlyProjectName + ".tx" + "\r\n"
                                    + SetupContent.transmitterStr3Ofsetup + transmitCount.ToString() + "\r\n"
                                    + SetupContent.transmitterStr4Ofsetup + "\r\n";

            MainWindow.setupStr = MainWindow.setupStr.Insert(insertSiteOfTr, insertStr);
            FileOperation.WriteFile(MainWindow.setupStr, MainWindow.mProjectFullName, false);



            //向工程树中添加结点信息
            MainWindow.staticTreeView.Nodes[0].Nodes[0].Nodes[3].Nodes.Add((string)addTransmitterName_comboBox4.SelectedItem);
            //将辐射源的信息存储到.setup.info文件中
            FileOperation.WriteLineFile(SetupContent.transmitterIndeStr + " " + (string)addTransmitterName_comboBox4.SelectedItem, MainWindow.nodeInfoFullPath, true);
            //将辐射源和天线的匹配关系记录到.match文件中
            FileOperation.WriteLineFile(SetupContent.transmitterIndeStr + " " + (string)addTransmitterName_comboBox4.SelectedItem + "*" + matchAntennaName, MainWindow.relationOfAntAndWavePath, true);

            //将辐射源的信息存储到.waveinfo文件中
            string transmitterInfoStr = SetupContent.transmitterStr1Ofsetup + " " + (string)addTransmitterName_comboBox4.SelectedItem + "\r\n"
                                        + addTransimtterReferencePlane_comboBox2.Text + "\r\n"
                                        + addTransmitterInputPower_textBox11.Text + "\r\n"
                                        + matchAntennaName + "\r\n"
                                        + (string)addTransmitterWaveformName_comboBox1.SelectedItem + "\r\n"
                                        + addTransmitterAntennaRotateX_textBox7.Text + "\r\n"
                                        + addTransmitterAntennaRotateY_textBox6.Text + "\r\n"
                                        + addTransmitterAntennaRotateZ_textBox5.Text + "\r\n"
                                        + "END" + SetupContent.transmitterStr1Ofsetup + " " + (string)addTransmitterName_comboBox4.SelectedItem + "\r\n";

            FileOperation.WriteFile(transmitterInfoStr, MainWindow.waveinfoFilePath, true);
            if (MainWindow.creatSuccMesDisp)
            {
                MessageBox.Show("辐射源" + (string)addTransmitterName_comboBox4.SelectedItem + "创建成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        /// <summary>
        /// Data for Businesses are captured and then sent to the the server to the stored in the database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnRegBus_Click(object sender, EventArgs e)
        {
            lblWrongText.Visible = false;
            lblReqField.Visible  = false;

            if (fupBus.HasFile)
            {
                if (!txtBusENum.Text.Equals("") && !txtBusName.Text.Equals("") && !txtBusStreet.Text.Equals("") && !txtBusSuburb.Text.Equals("") && !TxtBusCNumber.Text.Equals(""))
                {
                    try
                    {
                        ServiceReference1.Service1Client regBusServ = new ServiceReference1.Service1Client();
                        bool registrationSuccessful = false;

                        business                  = new Business(long.Parse(txtBusENum.Text), txtBusName.Text);
                        business.Street1          = txtBusStreet.Text;
                        business.Suburb1          = txtBusSuburb.Text;
                        business.Province1        = BusDDProvince.SelectedItem.Text;
                        business.ContactNumber1   = TxtBusCNumber.Text;
                        business.Industry1        = ddlBusIndustry.SelectedItem.Text;
                        business.OrganisaionType1 = 2;

                        orgNumber = int.Parse(txtBusENum.Text);

                        registrationSuccessful = regBusServ.addOrganisation(business.OrganisationNumber1, business.OrganisationName1, business.Street1, business.Suburb1, business.Province1, business.COUNTRY1, business.ContactNumber1, business.Industry1, business.OrganisaionType1);

                        string filename = Path.GetFileName(fupBus.FileName);
                        ServiceReference1.FileClass file = new ServiceReference1.FileClass();
                        file.FilePath  = filename;
                        file.FileBytes = fupBus.FileBytes;
                        regBusServ.addOrgFile(file, orgNumber);

                        if (fudBusP.HasFile)
                        {
                            string filePname = Path.GetFileName(fudBusP.FileName);
                            ServiceReference1.FileClass fileP = new ServiceReference1.FileClass();
                            fileP.FilePath  = filePname;
                            fileP.FileBytes = fudBusP.FileBytes;
                            regBusServ.addOrgImage(fileP, orgNumber);
                        }

                        if (registrationSuccessful == true)
                        {
                            regBusDiv.Visible = false;
                            regIndDiv.Visible = true;
                            lblTitleRI.Text   = "Business manager";
                        }
                        else if (registrationSuccessful == false)
                        {
                            lblRegMessage.Text = "Error occured when registering. Please make sure your email has not been registered previously.";
                        }
                    }
                    catch (Exception ex)
                    {
                        lblWrongText.Visible = true;
                    }
                }
                else
                {
                    lblReqField.Visible = true;
                }
            }
            else
            {
                lblReqField.Visible = true;
                lblReqField.Text    = "Please add a file to proof the existance of your NPO!";
            }
        }
Esempio n. 52
0
 public void timeOut(object source, ElapsedEventArgs e)
 {
     ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();
     client.HeartBeat(guid, GetIPAdress());
     client.Abort();
 }
Esempio n. 53
0
        /// <summary>
        /// This method is called and executed when the page is loaded.
        /// A list of all the users is generated and displayed.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((int)HttpContext.Current.Session["User_lvl"] > 0 && (int)HttpContext.Current.Session["User_lvl"] < 8)
            {
                divInd.Visible = true;
                divBus.Visible = true;
                divNPO.Visible = true;

                if ((int)HttpContext.Current.Session["User_lvl"] == 1 || (int)HttpContext.Current.Session["User_lvl"] == 2 || (int)HttpContext.Current.Session["User_lvl"] == 3 || (int)HttpContext.Current.Session["User_lvl"] == 4 || (int)HttpContext.Current.Session["User_lvl"] == 5)
                {
                    divInd.Visible = false;
                }

                onPage               = true;
                index.onPage         = false;
                RegisterPage.onPage  = false;
                HelpPage.onPage      = false;
                login.onPage         = false;
                DashboardPage.onPage = false;

                ServiceReference1.Service1Client serv      = new ServiceReference1.Service1Client();
                ServiceReference1.User[]         usersList = serv.getUsers();

                divIndTable.InnerHtml  = "";
                divIndTable.InnerHtml += "<table style='width: 100%; border: solid #ddd; border-width: 1px 1px 1px 1px; clear: both; margin: 10px 0 30px; height: 0;'>";
                divIndTable.InnerHtml += "<tr style='width: 100%; border-bottom: solid #ddd; border-bottom-width: 1px; clear: both; margin: 10px 0 30px; height: 0;'><th style='text-align: left; margin-right: 10px;'>Email</th><th style='text-align: left; margin-right: 10px;'>Name</th><th style='text-align: left; margin-right: 10px;'>Surname</th><th style='text-align: left; margin-right: 10px;'>User type</th></tr>";

                if (numOfInd < usersList.Count())
                {
                    numOfInd = usersList.Count();
                }

                for (int a = (pageCountInd - 1) * 10; a < pageCountInd * 10; a++)
                {
                    if (a >= numOfInd)
                    {
                        break;
                    }

                    if (searchStrInd.Equals(""))
                    {
                        if (usersList[a].BannedValue == false)
                        {
                            string type = "";

                            if (usersList[a].TypeValue == 1)
                            {
                                type = "NPO manager";
                            }
                            else if (usersList[a].TypeValue == 2)
                            {
                                type = "NPO financial manager";
                            }
                            else if (usersList[a].TypeValue == 3)
                            {
                                type = "Business manager";
                            }
                            else if (usersList[a].TypeValue == 4)
                            {
                                type = "Business financial manager";
                            }
                            else if (usersList[a].TypeValue == 5)
                            {
                                type = "Independent user";
                            }
                            else if (usersList[a].TypeValue == 6)
                            {
                                type = "System manager";
                            }
                            else if (usersList[a].TypeValue == 7)
                            {
                                type = "System administrator";
                            }

                            divIndTable.InnerHtml += "<tr><td><a href='UserPage.aspx?userId=" + usersList[a].IDValue + "'>" + usersList[a].EmailValue + "</a></td><td>" + usersList[a].FirstNameValue + "</td><td>" + usersList[a].LastNameValue + "</td><td>" + type + "</td></tr>";
                        }
                    }
                    else
                    {
                        int numOfIndsAdded = 0;
                        for (int b = 0; b < numOfInd; b++)
                        {
                            if (numOfIndsAdded > 9)
                            {
                                break;
                            }
                            if (usersList[b].BannedValue == false)
                            {
                                if (usersList[b].FirstNameValue.Contains(searchStrInd))
                                {
                                    string type = "";

                                    if (usersList[b].TypeValue == 1)
                                    {
                                        type = "NPO manager";
                                    }
                                    else if (usersList[b].TypeValue == 2)
                                    {
                                        type = "NPO financial manager";
                                    }
                                    else if (usersList[b].TypeValue == 3)
                                    {
                                        type = "Business manager";
                                    }
                                    else if (usersList[b].TypeValue == 4)
                                    {
                                        type = "Business financial manager";
                                    }
                                    else if (usersList[b].TypeValue == 5)
                                    {
                                        type = "Independent user";
                                    }
                                    else if (usersList[b].TypeValue == 6)
                                    {
                                        type = "System manager";
                                    }
                                    else if (usersList[b].TypeValue == 7)
                                    {
                                        type = "System administrator";
                                    }

                                    divIndTable.InnerHtml += "<tr><td><a href='UserPage.aspx?userId=" + usersList[b].IDValue + "'>" + usersList[b].EmailValue + "</a></td><td>" + usersList[b].FirstNameValue + "</td><td>" + usersList[b].LastNameValue + "</td><td>" + type + "</td></tr>";
                                    numOfIndsAdded++;
                                }
                            }
                        }

                        searchStrInd      = "";
                        txtSearchInd.Text = "";
                        break;
                    }
                }

                divIndTable.InnerHtml += "</table>";

                ServiceReference1.Service1Client orgServ = new ServiceReference1.Service1Client();
                ServiceReference1.Orga[]         orgList = orgServ.getOrganisations();

                divNPOTable.InnerHtml  = "";
                divNPOTable.InnerHtml += "<table style='width: 100%; border: solid #ddd; border-width: 1px 1px 1px 1px; clear: both; margin: 10px 0 30px; height: 0;'>";
                divNPOTable.InnerHtml += "<tr style='width: 100%; border-bottom: solid #ddd; border-bottom-width: 1px; clear: both; margin: 10px 0 30px; height: 0;'><th style='text-align: left; margin-right: 10px; width: 150px'>Name</th><th style='text-align: left; margin-right: 10px; width: 150px'>Industry</th><th style='text-align: left; margin-right: 10px; width: 100px'>Contact Number</th><th style='text-align: left; margin-right: 10px; width: 30px'>Verified</th></tr>";

                BusinessDiv.InnerHtml  = "";
                BusinessDiv.InnerHtml += "<table style='width: 100%; border: solid #ddd; border-width: 1px 1px 1px 1px; clear: both; margin: 10px 0 30px; height: 0;'>";
                BusinessDiv.InnerHtml += "<tr style='width: 100%; border-bottom: solid #ddd; border-bottom-width: 1px; clear: both; margin: 10px 0 30px; height: 0;'><th style='text-align: left; margin-right: 10px; width: 150px'>Name</th><th style='text-align: left; margin-right: 10px; width: 150px'>Industry</th><th style='text-align: left; margin-right: 10px; width: 100px'>Contact Number</th><th style='text-align: left; margin-right: 10px; width: 30px'>Verified</th></tr>";

                ArrayList npoAL = new ArrayList();
                ArrayList busAL = new ArrayList();

                // Depending on the type of organisation, it will be displayed in the correct place on the page
                foreach (ServiceReference1.Orga organisation in orgList)
                {
                    if (organisation.Banned == false)
                    {
                        if (organisation.Type == 1)
                        {
                            npoAL.Add(organisation);
                        }
                        else if (organisation.Type == 2)
                        {
                            busAL.Add(organisation);
                        }
                    }
                }

                ServiceReference1.Orga[] npoAr = (ServiceReference1.Orga[])npoAL.ToArray(typeof(ServiceReference1.Orga));
                ServiceReference1.Orga[] busAr = (ServiceReference1.Orga[])busAL.ToArray(typeof(ServiceReference1.Orga));

                if (numOfNPO < npoAr.Count())
                {
                    numOfNPO = npoAr.Count();
                }

                for (int a = (pageCountNPO - 1) * 8; a < pageCountNPO * 8; a++)
                {
                    if (a >= numOfNPO)
                    {
                        break;
                    }

                    if (searchStrNPO.Equals(""))
                    {
                        string verified = "";

                        if (npoAr[a].Verified)
                        {
                            verified = "Yes";
                        }
                        else
                        {
                            verified = "No";
                        }

                        divNPOTable.InnerHtml += "<tr><td><a href='UserPage.aspx?orgId=" + npoAr[a].OrgID + "'>" + npoAr[a].OrgName + "</a></td><td>" + npoAr[a].Industry + "</td><td>" + npoAr[a].ContactNum + "</td><td>" + verified + "</td></tr>";
                    }
                    else
                    {
                        int numOfNPOAdded = 0;
                        for (int b = 0; b < numOfNPO; b++)
                        {
                            if (numOfNPOAdded > 7)
                            {
                                break;
                            }

                            if (npoAr[b].OrgName.Contains(searchStrNPO))
                            {
                                string verified = "";

                                if (npoAr[b].Verified)
                                {
                                    verified = "Yes";
                                }
                                else
                                {
                                    verified = "No";
                                }

                                divNPOTable.InnerHtml += "<tr><td><a href='UserPage.aspx?orgId=" + npoAr[b].OrgID + "'>" + npoAr[b].OrgName + "</a></td><td>" + npoAr[b].Industry + "</td><td>" + npoAr[b].ContactNum + "</td><td>" + verified + "</td></tr>";

                                numOfNPOAdded++;
                            }
                        }

                        searchStrNPO      = "";
                        txtSearchNPO.Text = "";
                        break;
                    }
                }

                if (numOfBus < busAr.Count())
                {
                    numOfBus = busAr.Count();
                }

                for (int a = (pageCountBus - 1) * 8; a < pageCountBus * 8; a++)
                {
                    if (a >= numOfBus)
                    {
                        break;
                    }

                    if (searchStrBus.Equals(""))
                    {
                        string verified = "";

                        if (busAr[a].Verified)
                        {
                            verified = "Yes";
                        }
                        else
                        {
                            verified = "No";
                        }

                        BusinessDiv.InnerHtml += "<tr><td><a href='UserPage.aspx?orgId=" + busAr[a].OrgID + "'>" + busAr[a].OrgName + "</a></td><td>" + busAr[a].Industry + "</td><td>" + busAr[a].ContactNum + "</td><td>" + verified + "</td></tr>";
                    }
                    else
                    {
                        int numOfBusAdded = 0;
                        for (int b = 0; b < numOfBus; b++)
                        {
                            if (numOfBusAdded > 7)
                            {
                                break;
                            }

                            if (busAr[b].OrgName.Contains(searchStrBus))
                            {
                                string verified = "";

                                if (busAr[b].Verified)
                                {
                                    verified = "Yes";
                                }
                                else
                                {
                                    verified = "No";
                                }

                                BusinessDiv.InnerHtml += "<tr><td><a href='UserPage.aspx?orgId=" + busAr[b].OrgID + "'>" + busAr[b].OrgName + "</a></td><td>" + busAr[b].Industry + "</td><td>" + busAr[b].ContactNum + "</td><td>" + verified + "</td></tr>";

                                numOfBusAdded++;
                            }
                        }

                        searchStrBus      = "";
                        txtSearchBus.Text = "";
                        break;
                    }
                }

                divNPOTable.InnerHtml += "</table>";
                BusinessDiv.InnerHtml += "</table>";

                //String[] types = serv.getNPOTypes();

                //ddlFilter.Items.Add("Select type of NPO");

                //for (int i = 0; i < types.Length; i++)
                //{
                //    ddlFilter.Items.Add(types[i]);
                //}



                //if (ddlFilter.SelectedIndex > 0)
                //{
                //    String selectedType = ddlFilter.SelectedItem.ToString();

                //    //ServiceReference1.Service1Client serv = new ServiceReference1.Service1Client();
                //    ServiceReference1.Orga[] orgList2 = serv.getNPOofType(selectedType);
                //    divNPOTable.InnerHtml = "";
                //    divNPOTable.InnerHtml += "<table style='width: 100%; border: solid #ddd; border-width: 1px 1px 1px 1px; clear: both; margin: 10px 0 30px; height: 0;'>";
                //    divNPOTable.InnerHtml += "<tr style='width: 100%; border-bottom: solid #ddd; border-bottom-width: 1px; clear: both; margin: 10px 0 30px; height: 0;'><th>Name</th><th>Industry</th><th>Contact Number</th></tr>";

                //    // Depending on the type of organisation, it will be displayed in the correct place on the page
                //    foreach (ServiceReference1.Orga organisation in orgList2)
                //    {
                //        divNPOTable.InnerHtml += "<tr><td><a href='UserPage.aspx?orgId=" + organisation.OrgID + "'>" + organisation.OrgName + "</a></td><td>" + organisation.Industry + "</td><td>" + organisation.ContactNum + "</tr>";
                //    }
                //    divNPOTable.InnerHtml += "</table>";
                //}
                //else
                //{
                //    // ServiceReference1.Service1Client serv = new ServiceReference1.Service1Client();
                //    ServiceReference1.Orga[] orgList2 = serv.getOrganisations();
                //    divNPOTable.InnerHtml = "";
                //    divNPOTable.InnerHtml += "<table style='width: 100%; border: solid #ddd; border-width: 1px 1px 1px 1px; clear: both; margin: 10px 0 30px; height: 0;'>";
                //    divNPOTable.InnerHtml += "<tr style='width: 100%; border-bottom: solid #ddd; border-bottom-width: 1px; clear: both; margin: 10px 0 30px; height: 0;'><th>Name</th><th>Industry</th><th>Contact Number</th></tr>";

                //    // Depending on the type of organisation, it will be displayed in the correct place on the page
                //    foreach (ServiceReference1.Orga organisation in orgList2)
                //    {
                //        if (organisation.Type == 1)
                //        {
                //            divNPOTable.InnerHtml += "<tr><td><a href='UserPage.aspx?orgId=" + organisation.OrgID + "'>" + organisation.OrgName + "</a></td><td>" + organisation.Industry + "</td><td>" + organisation.ContactNum + "</tr>";
                //        }
                //    }
                //    divNPOTable.InnerHtml += "</table>";
                //}
            }
        }
        static void Main(string[] args)
        {
            string choice = "";

            while (true)
            {
                ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();
                Console.WriteLine("*******************************************************************************************************************\n");
                Console.WriteLine("                     Welcome to the Menu\n");
                Console.WriteLine("         Enter 1 for Crud Operations in Student");
                Console.WriteLine("         Enter 2 for Crud Operations in Courses");
                Console.WriteLine("         Enter 3 for Crud Operations in Teachers");
                Console.WriteLine("         Enter 4 for Using WCF Service");
                Console.WriteLine("         Enter 0 for Exiting\n");
                Console.WriteLine("*******************************************************************************************************************\n");

                string input = Console.ReadLine();
                if (input == "1")
                {
                    while (true)
                    {
                        SortStudents(choice);
                        Console.WriteLine(" Enter 1 for Insert " +
                                          "\n Enter 2 for Update " +
                                          "\n Enter 3 for Delete " +
                                          "\n Enter 4 for Searching Student Data" +
                                          "\n Enter 5 for Sorting Students Ascending");
                        Console.WriteLine(" Enter 6 for Sorting Students Descending");
                        Console.WriteLine(" Enter 0 to go Back to previous Menu ");
                        string ente = Console.ReadLine();
                        if (ente == "1")
                        {
                            Console.WriteLine(" Enter Name To Insert :");
                            string name = Console.ReadLine();
                            InsertStudent(name);
                        }
                        else if (ente == "2")
                        {
                            Console.WriteLine(" Enter Name To Insert :");
                            string name = Console.ReadLine();
                            UpdateStudent(name);
                        }
                        else if (ente == "3")
                        {
                            DeleteStudent();
                        }
                        else if (ente == "0")
                        {
                            break;
                        }
                        else if (ente == "4")
                        {
                            Console.WriteLine("Enter Name To Search :");
                            string name = Console.ReadLine();
                            GetStudentByName(name);
                        }
                        else if (ente == "5")
                        {
                            choice = "a";
                            SortStudents(choice);
                        }
                        else if (ente == "6")
                        {
                            choice = "d";
                            SortStudents(choice);
                        }
                        else
                        {
                            Console.WriteLine("Wrong Input !!! Please Enter Again");
                        }
                    }
                }
                else if (input == "2")
                {
                    while (true)
                    {
                        Console.WriteLine("******************************************************************************************\n");
                        Console.WriteLine(" Enter 1 for Insert \n Enter 2 for Update \n Enter 3 for Delete");
                        Console.WriteLine(" Enter 0 to go Back to previous Menu ");
                        string ente = Console.ReadLine();
                        if (ente == "1")
                        {
                            Console.WriteLine(" Enter Course To Insert :");
                            string course = Console.ReadLine();
                            InsertCourse(course);
                        }
                        else if (ente == "2")
                        {
                            Console.WriteLine(" Enter Course To Insert :");
                            string course = Console.ReadLine();
                            UpdateCourse(course);
                        }
                        else if (ente == "3")
                        {
                            DeleteCourse();
                            printCourses();
                        }
                        else if (ente == "0")
                        {
                            printCourses();
                            break;
                        }

                        else
                        {
                            Console.WriteLine("Wrong Input !!! Please Enter Again");
                        }
                    }
                }
                else if (input == "3")
                {
                    while (true)
                    {
                        Console.WriteLine(" Enter 1 for Insert \n Enter 2 for Update \n Enter 3 for Delete \n Enter 4 for Searching Teachers " +
                                          "\n Enter 5 for Sorting Teachers Ascending");
                        Console.WriteLine(" Enter 6 for Sorting Teachers Descending");
                        Console.WriteLine(" Enter 0 to go Back to previous Menu ");
                        string ente = Console.ReadLine();
                        if (ente == "1")
                        {
                            Console.WriteLine(" Enter Teacher To Insert :");
                            string teacher = Console.ReadLine();
                            InsertTeacher(teacher);
                        }
                        else if (ente == "2")
                        {
                            Console.WriteLine(" Enter Teacher To Update :");
                            string teacher = Console.ReadLine();
                            UpdateTeacher(teacher);
                        }
                        else if (ente == "3")
                        {
                            DeleteTeacher();
                            printTeachers();
                        }
                        else if (ente == "4")
                        {
                            Console.WriteLine("Enter Name To Search :");
                            string name = Console.ReadLine();
                            GetTeacherByName(name);
                        }
                        else if (ente == "5")
                        {
                            choice = "a";
                            SortTeachers(choice);
                        }
                        else if (ente == "6")
                        {
                            choice = "d";
                            SortTeachers(choice);
                        }
                        else if (ente == "0")
                        {
                            printTeachers();
                            break;
                        }
                        else
                        {
                            Console.WriteLine("Wrong Input !!! Please Enter Again");
                        }
                    }
                }
                else if (input == "0")
                {
                    break;
                }
                else if (input == "4")
                {
                    Console.WriteLine("*********------WCF Service---------*******");
                    Console.WriteLine("Enter your Physics Marks:");
                    int phy = int.Parse(Console.ReadLine());
                    Console.WriteLine("Enter your Mathematics Marks:");
                    int mat = int.Parse(Console.ReadLine());
                    Console.WriteLine("Enter your Chemistry Marks:");
                    int chem    = int.Parse(Console.ReadLine());
                    int total   = client.Add(phy, mat, chem);
                    int average = client.Average(phy, mat, chem);
                    Console.WriteLine(" Total Grades: " + total);
                    Console.WriteLine(" Grade Average : " + average);
                    client.Close();
                }

                else
                {
                    Console.WriteLine("Wrong Input !!! Please Enter Again");
                }
            }
        }
Esempio n. 55
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((int)HttpContext.Current.Session["User_lvl"] > 0)
            {
                FCDoneNPO.Visible = false;
                ServiceReference1.Service1Client         sev = new ServiceReference1.Service1Client();
                ServiceReference1.cFundraisingCampaign[] fcList;
                ServiceReference1.UserDetail             u = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];

                if ((int)HttpContext.Current.Session["User_lvl"] == 1 || (int)HttpContext.Current.Session["User_lvl"] == 2)
                {
                    FCDoneNPO.Visible = true;
                    fcList            = sev.getOwnFundraisingCampaigns(sev.getNPOWithManager(u.userValue.UserID));

                    if (numOfFCs < fcList.Count())
                    {
                        numOfFCs = fcList.Count();
                    }

                    dFClist.InnerHtml     = "<table style='width: 100%; border: solid #ddd; border-width: 1px 1px 1px 1px; clear: both; margin: 10px 0 30px; height: 0;'><tr style='width: 100%; border-bottom: solid #ddd; border-bottom-width: 1px; clear: both; margin: 10px 0 30px; height: 0;'><td style='text-align: left; margin-right: 10px'>Title</td><td style='text-align: left; margin-right: 10px'>Description</td><td style='text-align: left; margin-right: 10px'>Current Amount</td><td style='text-align: left; margin-right: 10px'>Total Requested</td></tr>";
                    dFClistDone.InnerHtml = "<table style='width: 100%; border: solid #ddd; border-width: 1px 1px 1px 1px; clear: both; margin: 10px 0 30px; height: 0;'><tr style='width: 100%; border-bottom: solid #ddd; border-bottom-width: 1px; clear: both; margin: 10px 0 30px; height: 0;'><td style='text-align: left; margin-right: 10px'>Title</td><td style='text-align: left; margin-right: 10px'>Description</td><td style='text-align: left; margin-right: 10px'>Current Amount</td><td style='text-align: left; margin-right: 10px'>Total Requested</td></tr>";

                    numOfFCs     = 0;
                    numOfFCsDone = 0;

                    foreach (ServiceReference1.cFundraisingCampaign fc in fcList)
                    {
                        if (fc.VCurrentAmount >= fc.VTotalAmount)
                        {
                            numOfFCsDone++;
                        }
                        else
                        {
                            numOfFCs++;
                        }
                    }

                    ServiceReference1.cFundraisingCampaign[] fcNew = new ServiceReference1.cFundraisingCampaign[numOfFCs];
                    ServiceReference1.cFundraisingCampaign[] fcOld = new ServiceReference1.cFundraisingCampaign[numOfFCsDone];
                    int oldCount = 0;
                    int newCount = 0;

                    foreach (ServiceReference1.cFundraisingCampaign fc in fcList)
                    {
                        if (fc.VCurrentAmount >= fc.VTotalAmount)
                        {
                            fcOld[oldCount] = fc;
                            oldCount++;
                        }
                        else
                        {
                            fcNew[newCount] = fc;
                            newCount++;
                        }
                    }

                    for (int a = (pageCount - 1) * 8; a < pageCount * 8; a++)
                    {
                        if (a >= numOfFCs)
                        {
                            break;
                        }

                        if (searchStr.Equals(""))
                        {
                            dFClist.InnerHtml += "<tr><td>" + fcNew[a].VTitle + "</td><td style='text-align: left; margin-right: 10px;'>" + fcNew[a].VDescription + "</td><td style='text-align: right; padding-right: 10px;'>R " + fcNew[a].VCurrentAmount + "</td><td style='text-align: right; padding-right: 10px;'>R " + fcNew[a].VTotalAmount + "</td></tr>";
                        }
                        else
                        {
                            int numOfFCsAdded = 0;
                            for (int b = 0; b < numOfFCs; b++)
                            {
                                if (numOfFCsAdded > 7)
                                {
                                    break;
                                }
                                if (fcNew[b].VDescription.Contains(searchStr))
                                {
                                    if ((fcNew[b].VTotalAmount - fcNew[b].VCurrentAmount) > 0)
                                    {
                                        dFClist.InnerHtml += "<tr><td>" + fcNew[b].VTitle + "</td><td style='text-align: left; margin-right: 10px;'>" + fcNew[b].VDescription + "</td><td style='text-align: right; padding-right: 10px;'>R " + fcNew[b].VCurrentAmount + "</td><td style='text-align: right; padding-right: 10px;'>R " + fcNew[b].VTotalAmount + "</td></tr>";
                                    }
                                    numOfFCsAdded++;
                                }
                            }

                            searchStr      = "";
                            txtSearch.Text = "";
                            break;
                        }
                    }

                    dFClist.InnerHtml += "</table>";

                    for (int a = (pageCountDone - 1) * 8; a < pageCountDone * 8; a++)
                    {
                        if (a >= numOfFCsDone)
                        {
                            break;
                        }

                        if (searchStrDone.Equals(""))
                        {
                            dFClistDone.InnerHtml += "<tr><td>" + fcOld[a].VTitle + "</td><td style='text-align: left; margin-right: 10px;'>" + fcOld[a].VDescription + "</td><td style='text-align: right; padding-right: 10px;'>R " + fcOld[a].VCurrentAmount + "</td><td style='text-align: right; padding-right: 10px;'>R " + fcOld[a].VTotalAmount + "</td></tr>";
                        }
                        else
                        {
                            int numOfFCsAdded = 0;
                            for (int b = 0; b < numOfFCsDone; b++)
                            {
                                if (numOfFCsAdded > 7)
                                {
                                    break;
                                }
                                if (fcOld[b].VDescription.Contains(searchStrDone))
                                {
                                    dFClistDone.InnerHtml += "<tr><td>" + fcOld[b].VTitle + "</td><td style='text-align: left; margin-right: 10px;'>" + fcOld[b].VDescription + "</td><td style='text-align: right; padding-right: 10px;'>R " + fcOld[b].VCurrentAmount + "</td><td style='text-align: right; padding-right: 10px;'>R " + fcOld[b].VTotalAmount + "</td></tr>";
                                    numOfFCsAdded++;
                                }
                            }

                            searchStrDone      = "";
                            txtSearchDone.Text = "";
                            break;
                        }
                    }

                    dFClistDone.InnerHtml += "</table>";
                }
                else
                {
                    fcList = sev.getAllFundRaisingCampaign(u.userValue.UserID);

                    ArrayList fcs = new ArrayList();

                    for (int a = 0; a < fcList.Length; a++)
                    {
                        if ((fcList[a].VTotalAmount - fcList[a].VCurrentAmount) > 0)
                        {
                            ServiceReference1.Organisation org = sev.getOrg(fcList[a].OrgID1);
                            if ((bool)org.Verified)
                            {
                                fcs.Add(fcList[a]);
                            }
                        }
                    }

                    ServiceReference1.cFundraisingCampaign[] avFCs = (ServiceReference1.cFundraisingCampaign[])fcs.ToArray(typeof(ServiceReference1.cFundraisingCampaign));

                    if (numOfFCs < avFCs.Count())
                    {
                        numOfFCs = avFCs.Count();
                    }

                    dFClist.InnerHtml = "<table style='width: 100%; border: solid #ddd; border-width: 1px 1px 1px 1px; clear: both; margin: 10px 0 30px; height: 0;'><tr style='width: 100%; border-bottom: solid #ddd; border-bottom-width: 1px; clear: both; margin: 10px 0 30px; height: 0;'><td style='text-align: left; margin-right: 10px'>Title</td><td style='text-align: left; margin-right: 10px'>Organisation</td><td style='text-align: left; margin-right: 10px'>Description</td><td style='text-align: left; margin-right: 10px'>Current Amount</td><td style='text-align: left; margin-right: 10px'>Total Requested</td></tr>";

                    for (int a = (pageCount - 1) * 8; a < pageCount * 8; a++)
                    {
                        if (a >= numOfFCs)
                        {
                            break;
                        }

                        if (searchStr.Equals(""))
                        {
                            dFClist.InnerHtml += "<tr><td>" + avFCs[a].VTitle + "</td><td>" + sev.getOrg(avFCs[a].OrgID1).OrganisationName + "</td><td style='text-align: left; margin-right: 10px; width: 150px;'>" + avFCs[a].VDescription + "</td><td style='text-align: right; padding-right: 10px;'>R " + avFCs[a].VCurrentAmount + "<a href='DonatToFund.aspx?FID=" + avFCs[a].IDF + "'>+</a></td><td style='text-align: right; padding-right: 10px;'>R " + avFCs[a].VTotalAmount + "</td></tr>";
                        }
                        else
                        {
                            int numOfFCsAdded = 0;
                            for (int b = 0; b < numOfFCs; b++)
                            {
                                if (numOfFCsAdded > 7)
                                {
                                    break;
                                }
                                if (avFCs[b].VDescription.Contains(searchStr))
                                {
                                    dFClist.InnerHtml += "<tr><td>" + avFCs[b].VTitle + "</td><td>" + sev.getOrg(avFCs[b].OrgID1).OrganisationName + "</td><td style='text-align: left; margin-right: 10px; width: 150px;'>" + avFCs[b].VDescription + "</td><td style='text-align: right; padding-right: 10px;'>R " + avFCs[b].VCurrentAmount + "<a href='DonatToFund.aspx?FID=" + avFCs[b].IDF + "'>+</a></td><td style='text-align: right; padding-right: 10px;'>R " + avFCs[b].VTotalAmount + "</td></tr>";
                                    numOfFCsAdded++;
                                }
                            }

                            searchStr      = "";
                            txtSearch.Text = "";
                            break;
                        }
                    }

                    dFClist.InnerHtml += "</table>";
                }
            }
        }
Esempio n. 56
0
 public CaractéristiqueController()
 {
     client = new ServiceReference1.Service1Client();
 }
Esempio n. 57
0
 public AdminLeave()
 {
     InitializeComponent();
     client = new ServiceReference1.Service1Client();
 }
        /// <summary>
        /// Data for NPO are captured and then sent to the the server to the stored in the database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnRegNPO_Click(object sender, EventArgs e)
        {
            lblWrongInput.Visible = false;
            lblReqField2.Visible  = false;

            if (fupNPO.HasFile)
            {
                if (!txtNPONum.Text.Equals("") && !txtNPOName.Text.Equals("") && !txtNPOStreet.Text.Equals("") && !txtNPOSub.Text.Equals("") && !txtNPONumber.Text.Equals(""))
                {
                    try
                    {
                        ServiceReference1.Service1Client regNPOServ = new ServiceReference1.Service1Client();
                        bool registrationSuccessful = false;

                        npo                  = new NPO(int.Parse(txtNPONum.Text), txtNPOName.Text);
                        npo.Street1          = txtNPOStreet.Text;
                        npo.Suburb1          = txtNPOSub.Text;
                        npo.Province1        = ddlNPOProv.SelectedItem.Text;
                        npo.ContactNumber1   = txtNPONumber.Text;
                        npo.Industry1        = DDLNPOInd.SelectedItem.Text;
                        npo.OrganisaionType1 = 1;
                        orgNumber            = int.Parse(txtNPONum.Text);

                        registrationSuccessful = regNPOServ.addOrganisation(npo.OrganisationNumber1, npo.OrganisationName1, npo.Street1, npo.Suburb1, npo.Province1, npo.COUNTRY1, npo.ContactNumber1, npo.Industry1, npo.OrganisaionType1);


                        string filename = Path.GetFileName(fupNPO.FileName);
                        ServiceReference1.FileClass file = new ServiceReference1.FileClass();
                        file.FilePath  = filename;
                        file.FileBytes = fupNPO.FileBytes;
                        regNPOServ.addOrgFile(file, orgNumber);

                        if (fileUpNPOProfilePic.HasFile)
                        {
                            string filePname = Path.GetFileName(fileUpNPOProfilePic.FileName);
                            ServiceReference1.FileClass fileP = new ServiceReference1.FileClass();
                            fileP.FilePath  = filePname;
                            fileP.FileBytes = fileUpNPOProfilePic.FileBytes;
                            regNPOServ.addOrgImage(fileP, orgNumber);
                        }

                        if (registrationSuccessful == true)
                        {
                            regNPODiv.Visible = false;
                            regIndDiv.Visible = true;
                            lblTitleRI.Text   = "NPO manager";
                        }
                        else if (registrationSuccessful == false)
                        {
                            lblRegMessage.Text = "Error occured when registering. Please make sure your email has not been registered previously.";
                        }
                    }
                    catch (Exception ex)
                    {
                        lblWrongInput.Visible = true;
                    }
                }
                else
                {
                    lblReqField2.Visible = true;
                }
            }
            else
            {
                lblReqField2.Visible = true;
                lblReqField2.Text    = "Please add a file to proof the existance of your NPO!";
            }
        }
Esempio n. 59
0
        /// <summary>
        /// This method is called and executed when the page is loaded.
        /// A list of all events are retrieved and displayed when the page is loaded.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            NPOPastEvents.Visible = false;
            ServiceReference1.Service1Client serv   = new ServiceReference1.Service1Client();
            ServiceReference1.Eve[]          events = null;
            ServiceReference1.UserDetail     u      = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];

            if ((int)HttpContext.Current.Session["User_lvl"] == 1)
            {
                NPOPastEvents.Visible = true;
                events = serv.getNEvents(serv.getNPOWithManager(u.userValue.UserID));
            }
            else if ((int)HttpContext.Current.Session["User_lvl"] == 3)
            {
                events = serv.getEvents(u.userValue.UserID);
            }

            divEventsTable.InnerHtml  = "";
            divEventsTable.InnerHtml += "<table style='width: 100%; border: solid #ddd; border-width: 1px 1px 1px 1px; clear: both; margin: 10px 0 30px; height: 0;'>";
            divEventsTable.InnerHtml += "<tr style='width: 100%; border-bottom: solid #ddd; border-bottom-width: 1px; clear: both; margin: 10px 0 30px; height: 0;'><th style='text-align: left; margin-right: 10px'>Name</th><th style='text-align: left; margin-right: 10px'>Venue</th><th style='text-align: left; margin-right: 10px'>Date</th><th style='text-align: left; margin-right: 10px'>Time</th></tr>";

            divEventsTableOld.InnerHtml  = "";
            divEventsTableOld.InnerHtml += "<table style='width: 100%; border: solid #ddd; border-width: 1px 1px 1px 1px; clear: both; margin: 10px 0 30px; height: 0;'>";
            divEventsTableOld.InnerHtml += "<tr style='width: 100%; border-bottom: solid #ddd; border-bottom-width: 1px; clear: both; margin: 10px 0 30px; height: 0;'><th style='text-align: left; margin-right: 10px'>Name</th><th style='text-align: left; margin-right: 10px'>Venue</th><th style='text-align: left; margin-right: 10px'>Date</th><th style='text-align: left; margin-right: 10px'>Time</th></tr>";

            numOfEvesOld = 0;
            numOfEves    = 0;

            foreach (ServiceReference1.Eve ev in events)
            {
                if (Convert.ToDateTime(ev.EventValue.DateOfEvent) < DateTime.Today)
                {
                    numOfEvesOld++;
                }
                else
                {
                    numOfEves++;
                }
            }

            ServiceReference1.Eve[] eventsNew = new ServiceReference1.Eve[numOfEves];
            ServiceReference1.Eve[] eventsOld = new ServiceReference1.Eve[numOfEvesOld];
            int oldCount = 0;
            int newCount = 0;

            foreach (ServiceReference1.Eve ev in events)
            {
                if (Convert.ToDateTime(ev.EventValue.DateOfEvent) < DateTime.Today)
                {
                    eventsOld[oldCount] = ev;
                    oldCount++;
                }
                else
                {
                    eventsNew[newCount] = ev;
                    newCount++;
                }
            }

            for (int a = (pageCount - 1) * 8; a < pageCount * 8; a++)
            {
                if (a >= numOfEves)
                {
                    break;
                }

                if (searchStr.Equals(""))
                {
                    divEventsTable.InnerHtml += "<tr><td><a href ='EventDetails.aspx?id=" + eventsNew[a].EventValue.EventID + "'>" + eventsNew[a].EventValue.Name + "</a></td><td>" + eventsNew[a].EventValue.Location + "</td><td>" + Convert.ToDateTime(eventsNew[a].EventValue.DateOfEvent).ToShortDateString() + "</td><td>" + eventsNew[a].Time + "</td></tr>";
                }
                else
                {
                    int numOfEvesAdded = 0;
                    for (int b = 0; b < numOfEves; b++)
                    {
                        if (numOfEvesAdded > 7)
                        {
                            break;
                        }
                        if (eventsNew[b].EventValue.Name.Contains(searchStr))
                        {
                            divEventsTable.InnerHtml += "<tr><td><a href ='EventDetails.aspx?id=" + eventsNew[b].EventValue.EventID + "'>" + eventsNew[b].EventValue.Name + "</a></td><td>" + eventsNew[b].EventValue.Location + "</td><td>" + Convert.ToDateTime(eventsNew[b].EventValue.DateOfEvent).ToShortDateString() + "</td><td>" + eventsNew[a].Time + "</td></tr>";
                            numOfEvesAdded++;
                        }
                    }

                    searchStr      = "";
                    txtSearch.Text = "";
                    break;
                }
            }

            divEventsTable.InnerHtml += "</table>";

            for (int a = (pageCountOld - 1) * 8; a < pageCountOld * 8; a++)
            {
                if (a >= numOfEvesOld)
                {
                    break;
                }

                if (searchStrOld.Equals(""))
                {
                    divEventsTableOld.InnerHtml += "<tr><td><a href ='EventDetails.aspx?id=" + eventsOld[a].EventValue.EventID + "'>" + eventsOld[a].EventValue.Name + "</a></td><td>" + eventsOld[a].EventValue.Location + "</td><td>" + Convert.ToDateTime(eventsOld[a].EventValue.DateOfEvent).ToShortDateString() + "</td><td>" + eventsOld[a].Time + "</td></tr>";
                }
                else
                {
                    int numOfEvesAdded = 0;
                    for (int b = 0; b < numOfEvesOld; b++)
                    {
                        if (numOfEvesAdded > 7)
                        {
                            break;
                        }
                        if (eventsOld[b].EventValue.Name.Contains(searchStrOld))
                        {
                            divEventsTableOld.InnerHtml += "<tr><td><a href ='EventDetails.aspx?id=" + eventsOld[b].EventValue.EventID + "'>" + eventsOld[b].EventValue.Name + "</a></td><td>" + eventsOld[b].EventValue.Location + "</td><td>" + Convert.ToDateTime(eventsOld[b].EventValue.DateOfEvent).ToShortDateString() + "</td><td>" + eventsOld[a].Time + "</td></tr>";
                            numOfEvesAdded++;
                        }
                    }

                    searchStrOld      = "";
                    txtSearchOld.Text = "";
                    break;
                }
            }

            divEventsTableOld.InnerHtml += "</table>";
        }
Esempio n. 60
0
        /// <summary>
        /// This method is called and executed when the page is loaded.
        /// A specific user's information is displayed on this page.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((int)HttpContext.Current.Session["User_lvl"] > 0 && (int)HttpContext.Current.Session["User_lvl"] < 8)
            {
                btnRemoveOrg.Visible  = false;
                btnRemoveUser.Visible = false;

                try
                {
                    userDiv.Visible            = false;
                    OrgDiv.Visible             = false;
                    VolunteerFrame.Visible     = false;
                    RateReviewNPOFrame.Visible = false;
                    AvgRatingFrame.Visible     = false;

                    if (Request.QueryString["orgId"] != null)
                    {
                        OrgDiv.Visible = true;
                        int tmpID = int.Parse(Request.QueryString["orgId"].ToString());
                        ServiceReference1.Service1Client serv       = new ServiceReference1.Service1Client();
                        ServiceReference1.Organisation   currentOrg = serv.getOrg(tmpID);
                        orgDetailsDiv.InnerHtml = "<table style='width: 100%; border: solid #ddd; border-width: 1px 1px 1px 1px; clear: both; margin: 10px 0 30px; height: 0;'><tr><td><h1>" + currentOrg.OrganisationName + "</h1></td><td></td><td></td><td></td></tr><tr><td><h1>Address:</h1></td><td></td><td></td><td></td></tr><tr><td></td><td>" + currentOrg.Street + "</td><td></td><td></td></tr><tr><td></td><td>" + currentOrg.Suburb + "</td><td></td><td></td></tr><tr><td></td><td>" + currentOrg.Province + "</td><td></td><td></td></tr><tr><td><h1>Contact number:</h1></td><td>" + currentOrg.ContactNumber + "</td><td></td><td></td></tr><tr><td><h1>Industry:</h1></td><td>" + currentOrg.Industry + "</td><td></td><td></td></tr><table>";
                        ServiceReference1.UserDetail u = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];

                        if ((int)HttpContext.Current.Session["User_lvl"] == 7)
                        {
                            btnRemoveOrg.Visible = true;
                        }

                        if (u.AccessLvl == 5)
                        {
                            VolunteerFrame.Visible = true;
                            VolunteerFrame.Src     = "frames/VolunteerPage.aspx?Org_ID=" + tmpID;
                        }

                        if (u.AccessLvl == 5 || u.AccessLvl == 3)
                        {
                            RateReviewNPOFrame.Visible = true;
                            RateReviewNPOFrame.Src     = "frames/RateReviewNPO.aspx?orgId=" + tmpID;
                        }
                        if (currentOrg.OrganisationType == 1)
                        {
                            if (u.AccessLvl == 1 || u.AccessLvl == 2 || u.AccessLvl == 3 || u.AccessLvl == 4 || u.AccessLvl == 5 || u.AccessLvl == 6 || u.AccessLvl == 7)
                            {
                                AvgRatingFrame.Visible = true;
                                AvgRatingFrame.Src     = "frames/AverageRating.aspx?orgId=" + tmpID;
                            }
                        }

                        try
                        {
                            ServiceReference1.UserDetail user = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
                            ServiceReference1.FileClass  file = serv.getFile(tmpID, true);
                            MemoryStream ms = new MemoryStream(file.FileBytes, 0, file.FileBytes.Length);
                            orgPic.ImageUrl = "data:image/jpg;base64," + Convert.ToBase64String(file.FileBytes);
                        }
                        catch (Exception ex)
                        {
                            imgUser.ImageUrl = "~/images/ina.jpg";
                        }
                    }

                    if (Request.QueryString["userId"] != null)
                    {
                        userDiv.Visible = true;
                        int tmpID = int.Parse(Request.QueryString["userId"].ToString());
                        ServiceReference1.Service1Client serv        = new ServiceReference1.Service1Client();
                        ServiceReference1.User           currentUser = serv.getUser(tmpID);
                        IndDetailsDiv.InnerHtml = "<table style='width: 100%; border: solid #ddd; border-width: 1px 1px 1px 1px; clear: both; margin: 10px 0 30px; height: 0;'><tr><td><h1>" + currentUser.FirstNameValue + " " + currentUser.LastNameValue + "</h1></td><td></td><td></td><td></td></tr><tr><td><h2>Email:</h2></td><td>" + currentUser.EmailValue + "</td><td></td><td></td></tr></table>";

                        if ((int)HttpContext.Current.Session["User_lvl"] == 7)
                        {
                            btnRemoveUser.Visible = true;
                        }

                        try
                        {
                            ServiceReference1.UserDetail user = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
                            ServiceReference1.FileClass  file = serv.getUserImage(user.userValue.UserID);
                            MemoryStream ms = new MemoryStream(file.FileBytes, 0, file.FileBytes.Length);
                            imgUser.ImageUrl = "data:image/jpg;base64," + Convert.ToBase64String(file.FileBytes);
                        }
                        catch (Exception ex)
                        {
                            imgUser.ImageUrl = "~/images/avatar1.png";
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }