Esempio n. 1
0
        /// <summary>
        /// cpj
        /// 传 日期时间区分 返回日期或者返回时间

        /// </summary>
        /// <param name="QF">取值: ComConst.Date 或者 ComConst.Time</param>
        /// <param name="addday">日期变更,例如去系统日期前一天则传值-1</param>
        /// <returns></returns>
        public static string GetSystemDateTime(string QF, string dateStyle, int addday)
        {
            string strSystemDT = string.Empty;

            try
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append("CALL getsysDateTime()");

                DataTable dt = DbHelperMySql.Query(strSql.ToString()).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    if (QF.Equals(ComConst.Date))
                    {
                        DateTime dtime = DateTime.Parse(dt.Rows[0][0].ToString());
                        if (addday != 0)
                        {
                            dtime = dtime.AddDays(addday);
                        }
                        if (dateStyle.Equals(ComConst.dateStyle_YMD))
                        {
                            strSystemDT = dtime.ToString("yyyy^MM^dd").Replace("^", "");
                        }
                        else if (dateStyle.Equals(ComConst.dateStyle_Y_M_D))
                        {
                            strSystemDT = dtime.ToString("yyyy^MM^dd").Replace("^", "/");
                        }
                    }
                    else
                    {
                        strSystemDT = dt.Rows[0][1].ToString();
                    }
                    return(strSystemDT);
                }
                else
                {
                    return(strSystemDT);
                }
            }
            catch (Exception ex)
            {
                if (QF.Equals(ComConst.Date))
                {
                    strSystemDT = DateTime.Parse(System.DateTime.Now.ToShortDateString()).ToString(dateStyle);
                }
                else
                {
                    strSystemDT = System.DateTime.Now.ToShortTimeString();
                }
                ComForm.InsertErrLog(ex.ToString(), "GetSystemDateTime");
                return(strSystemDT);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 判断 管理编号,区分 给出提示信息
        /// </summary>
        /// <param name="strGLBH">管理编号</param>
        /// <param name="strQF">区分</param>
        /// <returns></returns>
        public static bool checkSendMessage(string strGLBH, string strQF)
        {
            bool   blnResult   = false;
            string strErrMsgID = string.Empty;

            if ("9060".Equals(strGLBH))
            {
                switch (strQF)
                {
                case "":
                    break;
                }
            }
            else if ("9070".Equals(strGLBH))
            {
                switch (strQF)
                {
                case "":
                    break;
                }
            }
            else if ("9160".Equals(strGLBH))
            {
                switch (strQF)
                {
                case "":
                    break;
                }
            }
            //如果错误信息为空
            if (strErrMsgID.IsNullOrEmpty())
            {
                ComForm.DspMsg(strErrMsgID, "");
            }
            return(blnResult);
        }