Esempio n. 1
0
        /// <summary>
        /// 根据班次判断是否迟到
        /// </summary>
        /// <param name="sw">ONDUTYCLASSID 必传 某一班次 curTime 要判断的时间 默认为空取当前时间</param>
        /// <returns>true 迟到 false 未迟到</returns>
        public static bool isLate(DUTY_CLASS_SW sw)
        {
            DUTY_CLASS_Model m = GetModel(sw);//获取该班次信息

            if (string.IsNullOrEmpty(sw.curTime))
            {
                sw.curTime = PublicClassLibrary.ClsSwitch.SwitTM(DateTime.Now);
            }
            //班次开始时间
            DateTime dtB = Convert.ToDateTime(PublicClassLibrary.ClsSwitch.SwitDate(sw.curTime) + " " + m.DUTYBEGINTIME);
            //班次结束时间
            DateTime dtE = Convert.ToDateTime(PublicClassLibrary.ClsSwitch.SwitDate(sw.curTime) + " " + m.DUTYENDTIME);

            if (PublicClassLibrary.ClsSwitch.compDate(dtB, dtE, "1") == false)//如果结束时间小于开始时间,则结束时间加1天,即为跨天的时间
            {
                dtE = dtE.AddDays(1);
            }
            if (PublicClassLibrary.ClsSwitch.compDate(sw.curTime, dtE, "1") == true)
            {
                return(false);
            }
            else
            {
                return(true);
            }
            //return bln;
        }
Esempio n. 2
0
 /// <summary>
 /// 增、删、改
 /// </summary>
 /// <param name="m">参见模型</param>
 /// <returns>参见模型</returns>
 public static Message Manager(DUTY_CLASS_Model m)
 {
     if (m.opMethod == "Add")
     {
         Message msgUser = BaseDT.Duty.DUTY_CLASS.Add(m);
         return(new Message(msgUser.Success, msgUser.Msg, m.returnUrl));
     }
     else if (m.opMethod == "Del")
     {
         Message msgUser = BaseDT.Duty.DUTY_CLASS.Del(m);
         return(new Message(msgUser.Success, msgUser.Msg, m.returnUrl));
     }
     return(new Message(false, "无效操作", ""));
 }
Esempio n. 3
0
        /// <summary>
        /// 获取单条
        /// </summary>
        /// <returns></returns>
        public static DUTY_CLASS_Model GetModel(DUTY_CLASS_SW sw)
        {
            var dt             = BaseDT.Duty.DUTY_CLASS.GetDT(sw);
            DUTY_CLASS_Model m = new DUTY_CLASS_Model();

            if (dt.Rows.Count > 0)
            {
                int i = 0;
                m.BYORGNO       = dt.Rows[i]["BYORGNO"].ToString();
                m.DUTYCLASSID   = dt.Rows[i]["DUTYCLASSID"].ToString();
                m.DUTYCLASSNAME = dt.Rows[i]["DUTYCLASSNAME"].ToString();
                m.DUTYBEGINTIME = dt.Rows[i]["DUTYBEGINTIME"].ToString();
                m.DUTYENDTIME   = dt.Rows[i]["DUTYENDTIME"].ToString();
            }
            return(m);
        }
Esempio n. 4
0
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <returns></returns>
        public static IEnumerable <DUTY_CLASS_Model> GetListModel(DUTY_CLASS_SW sw)
        {
            var result = new List <DUTY_CLASS_Model>();
            var dt     = BaseDT.Duty.DUTY_CLASS.GetDT(sw);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DUTY_CLASS_Model m = new DUTY_CLASS_Model();
                m.BYORGNO       = dt.Rows[i]["BYORGNO"].ToString();
                m.DUTYCLASSID   = dt.Rows[i]["DUTYCLASSID"].ToString();
                m.DUTYCLASSNAME = dt.Rows[i]["DUTYCLASSNAME"].ToString();
                m.DUTYBEGINTIME = dt.Rows[i]["DUTYBEGINTIME"].ToString();
                m.DUTYENDTIME   = dt.Rows[i]["DUTYENDTIME"].ToString();
                result.Add(m);
            }
            return(result);
        }
Esempio n. 5
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public static Message Del(DUTY_CLASS_Model m)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("delete from DUTY_CLASS");
            sb.AppendFormat(" where DUTYCLASSID= '{0}'", ClsSql.EncodeSql(m.DUTYCLASSID));
            sb.AppendFormat(" and BYORGNO= '{0}'", ClsSql.EncodeSql(m.BYORGNO));
            bool bln = DataBaseClass.ExeSql(sb.ToString());

            if (bln == true)
            {
                return(new Message(true, "删除成功!", ""));
            }
            else
            {
                return(new Message(false, "删除失败!", ""));
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="m">参见模型</param>
        /// <returns>参见模型</returns>
        public static Message Add(DUTY_CLASS_Model m)
        {
            StringBuilder sb = new StringBuilder();

            if (isExists(new DUTY_CLASS_SW {
                BYORGNO = m.BYORGNO, DUTYCLASSID = m.DUTYCLASSID
            }) == true)                                                                                  //该条记录存在
            //return new Message(false, "添加失败,该组织机构码已存在!", "");
            {
                return(new Message(false, "添加失败,已存在该班次!", ""));
                //sb.AppendFormat("UPDATE DUTY_CLASS SET ");
                //sb.AppendFormat(" DUTYBEGINTIME='{0}',", ClsSql.EncodeSql(m.DUTYBEGINTIME));
                //sb.AppendFormat(" DUTYENDTIME='{0}'", ClsSql.EncodeSql(m.DUTYENDTIME));
                //sb.AppendFormat(" where BYORGNO= '{0}'", ClsSql.EncodeSql(m.BYORGNO));
                //sb.AppendFormat(" and DUTYCLASSID= '{0}'", ClsSql.EncodeSql(m.DUTYCLASSID));
            }
            else
            {
                sb.AppendFormat("INSERT INTO DUTY_CLASS(BYORGNO, DUTYCLASSID, DUTYCLASSNAME, DUTYBEGINTIME, DUTYENDTIME)");
                sb.AppendFormat("VALUES(");
                sb.AppendFormat("'{0}'", ClsSql.EncodeSql(m.BYORGNO));
                sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.DUTYCLASSID));
                sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.DUTYCLASSNAME));
                sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.DUTYBEGINTIME));
                sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.DUTYENDTIME));
                sb.AppendFormat(")");
            }

            bool bln = DataBaseClass.ExeSql(sb.ToString());

            if (bln == true)
            {
                return(new Message(true, "保存成功!", ""));
            }
            else
            {
                return(new Message(false, "保存失败,请检查各输入框是否正确!", ""));
            }
        }