Ejemplo n.º 1
0
    /// <summary>
    /// Inbox page load
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Facade facade = Facade.GetInstance();

            //if (Facade.GetInstance().AccSettings == null) Response.Redirect("~/Settings.aspx");
            if (!File.Exists(Constants.ACCOUNT_FILE_NAME_SETTINGS))
            {
                Response.Redirect("~/Settings.aspx?permit=false");
            }

            if (facade.ChangeImcoming || !PermitMakesRetrives)
            {
                facade.ChangeImcoming = false;
                PermitMakesRetrives   = true;
                facade.Connect();
                GridViewInbox.DataSource = facade.Retrieves();
                GridViewInbox.DataBind();
            }
            else
            {
                GridViewInbox.DataSource = facade.getListHeaders();
                GridViewInbox.DataBind();
            }
        }
    }
        //send a message
        protected void Button1_Click(object sender, EventArgs e)
        {
            dbcon.MessagesTables.Load();
            dbcon.DoctorsTables.Load();
            dbcon.PatientsTables.Load();

            MessagesTable mess = new MessagesTable();

            mess.MessageTO = (from x in dbcon.PatientsTables.Local
                              where x.PatientID == Convert.ToInt32(DropDownListPatients.SelectedValue)
                              select x).First().UserLoginName;
            mess.MessageFROM = (from x in dbcon.DoctorsTables.Local
                                where x.DoctorID == DocPK
                                select x).First().UserLoginName;
            mess.Date    = DateTime.Now;
            mess.Message = TextBox1.Text;

            dbcon.MessagesTables.Add(mess);
            dbcon.SaveChanges();
            GridViewInbox.DataBind();

            TextBox1.Text = "";

            GridViewSent.DataBind();
        }
Ejemplo n.º 3
0
    /// <summary>
    /// Event fired when the actual GridView page is changed.
    /// </summary>
    /// <param name="sender">The sender object</param>
    /// <param name="e">The page event arguments</param>
    protected void GridViewInbox_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        Facade facade = Facade.GetInstance();

        GridViewInbox.DataSource = facade.getListHeaders();
        GridViewInbox.PageIndex  = e.NewPageIndex;
        GridViewInbox.DataBind();
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            dbcon.MessagesTables.Load();
            dbcon.DoctorsTables.Load();

            if (Session.Count < 1)
            {
                Response.Redirect("~/Logon.aspx");
            }

            //dropdownlist
            string p = "DocPK";

            foreach (string s in Session)
            {
                if (s.Equals(p))
                {
                    DocPK = Convert.ToInt32(Session[s].ToString());
                }
            }

            dbcon.PatientsTables.Load();

            var items = from x in dbcon.PatientsTables.Local
                        where x.DoctorID == DocPK
                        select new
            {
                Name = x.FirstName.ToString() + " " + x.LastName.ToString(),
                x.PatientID
            };

            DropDownListPatients.DataTextField  = "Name";
            DropDownListPatients.DataValueField = "PatientID";
            DropDownListPatients.DataSource     = items;
            DropDownListPatients.DataBind();

            //get doc username
            var docName = (from x in dbcon.DoctorsTables.Local
                           where x.DoctorID == DocPK
                           select x).First().UserLoginName;

            //fill in inbox
            var inbox = from x in dbcon.MessagesTables.Local
                        where x.MessageTO == docName
                        select x;

            GridViewInbox.DataSource = inbox;
            GridViewInbox.DataBind();

            //fill in Sent Messages
            var sent = from x in dbcon.MessagesTables.Local
                       where x.MessageFROM == docName
                       select x;

            GridViewSent.DataSource = sent;
            GridViewSent.DataBind();
        }
        //delete for inbox
        protected void Button2_Click(object sender, EventArgs e)
        {
            if (GridViewInbox.SelectedIndex >= 0)
            {
                dbcon.MessagesTables.Load(); // load up the database

                // find the appointment based on the Appointment ID
                MessagesTable mess1 = dbcon.MessagesTables.Find(Convert.ToInt32(GridViewInbox.SelectedRow.Cells[1].Text)); // delete the item

                dbcon.MessagesTables.Remove(mess1);                                                                        //remove the appointment
                dbcon.SaveChanges();                                                                                       // save the changes
                GridViewInbox.DataBind();                                                                                  // update the gridview
            }
        }
Ejemplo n.º 6
0
    /// <summary>
    /// Incoming sms Grid Bind
    /// </summary>
    public void IncomeGridBind()
    {
        //Grid SMS Out
        SqlConnection     sqlconView = new SqlConnection(DL.SQL.connSMS);
        SqlDataAdapter    adp        = new SqlDataAdapter("SELECT id AS ID,sender AS Sender,msg AS Message,senttime AS SentTime,receivedtime AS ReceivedTime FROM ozekimessagein ", sqlconView);
        SqlCommandBuilder cb         = new SqlCommandBuilder(adp);

        sqlconView.Open();

        DataSet dsItem = new DataSet();

        adp.Fill(dsItem, "sample1");
        GridViewInbox.DataSource = dsItem.Tables[0];
        GridViewInbox.DataBind();
    }
Ejemplo n.º 7
0
 protected void DropDownListStudentName_SelectedIndexChanged(object sender, EventArgs e)
 {
     GridViewInbox.DataSource = SocialAdviserInbox.GetInbox(DropDownListStudentName.SelectedItem.ToString()).Tables["SocialAdviserInbox"];
     GridViewInbox.DataBind();
 }