Пример #1
0
        public ActionResult Checklist(CheckLog checkLog)
        {
            var pnumber = Convert.ToInt32(Request["PNumber"]);
            var user    = HttpContext.User.Identity.Name;

            checkLog.CheckDate = DateTime.Now.ToString();
            checkLog.UserId    = user;
            checkLog.PointId   = pnumber;
            db.CheckLogs.Add(checkLog);

            if (db.CheckLists.Any(x => x.PointID == pnumber) == true)
            {
                var point = db.CheckLists
                            .Where(x => x.PointID == pnumber)
                            .FirstOrDefault();

                point.CheckDate   = DateTime.Now.ToString();
                point.UserID      = user;
                point.PrinterSN   = checkLog.CardPrinter;
                point.RouterSN    = checkLog.RouterSN;
                point.Description = checkLog.CheckDescription;
            }
            else
            {
                var point = db.CheckLists;
                point.Add(new PointCheckList {
                    PointID   = pnumber, UserID = user, CheckDate = DateTime.Now.ToString(), RouterSN = checkLog.RouterSN,
                    PrinterSN = checkLog.CardPrinter, Description = checkLog.CheckDescription
                });
            }
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
 private void btExport_Click_1(object sender, EventArgs e)
 {
     if (tbFromDate != null && tbFromDate.Text != null && tbToDate.Text != "" && tbToDate.Text != null)
     {
         DateTime temp;
         if (DateTime.TryParse(tbFromDate.Text, out temp) && DateTime.TryParse(tbFromDate.Text, out temp))
         {
             List <CheckLog> result  = CheckLog.GetData(tbFromDate.Text, tbToDate.Text);
             ExportData      expData = new ExportData(result);
             expData.WriteResultToExcel();
         }
     }
 }
Пример #3
0
        private void btExport_Click(object sender, EventArgs e)
        {
            DateTime fromDate, toDate;

            if (DateTime.TryParse(tbFromDate.Text, out fromDate) && DateTime.TryParse(tbToDate.Text, out toDate))
            {
                List <CheckLog> result     = CheckLog.GetData(tbFromDate.Text, tbToDate.Text);
                ExportData      exportData = new ExportData(result);
            }
            else
            {
                MessageBox.Show("Please Check your Date format(dd/MM/YYYY)");
            }
        }
Пример #4
0
        public List <CheckLog> SelectAllData(string from, string to)
        {
            List <CheckLog> result = new List <CheckLog>();

            try
            {
                this.ExcuteQurey("Select * from CheckLog where Check_Date Between '" + from + " 12:00:00' AND '" + to + " 12:00:00';");

                while (this.dReader.Read())
                {
                    CheckLog check = new CheckLog();
                    check.Id              = this.dReader[0].ToString();
                    check.Barcode         = this.dReader[1].ToString();
                    check.ItemDescription = this.dReader[2].ToString();
                    check.UserInit        = this.dReader[3].ToString();

                    //check.ItemDescription =
                    bool status;
                    if (Boolean.TryParse(this.dReader[5].ToString(), out status))
                    {
                        if (status)
                        {
                            check.StudentNo = "";
                            check.Status    = true;
                        }
                        else
                        {
                            check.StudentNo = this.dReader[4].ToString();
                            check.Status    = false;
                        }
                    }

                    check.CheckOutDate = this.dReader[6].ToString();

                    check.ExpireDate = this.dReader[7].ToString();
                    result.Add(check);
                }

                this.CloseConnection();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
                this.CloseConnection();
            }
            return(result);
        }
Пример #5
0
        public ActionResult SaveApply(Apply apply, string role, string applyType)
        {
            #region 保存申请
            if (apply.ID == new Guid())
            {
                apply.ID = Guid.NewGuid();
            }
            apply.ApplyType      = ApplyTypeManager.Get(new Guid(applyType));
            apply.SendUser       = UserInfoManager.GetUserSession();
            apply.CreateTime     = DateTime.Now;
            apply.CheckState     = 0;
            apply.CheckStateName = "待审核";
            ApplyManager.SaveOrUpdate(apply);
            #endregion

            #region 保存待审核用户的信息
            // 读取需要进行审核角色的用户

            IList <RoleUser> roleUser = RoleUserManager.LoadAll().Where(f => f.Role.ID == new Guid(role)).ToList();

            Guid roleId    = new Guid(role);
            Role checkRole = RoleManager.Get(roleId);
            if (roleUser.Count == 0)
            {
                return(Content("-1"));
            }
            for (int i = 0; i < roleUser.Count; i++)
            {
                CheckLog checkLog = new CheckLog();
                checkLog.ID         = Guid.NewGuid();
                checkLog.Apply      = apply;
                checkLog.CheckState = 0;
                checkLog.CheckTime  = DateTime.Now;
                checkLog.CreateTime = DateTime.Now;
                checkLog.Remark     = "";
                checkLog.Role       = checkRole;
                checkLog.UserInfo   = roleUser[i].User;
                CheckLogManager.Save(checkLog);
            }
            #endregion

            return(Content("1"));
        }