Exemplo 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;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 判断记录是否存在
        /// </summary>
        /// <param name="sw">参见模型</param>
        /// <returns>true存在 false不存在</returns>
        public static bool isExists(DUTY_CLASS_SW sw)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("select 1 from DUTY_CLASS where 1=1");
            if (string.IsNullOrEmpty(sw.BYORGNO) == false)
            {
                sb.AppendFormat(" and BYORGNO='{0}'", ClsSql.EncodeSql(sw.BYORGNO));
            }
            if (string.IsNullOrEmpty(sw.DUTYCLASSID) == false)
            {
                sb.AppendFormat(" and DUTYCLASSID='{0}'", ClsSql.EncodeSql(sw.DUTYCLASSID));
            }
            return(DataBaseClass.JudgeRecordExists(sb.ToString()));
        }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="sw"></param>
        /// <returns></returns>
        public static DataTable GetDT(DUTY_CLASS_SW sw)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("select BYORGNO,DUTYCLASSID,DUTYCLASSNAME,DUTYBEGINTIME,DUTYENDTIME from DUTY_CLASS");
            sb.AppendFormat(" Where 1=1");
            if (string.IsNullOrEmpty(sw.DUTYCLASSID) == false)
            {
                sb.AppendFormat(" AND DUTYCLASSID='{0}'", sw.DUTYCLASSID);
            }
            if (string.IsNullOrEmpty(sw.BYORGNO) == false)
            {
                sb.AppendFormat(" AND BYORGNO='{0}'", sw.BYORGNO);
            }
            sb.AppendFormat(" ORDER BY DUTYCLASSID");
            DataSet ds = DataBaseClass.FullDataSet(sb.ToString());

            return(ds.Tables[0]);
        }