Exemplo n.º 1
0
 /// <summary>
 /// 審核畫面GridView
 /// </summary>
 /// <param name="dataBean">查詢條件</param>
 /// <param name="sb">傳入之前組好Command</param>
 /// <param name="isReset">StringBuilder Reset or not</param>
 public static void GetOnBizReqAppdOperationData(CheckVisitGridDataBean dataBean, ref StringBuilder sb, bool isReset = false)
 {
     if (isReset)
     {
         sb = new StringBuilder();
     }
     sb.Append("SELECT CompID,EmpID,EmpNameN,CONVERT(NVARCHAR(10),WriteDate,111) AS WriteDate,DeputyID + '-' + DeputyName AS DeputyID_Name");
     sb.Append(" ,CONVERT(NVARCHAR(10),VisitBeginDate,111) AS VisitBeginDate,CONVERT(NVARCHAR (5),BeginTime) AS BeginTime,CONVERT(NVARCHAR(10)");
     sb.Append(" ,VisitEndDate,111) AS VisitEndDate,CONVERT(NVARCHAR (5),EndTime) AS EndTime,VisitReasonCN,FormSeq,VF.FlowCaseID,OBL.FlowLogID");
     sb.Append(" FROM VisitForm VF");
     sb.Append(" LEFT JOIN OnBizReqAppd_ITRDFlowOpenLog OBL ON VF.FlowCaseID = OBL.FlowCaseID ");
     sb.Append(" LEFT JOIN PS_UserProxy UP ON VF.ValidID = UP.UserID AND CONVERT(VARCHAR(8),GETDATE(),112) BETWEEN UP.ProxyStartDate AND UP.ProxyEndDate");
     sb.Append(" WHERE (ValidID = @ValidID");
     sb.Append(" OR UP.ProxyUser = @ValidID)");
     sb.Append(" AND EmpID <> @ValidID ");
     sb.Append(" AND OBFormStatus = '2'");
     sb.Append(" ; ");
 }
Exemplo n.º 2
0
    public static bool GetVisitFormGridViewData(OnBizReqAppdOperationModel model, out List <CheckVisitGridDataBean> ReturnDatas, out string msg)
    {
        bool result = false;

        msg         = "";
        ReturnDatas = new List <CheckVisitGridDataBean>();
        try
        {
            using (var conn = new SqlConnection()
            {
                ConnectionString = DbHelper.getConnectionStrings(_attendantDBName).ConnectionString
            })
            {
                CheckVisitGridDataBean dataBean = new CheckVisitGridDataBean()
                {
                    CompID  = model.CompID,
                    ValidID = model.ValidID
                };
                StringBuilder sb = new StringBuilder();
                OnBizReqAppdOperationSql.GetOnBizReqAppdOperationData(dataBean, ref sb);
                try
                {
                    ReturnDatas = conn.Query <CheckVisitGridDataBean>(sb.ToString(), dataBean).ToList();
                }
                catch (Exception)
                {
                    throw;
                }
                if (ReturnDatas == null || ReturnDatas.Count == 0)
                {
                    throw new Exception("查無資料!");
                }
            }
            result = true;
        }
        catch (Exception ex)
        {
            msg = ex.Message;
        }
        return(result);
    }