Example #1
0
 public void SubmitForm(AttLogEntity userEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         userEntity.Modify(keyValue);
         service.Update(userEntity);
     }
     else
     {
         userEntity.Create();
         service.Insert(userEntity);
     }
 }
Example #2
0
        public ActionResult SubmitForm(DataForm organizeEntity, string keyValue, string starttime)
        {
            DateTime now = DateTime.Now;

            if (!string.IsNullOrEmpty(starttime))
            {
                now = starttime.ToDate();
            }
            var item  = userApp.GetForm(keyValue);
            var today = reportApp.GetCurrentTime(keyValue, now, 1);

            if (today != null)
            {
                if (organizeEntity.baocan == "0")
                {
                    reportApp.DeleteForm(today.F_Id);
                }
            }
            else
            {
                if (organizeEntity.baocan == "1")
                {
                    today          = new ReportEatEntity();
                    today.F_Time   = now;
                    today.F_IsEat  = 1;
                    today.F_UserId = keyValue;
                    reportApp.SubmitForm(today, "");
                }
            }
            var attl = attlApp.GetCurrentTime(item.F_AttCard, now, true);

            if (attl == null && organizeEntity.shangban == "1")
            {
                attl         = new AttLogEntity();
                attl.AttDate = new DateTime(now.Year, now.Month, now.Day, 8, 0, 0);
                attl.CardNo  = item.F_AttCard;
                attlApp.SubmitForm(attl, "");
            }
            else if (attl != null && organizeEntity.shangban == "0")
            {
                attlApp.DeleteForm(attl.F_Id);
            }
            var attl2 = attlApp.GetCurrentTime(item.F_AttCard, now, false);

            if (attl2 == null && organizeEntity.xiaban == "1")
            {
                attl2         = new AttLogEntity();
                attl2.AttDate = new DateTime(now.Year, now.Month, now.Day, 17, 0, 0);
                attl2.CardNo  = item.F_AttCard;
                attlApp.SubmitForm(attl2, "");
            }
            else if (attl2 != null && organizeEntity.xiaban == "0")
            {
                attlApp.DeleteForm(attl2.F_Id);
            }
            if (string.IsNullOrEmpty(item.F_PosCard))
            {
                return(Error(item.F_NickName + "-此用户未填餐卡编号!"));
            }
            var pos = posApp.GetCurrentTime(item.F_PosCard, now, 0);

            if (pos == null && organizeEntity.zaocan == "1")
            {
                pos         = new PosLogEntity();
                pos.PosTime = new DateTime(now.Year, now.Month, now.Day, 8, 0, 0);
                pos.CardNo  = item.F_PosCard;
                posApp.SubmitForm(pos, "");
            }
            else if (pos != null && organizeEntity.zaocan == "0")
            {
                posApp.DeleteForm(pos.F_Id);
            }
            var pos1 = posApp.GetCurrentTime(item.F_PosCard, now, 1);

            if (pos1 == null && organizeEntity.wucan == "1")
            {
                pos1         = new PosLogEntity();
                pos1.PosTime = new DateTime(now.Year, now.Month, now.Day, 12, 0, 0);
                pos1.CardNo  = item.F_PosCard;
                posApp.SubmitForm(pos1, "");
            }
            else if (pos1 != null && organizeEntity.wucan == "0")
            {
                posApp.DeleteForm(pos1.F_Id);
            }
            var pos2 = posApp.GetCurrentTime(item.F_PosCard, now, 2);

            if (pos2 == null && organizeEntity.wancan == "1")
            {
                pos2         = new PosLogEntity();
                pos2.PosTime = new DateTime(now.Year, now.Month, now.Day, 17, 0, 0);
                pos2.CardNo  = item.F_PosCard;
                posApp.SubmitForm(pos2, "");
            }
            else if (pos2 != null)
            {
                posApp.DeleteForm(pos2.F_Id);
            }
            return(Success("操作成功。"));
        }