Example #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Page.IsPostBack)
     {
         return;
     }
     GrdTable.DataSource = db.Mots;
     GrdTable.DataBind();
 }
        public void LoadForm()
        {
            if (Request.QueryString["VisitID"] != null)
            {
                int VisitID = Convert.ToInt32(Request.QueryString["VisitID"].ToString());
                using (MashadCarpetEntities db = new MashadCarpetEntities())
                {
                    var n = (from u in db.VisitCounter where u.VisitID == VisitID select u).FirstOrDefault();

                    var m = (from u in db.VisitCounter where EntityFunctions.TruncateTime(u.VisitDate) == EntityFunctions.TruncateTime(n.VisitDate) select u).ToList();

                    GrdTable.DataSource = m;
                    GrdTable.DataBind();


                    var t = (from u in db.VisitCounter where EntityFunctions.TruncateTime(u.VisitDate) == EntityFunctions.TruncateTime(n.VisitDate) select u).Count();

                    string dd = string.Format("{0:d}", n.VisitDate);
                    lblTotalCount.Text = " تعداد بازدید کل " + t.ToString() + " در تاریخ " + dd;
                }

                btnReturn.Visible = true;
            }
            else
            {
                DateTime d = DateTime.Now;
                using (MashadCarpetEntities db = new MashadCarpetEntities())
                {
                    var n = (from u in db.VisitCounter
                             where EntityFunctions.TruncateTime(u.VisitDate) == d.Date
                             select u).ToList();

                    GrdTable.DataSource = n;
                    GrdTable.DataBind();

                    var    m  = (from u in db.VisitCounter where EntityFunctions.TruncateTime(u.VisitDate) == d.Date select u).Count();
                    string dd = string.Format("{0:d}", d);

                    lblTotalCount.Text = " تعداد بازدید کل " + m.ToString() + " در تاریخ " + dd;
                }
            }
        }
Example #3
0
        public void LoadForm()
        {
            using (MashadCarpetEntities db = new MashadCarpetEntities())
            {
                var n = (from u in db.VisitCounter
                         group u by EntityFunctions.TruncateTime(u.VisitDate) into g
                         orderby g.FirstOrDefault().VisitDate descending
                         select new
                {
                    g.FirstOrDefault().VisitDate,

                    g.FirstOrDefault().VisitCount,
                    g.FirstOrDefault().TotalVisit,

                    g.FirstOrDefault().VisitID
                }).ToList();

                GrdTable.DataSource = n;
                GrdTable.DataBind();
            }
        }
Example #4
0
        protected void BtnSrch_Click(object sender, EventArgs e)
        {
            String mots = InputMot.Value;
            Mots   m    = db.Mots.FirstOrDefault(a => a.text == mots);

            if (m != null)
            {
                lab.Text    = mots;
                lab.Visible = true;
            }
            else
            {
                Mots mo = new Mots();
                mo.text = mots;
                db.Mots.InsertOnSubmit(mo);
                db.SubmitChanges();


                GrdTable.DataSource = db.Mots;
                GrdTable.DataBind();
            }
        }
Example #5
0
        public void LoadForm()
        {
            if (Request.QueryString["StatusID"] != null)
            {
                int StatusID = int.Parse(Request.QueryString["StatusID"].ToString());

                using (MashadCarpetEntities db = new MashadCarpetEntities())
                {
                    var n = (from u in db.Tickets
                             join i in db.Users.AsEnumerable()
                             on u.fk_UserID equals i.UserID
                             //join p in db.TicketGroup on u.fk_TicketGroupID equals p.TicketGroupID
                             where u.IsDelete == false && u.Status == StatusID
                             orderby u.TicketDate descending
                             select new
                    {
                        UserName = i.UserName + " " + i.UserFamily,
                        u.TicketSubject,
                        //u.TicketPriority,
                        u.TicketDate,
                        u.TicketID,
                        i.UserID,
                        u.Status,
                        u.fk_UserID,
                        //p.TicketGroupTitle
                    }).ToList();

                    GrdTable.DataSource = n;
                    GrdTable.DataBind();
                    if (n.Count == 0)
                    {
                        pnlEmptyForm.Visible = true;
                    }
                    else
                    {
                        pnlEmptyForm.Visible = false;
                    }
                }
            }
            else
            {
                using (MashadCarpetEntities db = new MashadCarpetEntities())
                {
                    var n = (from u in db.Tickets
                             join i in db.Users.AsEnumerable()
                             on u.fk_UserID equals i.UserID
                             where u.IsDelete == false
                             orderby u.TicketDate descending
                             select new
                    {
                        UserName = i.UserName + " " + i.UserFamily,
                        u.TicketSubject,
                        //u.TicketPriority,
                        u.TicketDate,
                        u.TicketID,
                        i.UserID,
                        u.Status,
                        u.fk_UserID,
                        //p.TicketGroupTitle
                    }).ToList();

                    GrdTable.DataSource = n;
                    GrdTable.DataBind();
                    if (n.Count == 0)
                    {
                        pnlEmptyForm.Visible = true;
                    }
                    else
                    {
                        pnlEmptyForm.Visible = false;
                    }
                }
            }
            mvSetting.SetActiveView(vwList);
        }