Ejemplo n.º 1
0
    /// <summary>
    /// 新增附件
    /// </summary>
    /// <param name="AttachID"></param>
    /// <param name="attach"></param>
    /// <returns></returns>
    public bool InsertAttach(string AttachID, string attach)
    {
        bool isSuccess = false;

        try
        {
            DbHelper      db     = new DbHelper(_overtimeDBName);
            CommandHelper strSQL = db.CreateCommandHelper();
            DbConnection  cn     = db.OpenConnection();
            DbTransaction tx     = cn.BeginTransaction();

            strSQL.Reset();
            strSQL.AppendStatement(" UPDATE AttachInfo SET FileSize = -1,  FileBody = null WHERE AttachID = '" + AttachID + "'");
            strSQL.AppendStatement(" INSERT INTO AttachInfo (AttachID, SeqNo, FileName, FileExtName, FileSize, AnonymousAccess, UpdUser, UpdDate, UpdTime, FileBody, MD5Check) ");
            strSQL.Append(" SELECT '" + AttachID + "'");
            strSQL.Append(" , SeqNo, FileName, FileExtName, FileSize, AnonymousAccess, UpdUser, UpdDate, UpdTime, FileBody, MD5Check ");
            strSQL.Append(" FROM AttachInfo ");
            strSQL.Append(" WHERE AttachID = '" + attach + "'");

            using (DataTable dtSchedule = db.ExecuteDataSet(strSQL.BuildCommand()).Tables[0])
            {
                db.ExecuteNonQuery(strSQL.BuildCommand(), tx);
                tx.Commit();
            }
        }
        catch (Exception ex)
        {
            Debug.Print(">>>InsertAttach: " + ex.Message);
            LogHelper.WriteSysLog(ex); //將 Exception 丟給 Log 模組
        }

        return(isSuccess);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 值勤班表
    /// </summary>
    /// <param name="compID">公司別</param>
    /// <param name="empID">員工編號</param>
    /// <param name="SBStartDate">留守起日</param>
    /// <param name="SBEndDate">留守迄日</param>
    /// <param name="errMsg">錯誤訊息</param>
    /// <param name="schedule">班表</param>
    /// <returns></returns>
    private bool GetDutySchedule(string compID, string empID, string SBStartDate, string SBEndDate, out StringBuilder errMsg, out DataTable schedule)
    {
        errMsg   = new StringBuilder();
        schedule = new DataTable();

        try
        {
            DbHelper      db = new DbHelper(_overtimeDBName);
            CommandHelper sb = db.CreateCommandHelper();

            sb.Reset();
            sb.AppendStatement("SELECT");
            sb.Append(" WTBeginTime AS BeginTime, WTEndTime AS EndTime ");
            sb.Append(" FROM EmpGuardWorkTime ");
            sb.Append(" WHERE 0 = 0 ");
            sb.Append(" AND CompID = '" + compID + "' ");
            sb.Append(" AND EmpID = '" + empID + "' ");
            sb.Append(" AND DutyDate BETWEEN '" + SBStartDate + "' AND '" + SBEndDate + "' ");

            using (DataTable dtSchedule = db.ExecuteDataSet(sb.BuildCommand()).Tables[0])
            {
                schedule = dtSchedule;
                return(dtSchedule.Rows.Count > 0 ? true : false);
            }
        }
        catch (Exception ex)
        {
            Debug.Print(">>>GetDutySchedule: " + ex.Message);
            LogHelper.WriteSysLog(ex); //將 Exception 丟給 Log 模組
            errMsg.AppendLine(ex.Message);
            schedule = null;
            return(false);
        }
    }
Ejemplo n.º 3
0
    protected void fmMainRefresh()
    {
        DbHelper      db = new DbHelper(LegalSample._LegalSysDBName);
        DataTable     dt = null;
        CommandHelper sb = db.CreateCommandHelper();

        sb.Reset();
        sb.AppendStatement(string.Format("Select * From {0} Where CaseNo = ", LegalSample._LegalConsultCaseTableName)).AppendParameter("CaseNo", _CurrCaseNo).Append(" and CaseStatus <> 'Draft' ");
        dt = db.ExecuteDataSet(sb.BuildCommand()).Tables[0];
        if (dt != null && dt.Rows.Count > 0)
        {
            //DataRow dr = dt.Rows[0];
            if (string.IsNullOrEmpty(_CurrFlowID) && string.IsNullOrEmpty(_CurrFlowLogID))
            {
                fmMain.ChangeMode(FormViewMode.ReadOnly);
            }
            else
            {
                fmMain.ChangeMode(FormViewMode.Edit);
            }
            fmMain.DataSource = dt;
            fmMain.DataBind();
        }
        else
        {
            fmMain.Visible = false;
            labMsg.Visible = true;
            labMsg.Text    = Util.getHtmlMessage(Util.HtmlMessageKind.ParaError, string.Format(RS.Resources.Msg_DataNotFound1, _CurrCaseNo) + "<br><br>");
            return;
        }
    }
Ejemplo n.º 4
0
    public static void insertFromAdvanceToData(string flow, ref CommandHelper sb)
    {
        DbHelper      db      = new DbHelper(_DBName);
        CommandHelper sb2     = db.CreateCommandHelper();
        Aattendant    At      = new Aattendant();
        string        OTTxnID = "";

        sb2.Append(" SELECT * FROM OverTimeAdvance WHERE FlowCaseID='" + flow.Substring(0, 14) + "'");
        DataTable dtOT = db.ExecuteDataSet(sb2.BuildCommand()).Tables[0];

        if (dtOT.Rows.Count > 0)
        {
            sb2.Reset();
            for (int i = 0; i < dtOT.Rows.Count; i++)
            {
                //leo modify 20170110 OTTxnID OTSeqNo
                int OTSeq = At.QuerySeq("OverTimeDeclaration", dtOT.Rows[i]["OTCompID"].ToString(), dtOT.Rows[i]["OTEmpID"].ToString(), dtOT.Rows[i]["OTStartDate"].ToString());
                if (dtOT.Rows[i]["OTSeqNo"].ToString() == "1")
                {
                    OTTxnID = (UserInfo.getUserInfo().CompID + dtOT.Rows[i]["OTEmpID"].ToString() + Convert.ToDateTime(dtOT.Rows[i]["OTStartDate"]).ToString("yyyyMMdd") + OTSeq.ToString("00"));
                }
                sb.Append(" INSERT INTO OverTimeDeclaration(OTCompID,OTEmpID,OTStartDate,OTEndDate,OTSeq,OTTxnID,OTSeqNo,OTFromAdvanceTxnId,DeptID,OrganID,DeptName,OrganName,FlowCaseID,OTStartTime,OTEndTime,OTTotalTime,SalaryOrAdjust,AdjustInvalidDate,AdjustStatus,AdjustDate,MealFlag,MealTime,OTTypeID,OTReasonID,OTReasonMemo,OTAttachment,OTFormNO,OTRegisterID,OTRegisterDate,OTStatus,OTValidDate,OTValidID,OTRejectDate,OTRejectID,OTGovernmentNo,OTSalaryPaid,HolidayOrNot,ProcessDate,OTPayDate,OTModifyDate,OTRemark,KeyInComp,KeyInID,HRKeyInFlag,LastChgComp,LastChgID,LastChgDate,OTRegisterComp) ");
                sb.Append(" VALUES('" + dtOT.Rows[i]["OTCompID"] + "', '" + dtOT.Rows[i]["OTEmpID"] + "', '" + dtOT.Rows[i]["OTStartDate"] + "', '" + dtOT.Rows[i]["OTEndDate"] + "', '" + OTSeq + "',");
                sb.Append(" '" + OTTxnID + "','" + dtOT.Rows[i]["OTSeqNo"] + "','" + dtOT.Rows[i]["OTTxnID"] + "',"); //leo modify 20170110
                sb.Append(" '" + dtOT.Rows[i]["DeptID"] + "', '" + dtOT.Rows[i]["OrganID"] + "','" + dtOT.Rows[i]["DeptName"] + "','" + dtOT.Rows[i]["OrganName"] + "',");
                sb.Append(" '', ");                                                                                   //流程ID
                sb.Append(" '" + dtOT.Rows[i]["OTStartTime"] + "', '" + dtOT.Rows[i]["OTEndTime"] + "', '" + dtOT.Rows[i]["OTTotalTime"] + "',");
                sb.Append(" '" + dtOT.Rows[i]["SalaryOrAdjust"] + "' ,");                                             //轉薪資或補休
                sb.Append(" '" + Convert.ToDateTime(dtOT.Rows[i]["AdjustInvalidDate"]).ToString("yyyy-MM-dd") + "', ");
                //失效時間 " '1900-01-01 00:00:00.000', "
                //失效時間 " '" +  dtOT.Rows[i]["AdjustInvalidDate"] + "', "
                //20170309-leo modify
                //失效時間 " '" + Convert.ToDateTime(dtOT.Rows[i]["AdjustInvalidDate"]).ToString("yyyy-MM-dd") + "', "
                sb.Append(" '', ");
                sb.Append(" '1900-01-01 00:00:00.000', ");
                sb.Append(" '" + dtOT.Rows[i]["MealFlag"] + "', '" + dtOT.Rows[i]["MealTime"] + "', '" + dtOT.Rows[i]["OTTypeID"] + "',");
                sb.Append(" '" + dtOT.Rows[i]["OTReasonID"] + "', "); //加班原因的代號
                sb.Append(" '" + dtOT.Rows[i]["OTReasonMemo"] + "', ");
                sb.Append(" '" + dtOT.Rows[i]["OTAttachment"] + "', '" + dtOT.Rows[i]["OTFormNO"] + "', ");
                sb.Append(" '" + dtOT.Rows[i]["OTRegisterID"] + "', '" + Convert.ToDateTime(dtOT.Rows[i]["OTRegisterDate"]).ToString("yyyy-MM-dd HH:mm:ss.fff") + "', '1',");//申請單狀態
                sb.Append(" '1900-01-01 00:00:00.000', ");
                sb.Append(" '', ");
                sb.Append(" '1900-01-01 00:00:00.000', ");
                sb.Append(" '', ");
                sb.Append(" '', ");
                sb.Append(" '0', ");
                sb.Append(" '" + dtOT.Rows[i]["HolidayOrNot"] + "', ");
                sb.Append(" '1900-01-01 00:00:00.000', ");
                sb.Append(" '', ");
                sb.Append(" '1900-01-01 00:00:00.000', ");
                sb.Append(" '', ");
                sb.Append(" '" + dtOT.Rows[i]["LastChgComp"] + "', '" + dtOT.Rows[i]["OTRegisterID"] + "', ");
                sb.Append(" '', ");
                sb.Append(" '" + dtOT.Rows[i]["LastChgComp"] + "', ");
                sb.Append(" '" + dtOT.Rows[i]["OTRegisterID"] + "', ");
                sb.Append(" '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "',");
                sb.Append(" '" + dtOT.Rows[0]["OTRegisterComp"] + "'); ");
            }
        }
    }
    private bool boolUpEmpRankID(string AD, string FlowCaseID, string UpEmpRankID)
    {
        DbHelper      db = new DbHelper(Aattendant._AattendantDBName);
        CommandHelper sb = db.CreateCommandHelper();
        DataTable     dt;
        string        MapEmpRankID, OTEmpID;

        sb.Append(" SELECT Top 1 isnull(P.CompID,'') as CompID,isnull(P.RankID,'')as RankID FROM " + CustVerify.ADTable(AD) + " OT ");
        sb.Append(" LEFT JOIN " + _eHRMSDB + ".[dbo].[Personal] P ON OT.OTEmpID=P.EmpID and OT.OTCompID=P.CompID");
        sb.Append(" WHERE OT.FlowCaseID='" + FlowCaseID + "' and OTSeqNo='1'");
        dt = db.ExecuteDataSet(sb.BuildCommand()).Tables[0];
        if (dt.Rows.Count == 0)
        {
            return(false);
        }
        MapEmpRankID = RankIDMapping(UserInfo.getUserInfo().CompID, UpEmpRankID);
        if (MapEmpRankID == "")
        {
            return(false);
        }
        OTEmpID = RankIDMapping(dt.Rows[0]["CompID"].ToString(), dt.Rows[0]["RankID"].ToString());
        if (OTEmpID == "")
        {
            return(false);
        }
        return(int.Parse(MapEmpRankID) <= int.Parse(OTEmpID) ? true : false);
    }
Ejemplo n.º 6
0
    /// <summary>
    /// 取得個人班表
    /// </summary>
    /// <param name="compID">公司別</param>
    /// <param name="empID">員工編號</param>
    /// <param name="SBStartDate">留守起日</param>
    /// <param name="SBEndDate">留守迄日</param>
    /// <param name="errMsg">錯誤訊息</param>
    /// <param name="schedule">班表</param>
    /// <remarks>StartDate:生效日</remarks>
    /// <returns>bool</returns>
    private bool GetPersonalSchedule(string compID, string empID, string SBStartDate, string SBEndDate, out StringBuilder errMsg, out DataTable schedule)
    {
        errMsg   = new StringBuilder();
        schedule = new DataTable();

        try
        {
            DbHelper      db = new DbHelper(_overtimeDBName);
            CommandHelper sb = db.CreateCommandHelper();

            sb.Reset();

            sb.AppendStatement(" SELECT TOP 1 WT.BeginTime, WT.EndTime FROM EmpWorkTimeLog EL ");
            sb.Append(" LEFT JOIN [" + _eHRMSDB + "].[dbo].[WorkTime] WT ON WT.CompID = EL.CompID AND WT.WTID = EL.WTID ");
            sb.Append(" WHERE 1 = 1 ");
            sb.Append(" AND EL.CompID = '" + compID + "' ");
            sb.Append(" AND EL.EmpID = '" + empID + "' ");
            sb.Append(" AND CONVERT(VARCHAR, EL.StartDate, 111) <= '" + SBStartDate + "' ");
            sb.Append(" AND EL.LastChgDate = ( ");
            sb.Append(" SELECT TOP 1 LastChgDate FROM EmpWorkTimeLog WHERE 1 = 1 ");
            sb.Append(" AND CONVERT(VARCHAR, StartDate, 111) <= '" + SBStartDate + "' ");
            sb.Append(" AND ActionFlag <> 'D' ");
            sb.Append(" AND CompID = '" + compID + "' ");
            sb.Append(" AND EmpID = '" + empID + "' ");
            sb.Append(" ORDER BY StartDate DESC, LastChgDate DESC) ");

            //留守起迄日不同天需再取得迄日的班表
            if (!SBStartDate.Equals(SBEndDate))
            {
                sb.Append(" UNION ALL ");
                sb.Append(" SELECT TOP 1 WT.BeginTime, WT.EndTime FROM EmpWorkTimeLog EL ");
                sb.Append(" LEFT JOIN [" + _eHRMSDB + "].[dbo].[WorkTime] WT ON WT.CompID = EL.CompID AND WT.WTID = EL.WTID ");
                sb.Append(" WHERE 1 = 1 ");
                sb.Append(" AND EL.CompID = '" + compID + "' ");
                sb.Append(" AND EL.EmpID = '" + empID + "' ");
                sb.Append(" AND CONVERT(VARCHAR, EL.StartDate, 111) <= '" + SBEndDate + "' ");
                sb.Append(" AND EL.LastChgDate = ( ");
                sb.Append(" SELECT TOP 1 LastChgDate FROM EmpWorkTimeLog WHERE 1 = 1 ");
                sb.Append(" AND CONVERT(VARCHAR, StartDate, 111) <= '" + SBEndDate + "' ");
                sb.Append(" AND ActionFlag <> 'D' ");
                sb.Append(" AND CompID = '" + compID + "' ");
                sb.Append(" AND EmpID = '" + empID + "' ");
                sb.Append(" ORDER BY StartDate DESC, LastChgDate DESC) ");
            }

            using (DataTable dtSchedule = db.ExecuteDataSet(sb.BuildCommand()).Tables[0])
            {
                schedule = dtSchedule;
                return(dtSchedule.Rows.Count > 0 ? true : false);
            }
        }
        catch (Exception ex)
        {
            Debug.Print(">>>GetPersonalSchedule: " + ex.Message);
            LogHelper.WriteSysLog(ex); //將 Exception 丟給 Log 模組
            errMsg.AppendLine(ex.Message);
            schedule = null;
            return(false);
        }
    }
Ejemplo n.º 7
0
    /// <summary>
    /// 公司班表
    /// </summary>
    /// <param name="compID">公司別</param>
    /// <param name="empID">員工編號</param>
    /// <param name="errMsg">錯誤訊息</param>
    /// <param name="schedule">班表</param>
    /// <returns>bool</returns>
    /// <remarks>目前不曉得該怎取得過去日期的班表,日後可能需要再修改</remarks>
    private bool GetCompSchedule(string compID, string empID, out StringBuilder errMsg, out DataTable schedule)
    {
        errMsg   = new StringBuilder();
        schedule = new DataTable();

        try
        {
            DbHelper      db = new DbHelper(_eHRMSDB);
            CommandHelper sb = db.CreateCommandHelper();

            sb.Reset();
            sb.AppendStatement("SELECT");
            sb.Append(" WT.BeginTime, WT.EndTime, WT.RestBeginTime, WT.RestEndTime ");
            sb.Append(" FROM PersonalOther PO ");
            sb.Append(" LEFT JOIN WorkTime WT ON WT.CompID = PO.CompID AND WT.WTID = PO.WTID ");
            sb.Append(" WHERE 0 = 0 ");
            sb.Append(" AND PO.CompID = '" + compID + "' ");
            sb.Append(" AND PO.EmpID = '" + empID + "' ");
            sb.Append(" ; ");

            using (DataTable dtSchedule = db.ExecuteDataSet(sb.BuildCommand()).Tables[0])
            {
                schedule = dtSchedule;
                return(dtSchedule.Rows.Count > 0 ? true : false);
            }
        }
        catch (Exception ex)
        {
            Debug.Print(">>>GetCompSchedule: " + ex.Message);
            LogHelper.WriteSysLog(ex); //將 Exception 丟給 Log 模組
            errMsg.AppendLine(ex.Message);
            schedule = null;
            return(false);
        }
    }
Ejemplo n.º 8
0
    protected void fmMainRefresh()
    {
        DbHelper  db = new DbHelper(_DBName);
        DataTable dt = null;

        if (!string.IsNullOrEmpty(_RuleID))
        {
            CommandHelper sb = db.CreateCommandHelper();
            sb.Reset();
            sb.AppendStatement("Select * From AclAdminRuleArea Where RuleID = ").AppendParameter("RuleID", _RuleID);
            sb.Append(" and AreaID = ").AppendParameter("AreaID", _AreaID);
            dt = db.ExecuteDataSet(sb.BuildCommand()).Tables[0];
        }

        if (_IsADD)
        {
            // Add,Copy
            fmMain.ChangeMode(FormViewMode.Insert);
            fmMain.DataSource = dt;
            fmMain.DataBind();
        }
        else
        {
            //Edit
            fmMain.ChangeMode(FormViewMode.Edit);
            fmMain.DataSource = dt;
            fmMain.DataBind();
        }

        Util.setJS_AlertDirtyData(fmMain);
    }
Ejemplo n.º 9
0
    protected void fmMainRefresh()
    {
        if (string.IsNullOrEmpty(_MainID))
        {
            if (_IsADD)
            {
                //新增訂單模式
                fmMain.ChangeMode(FormViewMode.Insert);
                //設定唯讀欄位
                Util.setReadOnly("txtCompID", true);
                Util.setReadOnly("txtDeptID", true);
                Util.setReadOnly("txtUserID", true);
                Util.setReadOnly("txtCompName", true);
                Util.setReadOnly("txtDeptName", true);
                Util.setReadOnly("txtUserName", true);
                fmMain.DataSource = null;
                fmMain.DataBind();
            }
        }
        else
        {
            //顯示既有訂單
            DbHelper      db = new DbHelper(_DBName);
            DataTable     dt = null;
            CommandHelper sb = db.CreateCommandHelper();
            sb.Reset();
            sb.AppendStatement("Select * From PO Where POID = ").AppendParameter("POID", _MainID);
            dt = db.ExecuteDataSet(sb.BuildCommand()).Tables[0];

            fmMain.ChangeMode(FormViewMode.Edit);
            fmMain.DataSource = dt;
            fmMain.DataBind();
        }
        Util.setJS_AlertDirtyData(fmMain);
    }
Ejemplo n.º 10
0
    /// <summary>
    /// 事先申請到事後申報的送簽單被駁回,須重寫一筆有OTFromAdvanceTxnId的暫存到事後申報,供使用者再送簽
    /// </summary>
    /// <param name="FlowCaseID">事後的</param>
    /// <param name="strSQL">要組合並一起執行的SQL字串</param>
    public static void AfterReject_CheckAndInsert(string FlowCaseID, ref CommandHelper strSQL)
    {
        DbHelper      db = new DbHelper(Aattendant._AattendantDBName);
        CommandHelper sb = db.CreateCommandHelper();

        //sb.Append(" SELECT DISTINCT OTFromAdvanceTxnId ");
        //sb.Append(" FROM OverTimeDeclaration");
        //sb.Append(" WHERE FlowCaseID=").AppendParameter("FlowCaseID", FlowCaseID);
        //sb.Append(" and OTSeqNo='1' ");
        /*================*/
        sb.Append(" SELECT isnull(A.FlowCaseID,'') as AFlowCaseID ");
        sb.Append(" FROM OverTimeDeclaration D ");
        sb.Append(" left join OverTimeAdvance A on D.OTFromAdvanceTxnId=A.OTTxnID and A.OTSeqNo='1' and A.OTTxnID!='' ");
        sb.Append(" WHERE D.FlowCaseID=").AppendParameter("FlowCaseID", FlowCaseID);
        sb.Append(" and D.OTSeqNo='1' ");
        DataTable dt = db.ExecuteDataSet(sb.BuildCommand()).Tables[0];

        if (dt.Rows.Count > 0)
        {
            string AFlowCaseID = dt.Rows[0]["AFlowCaseID"].ToString();
            if (!string.IsNullOrEmpty(AFlowCaseID))
            {
                insertFromAdvanceToData(AFlowCaseID, ref strSQL);
            }
        }
    }
Ejemplo n.º 11
0
    /// <summary>
    /// 確認刪除主檔(自動刪除相關明細檔)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnMainDelete_Click(object sender, EventArgs e)
    {
        DbHelper      db = new DbHelper(_DBName);
        CommandHelper sb = db.CreateCommandHelper();

        sb.Reset();
        sb.AppendStatement("Delete PO       Where POID = ").AppendParameter("POID", _MainID);
        sb.AppendStatement("Delete PODetail Where POID = ").AppendParameter("POID", _MainID);

        DbConnection  cn = db.OpenConnection();
        DbTransaction tx = cn.BeginTransaction();

        try
        {
            db.ExecuteNonQuery(sb.BuildCommand(), tx);
            tx.Commit();
            _MainID    = "";
            _DetailSeq = -1;
            Refresh(true, true);
            Util.NotifyMsg("主檔及相關明細檔刪除成功", Util.NotifyKind.Success);
        }
        catch
        {
            tx.Rollback();
            Util.NotifyMsg("主檔及相關明細檔刪除失敗", Util.NotifyKind.Error);
        }
        finally
        {
            cn.Close();
            cn.Dispose();
            tx.Dispose();
        }
    }
Ejemplo n.º 12
0
 protected void DeleteDocKind(string strKindNo)
 {
     if (string.IsNullOrEmpty(strKindNo))
     {
         Util.MsgBox(Util.getHtmlMessage(Util.HtmlMessageKind.ParaDataError));
         return;
     }
     else
     {
         try
         {
             //相關連的子類別會由 LegalDocKind 的 Trigger 自動遞迴刪除
             DbHelper      db = new DbHelper(LegalSample._LegalSysDBName);
             CommandHelper sb = db.CreateCommandHelper();
             sb.Reset();
             sb.AppendStatement("Delete LegalDocKind Where KindNo = ").AppendParameter("KindNo", strKindNo);
             db.ExecuteNonQuery(sb.BuildCommand());
             Util.NotifyMsg(RS.Resources.Msg_DeleteSucceed, Util.NotifyKind.Success);
         }
         catch (Exception ex)
         {
             Util.MsgBox(Util.getHtmlMessage(Util.HtmlMessageKind.Error, ex.ToString()));
         }
     }
 }
Ejemplo n.º 13
0
    protected void btnMainDelete_Click(object sender, EventArgs e)
    {
        DbHelper db = new DbHelper(_DBName);

        try
        {
            Dictionary <string, string> dicKey = new Dictionary <string, string>();
            dicKey.Clear();
            dicKey.Add("RuleID", _RuleID);
            dicKey.Add("AreaID", _AreaID);
            AclExpress.IsAclTableLog("AclAdminRuleArea", dicKey, LogHelper.AppTableLogType.Delete);
            AclExpress.IsAclTableLog("AclAdminRuleAreaGrantList", dicKey, LogHelper.AppTableLogType.Delete);

            CommandHelper sb = db.CreateCommandHelper();
            sb.Reset();
            sb.AppendStatement("Delete AclAdminRuleAreaGrantList  Where RuleID = ").AppendParameter("RuleID", _RuleID);
            sb.Append(" and AreaID = ").AppendParameter("AreaID", _AreaID);
            sb.AppendStatement("Delete AclAdminRuleArea           Where RuleID = ").AppendParameter("RuleID", _RuleID);
            sb.Append(" and AreaID = ").AppendParameter("AreaID", _AreaID);
            db.ExecuteNonQuery(sb.BuildCommand());
            Util.NotifyMsg("刪除成功", Util.NotifyKind.Success);
            _RuleID  = "";
            _AreaID  = "";
            _GrantID = "";
            Refresh(true, true);
        }
        catch
        {
            throw;
        }
    }
Ejemplo n.º 14
0
    /// <summary>
    /// 依照事先事後找尋最近一筆(行政或功能)線資料,依照AD判別
    /// </summary>
    /// <param name="FlowCaseID">FlowCaseID</param>
    /// <param name="AD">A事先/D事後</param>
    /// <returns>全部欄位</returns>
    public static DataTable HROverTimeLogAD(string FlowCaseID, string AD)
    {
        DbHelper      db = new DbHelper(Aattendant._AattendantDBName);
        CommandHelper sb = db.CreateCommandHelper();

        sb.Append(" select Top 1 * from HROverTimeLog where FlowCaseID='" + FlowCaseID + "'   and OTMode='" + AD + "' order by Seq desc");
        return(db.ExecuteDataSet(sb.BuildCommand()).Tables[0]);
    }
Ejemplo n.º 15
0
    void ucGridView1_GridViewCommand(object sender, Util_ucGridView.GridViewEventArgs e)
    {
        string    strCmd = e.CommandName;
        DataTable dt     = e.DataTable;

        if (dt != null && dt.Rows.Count > 0)
        {
            UserInfo      oUser = UserInfo.getUserInfo();
            DbHelper      db    = new DbHelper(LegalSample._LegalSysDBName);
            CommandHelper sb    = db.CreateCommandHelper();
            sb.Reset();
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                switch (e.CommandName)
                {
                case "cmdUpdateAll":
                    sb.AppendStatement(string.Format("Update {0} Set DocNo = DocNo ", LegalSample._LegalDocTableName));
                    for (int j = 1; j < dt.Columns.Count; j++)
                    {
                        sb.Append(" ," + dt.Columns[j].ColumnName + " = ").AppendParameter(dt.Columns[j].ColumnName + i, dt.Rows[i][j].ToString());
                    }
                    sb.Append(" ,UpdUser = "******"UserID", oUser.UserID);
                    sb.Append(" ,UpdUserName = "******"UserName", oUser.UserName);
                    sb.Append(" ,UpdDateTime = ").AppendDbDateTime();
                    sb.Append(" Where 0=0 ");
                    sb.Append(" And DocNo  =").AppendParameter("DocNo" + i, dt.Rows[i][0].ToString().Split(',')[0]);
                    break;

                default:
                    break;
                }
            }

            DbConnection  cn = db.OpenConnection();
            DbTransaction tx = cn.BeginTransaction();
            try
            {
                db.ExecuteNonQuery(sb.BuildCommand(), tx);
                tx.Commit();
                Util.NotifyMsg(RS.Resources.Msg_Succeed, Util.NotifyKind.Success); //處理成功
            }
            catch
            {
                tx.Rollback();
                Util.NotifyMsg(RS.Resources.Msg_Error, Util.NotifyKind.Error); //處理失敗
            }
            finally
            {
                cn.Close();
                cn.Dispose();
                tx.Dispose();
            }
        }
        else
        {
            Util.MsgBox(RS.Resources.Msg_DataNotFound);
        }
    }
Ejemplo n.º 16
0
    //確定更新
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        string strCaseNo          = ((TextBox)Util.FindControlEx(fmMain, "txtCaseNo")).Text;
        string strIsUrgent        = ((CheckBox)Util.FindControlEx(fmMain, "chkIsUrgent")).Checked ? "Y" : "N";
        string strSubject         = ((Util_ucTextBox)Util.FindControlEx(fmMain, "ucSubject")).ucTextData;
        string strOutlined        = ((Util_ucTextBox)Util.FindControlEx(fmMain, "ucOutlined")).ucTextData;
        string strPropOpinion     = ((Util_ucTextBox)Util.FindControlEx(fmMain, "ucPropOpinion")).ucTextData;
        string strExpectCloseDate = ((Util_ucDatePicker)Util.FindControlEx(fmMain, "ucExpectCloseDate")).ucSelectedDate;


        DbHelper      db = new DbHelper(LegalSample._LegalSysDBName);
        CommandHelper sb = db.CreateCommandHelper();

        sb.Reset();
        sb.AppendStatement(string.Format("Update {0} Set ", LegalSample._LegalConsultCaseTableName));
        sb.Append("  IsUrgent   = ").AppendParameter("IsUrgent", strIsUrgent);
        sb.Append(", Subject   = ").AppendParameter("Subject", strSubject);
        sb.Append(", Outlined   = ").AppendParameter("Outlined", strOutlined);
        sb.Append(", PropOpinion   = ").AppendParameter("PropOpinion", strPropOpinion);

        if (!string.IsNullOrEmpty(strExpectCloseDate))
        {
            sb.Append(", ExpectCloseDate   = ").AppendParameter("ExpectCloseDate", strExpectCloseDate);
        }
        else
        {
            sb.Append(", ExpectCloseDate   = null ");
        }

        UserInfo oUser = UserInfo.getUserInfo();

        sb.Append(", UpdDept   = ").AppendParameter("Dept", oUser.DeptID);
        sb.Append(", UpdDeptName = ").AppendParameter("DeptName", oUser.DeptName);
        sb.Append(", UpdUser = "******"User", oUser.UserID);
        sb.Append(", UpdUserName = "******"UserName", oUser.UserName);
        sb.Append(", UpdDateTime  = ").AppendDbDateTime();
        sb.Append("  Where CaseNo = ").AppendParameter("CaseNo", strCaseNo);

        try
        {
            if (db.ExecuteNonQuery(sb.BuildCommand()) >= 0)
            {
                Util.NotifyMsg(RS.Resources.Msg_EditSucceed, Util.NotifyKind.Success); //資料更新成功
                fmMain.DataSource = null;
                fmMain.DataBind();
                divMainFormView.Visible = false;
                ucGridView1.Refresh(true);
                divMainGridview.Visible = true;
            }
        }
        catch (Exception ex)
        {
            //將 Exception 丟給 Log 模組
            LogHelper.WriteSysLog(ex);
            //資料更新失敗
            Util.NotifyMsg(RS.Resources.Msg_EditFail, Util.NotifyKind.Error);
        }
    }
Ejemplo n.º 17
0
    public bool IsDataExists(String strTable, String strWhere)
    {
        DbHelper      db = new DbHelper(_DBName);
        CommandHelper sb = db.CreateCommandHelper();

        sb.Append("Select Count(*) Cnt From " + strTable);
        sb.Append(" Where 1 = 1 " + strWhere);
        return(int.Parse(db.ExecuteScalar(sb.BuildCommand()).ToString()) == 0 ? true : false);
    }
Ejemplo n.º 18
0
    /// <summary>
    /// 「更新」按鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        DbHelper      db = new DbHelper(_DBName);
        CommandHelper sb = db.CreateCommandHelper();
        //取得編輯結果
        Dictionary <string, string> oEditResult = Util.getControlEditResult(fmMain);

        //去除不必要欄位
        oEditResult.Remove("UpdUser");
        oEditResult.Remove("UpdDateTime");

        //組合SQL
        sb.Reset();
        sb.AppendStatement("Update ").Append(_TableName).Append(" set ");

        //處理非鍵值欄位
        bool isComma = false;

        foreach (var pair in oEditResult)
        {
            if (!_PKList.Contains(pair.Key))
            {
                switch (pair.Key)
                {
                default:
                    if (isComma)
                    {
                        sb.Append(" , ");
                    }
                    else
                    {
                        isComma = true;
                    }
                    sb.Append(pair.Key).Append(" = ").AppendParameter(pair.Key, pair.Value);
                    break;
                }
            }
        }

        //處理鍵值欄位
        sb.Append(" Where 0 = 0 ");
        sb.Append(Util.getDataQueryKeySQL(_PKList, oEditResult));

        //執行SQL
        if (db.ExecuteNonQuery(sb.BuildCommand()) >= 0)
        {
            Util.NotifyMsg(RS.Resources.Msg_EditSucceed, Util.NotifyKind.Success); //更新成功
        }
        else
        {
            Util.NotifyMsg(RS.Resources.Msg_EditFail, Util.NotifyKind.Error); //更新失敗
        }

        divMainFormView.Visible = false;
        divMainGridview.Visible = true;
        ucGridView1.Refresh();
    }
Ejemplo n.º 19
0
    public static string getFlowLogID(string FlowCustDB, string FlowCaseID)
    {
        DbHelper      db = new DbHelper(Aattendant._AattendantDBName);
        CommandHelper sb = db.CreateCommandHelper();

        sb.Append(" select FlowLogID from " + FlowCustDB + "FlowFullLog ");
        sb.Append(" WHERE FlowCaseID =").AppendParameter("FlowCaseID", FlowCaseID);
        sb.Append(" Order by FlowLogID desc ");
        return(db.ExecuteScalar(sb.BuildCommand()).ToString());
    }
Ejemplo n.º 20
0
    /// <summary>
    /// 取得收件人相關資料
    /// </summary>
    /// <returns>回傳DataTable[EMail],[Name]</returns>
    private DataTable getMailInfo(string CompID, string EmpID)
    {
        DbHelper      db = new DbHelper(Aattendant._AattendantDBName);
        CommandHelper sb = db.CreateCommandHelper();

        sb.Append(" select distinct isnull(C.EMail,'') as EMail,P.Name from " + _eHRMSDB + ".[dbo].Personal P ");
        sb.Append(" left join " + _eHRMSDB + ".[dbo].[Communication] C on C.IDNo=P.IDNo ");
        sb.Append(" where P.CompID='" + CompID + "' and P.EmpID='" + EmpID + "' ");
        return(db.ExecuteDataSet(sb.BuildCommand()).Tables[0]);
    }
Ejemplo n.º 21
0
    protected void btnMainUpdate_Click(object sender, EventArgs e)
    {
        Dictionary <string, string> oDic = Util.getControlEditResult(fmMain);

        string strFlowStepMailToList = ((Util_ucCheckBoxList)fmMain.FindControl("chkFlowStepMailToList")).ucSelectedIDList;

        strFlowStepMailToList = strFlowStepMailToList + "," + ((Util_ucTextBox)fmMain.FindControl("txtFlowStepMailToList")).ucTextData;
        strFlowStepMailToList = Util.getStringJoin(Util.getFixList(strFlowStepMailToList.Split(',')));

        UserInfo      oUser = UserInfo.getUserInfo();
        DbHelper      db    = new DbHelper(FlowExpress._FlowSysDB);
        CommandHelper sb    = db.CreateCommandHelper();

        sb.Reset();
        sb.AppendStatement("Update FlowStep Set ");
        sb.Append("  FlowStepName        = ").AppendParameter("txtFlowStepName", oDic["txtFlowStepName"]);
        sb.Append(", FlowStepBatchEnabled    = ").AppendParameter("chkFlowStepBatchEnabled", oDic["chkFlowStepBatchEnabled"]);
        sb.Append(", FlowStepMailToList    = ").AppendParameter("FlowStepMailToList", strFlowStepMailToList);
        sb.Append(", FlowStepCustVerifyURL    = ").AppendParameter("txtFlowStepCustVerifyURL", oDic["txtFlowStepCustVerifyURL"]);
        sb.Append(", FlowStepAttachMaxQty    = ").AppendParameter("txtFlowStepAttachMaxQty", oDic["txtFlowStepAttachMaxQty"]);
        sb.Append(", FlowStepAttachMaxKB    = ").AppendParameter("txtFlowStepAttachMaxKB", oDic["txtFlowStepAttachMaxKB"]);
        sb.Append(", FlowStepAttachTotKB    = ").AppendParameter("txtFlowStepAttachTotKB", oDic["txtFlowStepAttachTotKB"]);
        sb.Append(", FlowStepAttachExtList    = ").AppendParameter("txtFlowStepAttachExtList", oDic["txtFlowStepAttachExtList"]);
        sb.Append(", Remark    = ").AppendParameter("txtRemark", oDic["txtRemark"]);

        sb.Append(", UpdUser = "******"UpdUser", oUser.UserID);
        sb.Append(", UpdDateTime = ").AppendDbDateTime();
        sb.Append("  Where FlowID = ").AppendParameter("txtFlowID", oDic["txtFlowID"]);
        sb.Append("    And FlowStepID = ").AppendParameter("txtFlowStepID", oDic["txtFlowStepID"]);

        try
        {
            if (db.ExecuteNonQuery(sb.BuildCommand()) >= 0)
            {
                //[更新]資料異動Log
                LogHelper.WriteAppDataLog(FlowExpress._FlowSysDB, "FlowStep", string.Format("{0},{1}", oDic["txtFlowID"], oDic["txtFlowStepID"]), LogHelper.AppDataLogType.Update, oDic);
                Util.NotifyMsg(RS.Resources.Msg_EditSucceed, Util.NotifyKind.Success);
            }
        }
        catch (Exception ex)
        {
            Util.MsgBox(ex.Message);
        }

        DataTable dt = db.ExecuteDataSet(string.Format("Select * From FlowStep Where FlowID = '{0}' and FlowStepID = '{1}';", _FlowID, _FlowStepID)).Tables[0];

        if (dt != null && dt.Rows.Count > 0)
        {
            fmMain.ChangeMode(FormViewMode.Edit);
            fmMain.DataSource = dt;
            fmMain.DataBind();
        }
        RefreshGridView();
    }
Ejemplo n.º 22
0
    /// <summary>
    /// 「新增」按鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnInsert_Click(object sender, EventArgs e)
    {
        DbHelper      db = new DbHelper(_DBName);
        CommandHelper sb = db.CreateCommandHelper();
        //取得 FormView 編輯控制項的編輯結果
        Dictionary <string, string> oEditResult = Util.getControlEditResult(fmMain);

        sb.Reset();
        sb.AppendStatement("Insert ").Append(_TableName);
        sb.Append("( ");
        sb.Append("  MsgID,MsgKind,IsEnabled,MsgBody,MsgUrl,Remark");
        sb.Append(" ,StartDateTime,EndDateTime");
        sb.Append(" ,UpdUser,UpdDateTime");
        sb.Append(" ) Values (");
        sb.Append("   ").AppendParameter("MsgID", oEditResult["MsgID"]);
        sb.Append("  ,").AppendParameter("MsgKind", oEditResult["MsgKind"]);
        sb.Append("  ,").AppendParameter("IsEnabled", oEditResult["IsEnabled"]);
        sb.Append("  ,").AppendParameter("MsgBody", oEditResult["MsgBody"]);
        sb.Append("  ,").AppendParameter("MsgUrl", oEditResult["MsgUrl"]);
        sb.Append("  ,").AppendParameter("Remark", oEditResult["Remark"]);
        if (oEditResult["StartDate"].CompareTo(oEditResult["EndDate"]) > 0)
        {
            sb.Append("  ,").AppendParameter("StartDateTime", oEditResult["EndDate"] + " " + oEditResult["EndTime"]);
            sb.Append("  ,").AppendParameter("EndDateTime", oEditResult["StartDate"] + " " + oEditResult["StartTime"]);
        }
        else
        {
            sb.Append("  ,").AppendParameter("StartDateTime", oEditResult["StartDate"] + " " + oEditResult["StartTime"]);
            sb.Append("  ,").AppendParameter("EndDateTime", oEditResult["EndDate"] + " " + oEditResult["EndTime"]);
        }

        sb.Append("  ,").AppendParameter("UpdUser", UserInfo.getUserInfo().UserID);
        sb.Append("  ,").AppendDbDateTime();
        sb.Append("  )");

        try
        {
            if (db.ExecuteNonQuery(sb.BuildCommand()) >= 0)
            {
                Util.NotifyMsg(RS.Resources.Msg_AddSucceed, Util.NotifyKind.Success); //新增成功
                divMainFormView.Visible = false;
                divMainGridview.Visible = true;
                ucGridView1.Refresh(true);
            }
            else
            {
                Util.NotifyMsg(RS.Resources.Msg_AddFail, Util.NotifyKind.Error); //新增失敗
            }
        }
        catch (Exception ex)
        {
            Util.MsgBox(ex.Message);
        }
    }
Ejemplo n.º 23
0
    //Judy在Aattendant撈取StartDate會有問題改成EndDate 去掉CompID
    public DataTable QueryData(string strColumn, string strTable, string strWhere) //查詢datatable
    {
        DbHelper      db = new DbHelper(Aattendant._AattendantDBName);
        CommandHelper sb = db.CreateCommandHelper();

        sb.Append("SELECT " + strColumn + " FROM " + strTable);
        sb.Append(" WHERE 1=1 ");
        sb.Append(strWhere);
        DataTable dt = db.ExecuteDataSet(sb.BuildCommand()).Tables[0];

        return(dt);
    }
Ejemplo n.º 24
0
    protected void btnVerify_Click(object sender, EventArgs e)
    {
        Button oBtn = (Button)sender;

        //檢查流程意見是否為必需輸入
        if (string.IsNullOrEmpty(txtFlowOpinion.ucTextData))
        {
            if (oBtn.CommandArgument.ToUpper() == "Y")
            {
                //必需輸入
                Util.NotifyMsg(WorkRS.Resources.FlowVerifyMsg_OpinionRequired, Util.NotifyKind.Error);
                return;
            }
            else
            {
                //非必需輸入,填入預設意見
                txtFlowOpinion.ucTextData = WorkRS.Resources.FlowDefOpinion;
            }
        }

        //將意見暫存,方便審核畫面引用 2017.04.28
        FlowExpress   oFlow = new FlowExpress();
        DbHelper      dblog = new DbHelper(oFlow.FlowLogDB);
        CommandHelper sb    = dblog.CreateCommandHelper();

        sb.Reset();
        sb.AppendStatement(string.Format("Update {0}FlowOpenLog Set ", oFlow.FlowID));
        sb.Append("  FlowStepOpinion = ").AppendParameter("FlowStepOpinion", txtFlowOpinion.ucTextData.Replace(",", "''"));
        sb.Append("  Where FlowLogID = ").AppendParameter("FlowLogID", oFlow.FlowLogID);

        if (dblog.ExecuteNonQuery(sb.BuildCommand()) <= 0)
        {
            Util.NotifyMsg(string.Format(RS.Resources.Msg_Error1, WorkRS.Resources.FlowVerifyTab_SaveFlowTempOpinion), Util.NotifyKind.Error);
            return;
        }

        Dictionary <string, string> dicPara = Util.getRequestQueryString();

        if (dicPara.IsNullOrEmpty())
        {
            //缺少流程參數
            Util.NotifyMsg(WorkRS.Resources.FlowFullLogMsg_FlowParaError, Util.NotifyKind.Error);
            return;
        }
        else
        {
            ucModalPopup1.Reset();
            ucModalPopup1.ucFrameURL    = string.Format("{0}?FlowID={1}&FlowLogID={2}&FlowStepBtnID={3}", FlowExpress._FlowPageVerifyFrameURL, dicPara["FlowID"], dicPara["FlowLogID"], oBtn.CommandName); //FlowExpress._FlowPageVerifyFrameURL + "?Dummy=" + Util.getRandomCode();
            ucModalPopup1.ucPopupWidth  = 680;
            ucModalPopup1.ucPopupHeight = 580;
            ucModalPopup1.Show();
        }
    }
Ejemplo n.º 25
0
    /// <summary>
    /// 當收件人Mail是空的,通知預設的HR人員
    /// </summary>
    /// <param name="Subject">主旨</param>
    /// <param name="Content">內容</param>
    /// <param name="CompID">收件人公司</param>
    /// <param name="EmpID">收件人員編</param>
    /// <returns>是否成功</returns>
    private bool MailisNull(string Subject, string Content, string CompID, string EmpID)
    {
        DbHelper      db = new DbHelper(Aattendant._AattendantDBName);
        CommandHelper sb = db.CreateCommandHelper();
        DataTable     dt;
        string        Title = "";
        string        Mail  = "";

        Subject = "FW:" + Subject;

        sb.Append("select P.CompID,P.EmpID,P.Name,C.EMail ");
        sb.Append(" from " + _HRDB + ".[dbo].SC_UserGroup UG ");
        sb.Append("left join " + _eHRMSDB + ".[dbo].Personal P on P.EmpID=UG.UserID and P.CompID=UG.CompID ");
        sb.Append("left join " + _eHRMSDB + ".[dbo].Communication C on C.IDNo=P.IDNo ");
        sb.Append("where UG.CompID='SPHBK1' and UG.GroupID='ADM-OT'");
        dt = db.ExecuteDataSet(sb.BuildCommand()).Tables[0];
        if (dt.Rows.Count == 0)
        {
            return(true);
        }
        sb.Reset();
        DataRow[] dr = dt.Select();
        Title   = EmpID + "-" + getMailInfo(CompID, EmpID).Rows[0]["Name"].ToString();
        Content = "||BM@QuitMailContent99||" + Content;
        foreach (DataRow row in dt.Rows)
        {
            Mail = row["EMail"].ToString();
            InsertMailLogCommand("人力資源處", row["CompID"].ToString(), row["EmpID"].ToString(), Mail, Subject, Content, false, ref sb);
        }
        try
        {
            db.ExecuteNonQuery(sb.BuildCommand());
        }
        catch (Exception ex)
        {
            Util.MsgBox("人力資源處E-Mail寄送失敗-" + ex);
            return(false);
        }
        return(true);
    }
Ejemplo n.º 26
0
    protected void btnMainInsert_Click(object sender, EventArgs e)
    {
        //取得表單輸入資料
        Dictionary <string, string> oDic = Util.getControlEditResult(fmMain);
        DbHelper      db = new DbHelper(_DBName);
        CommandHelper sb = db.CreateCommandHelper();

        sb.Reset();
        sb.AppendStatement("Insert AclRule ");
        sb.Append("( ");
        sb.Append("  RuleID,RuleName,IsEnabled,Remark,UpdUser,UpdDateTime");
        sb.Append(" ) Values (");
        sb.Append("   ").AppendParameter("RuleID", oDic["RuleID"]);
        sb.Append("  ,").AppendParameter("RuleName", oDic["RuleName"]);
        sb.Append("  ,").AppendParameter("IsEnabled", oDic["IsEnabled"]);
        sb.Append("  ,").AppendParameter("Remark", oDic["Remark"]);
        sb.Append("  ,").AppendParameter("UpdUser", UserInfo.getUserInfo().UserID);
        sb.Append("  ,").AppendDbDateTime();
        sb.Append("  )");

        if (_IsADD && _RuleID != oDic["RuleID"])
        {
            //Copy Detail
            sb.AppendStatement(Util.getDataCopySQL(AclExpress._AclDBName, _Main_KeyList, _RuleID.Split(','), oDic["RuleID"].Split(','), "AclRuleExp".Split(',')));
        }

        try
        {
            if (db.ExecuteNonQuery(sb.BuildCommand()) >= 0)
            {
                _IsADD  = false;
                _RuleID = oDic["RuleID"];

                Dictionary <string, string> dicKey = new Dictionary <string, string>();
                dicKey.Clear();
                dicKey.Add("RuleID", _RuleID);
                AclExpress.IsAclTableLog("AclRule", dicKey, LogHelper.AppTableLogType.Create);
                AclExpress.IsAclTableLog("AclRuleExp", dicKey, LogHelper.AppTableLogType.Create);

                Util.NotifyMsg(string.Format("[{0}]新增成功,可進行後續編修。", oDic["RuleID"]), Util.NotifyKind.Success);
                Refresh(true, true);
            }
            else
            {
                Util.NotifyMsg("新增失敗", Util.NotifyKind.Error);
            }
        }
        catch
        {
            Util.NotifyMsg("新增錯誤,請檢查資料是否重複", Util.NotifyKind.Error);
        }
    }
Ejemplo n.º 27
0
    /// <summary>
    /// 確認新增明細
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnDetailInsert_Click(object sender, EventArgs e)
    {
        Dictionary <string, string> oDic = Util.getControlEditResult(fmDetail);

        if (!string.IsNullOrEmpty(_RuleID))
        {
            DbHelper      db = new DbHelper(_DBName);
            CommandHelper sb = db.CreateCommandHelper();
            sb.Reset();
            //新增明細
            sb.AppendStatement("Insert AclRuleExp ");
            sb.Append("(RuleID,ChkGrpNo,ChkSeqNo,IsEnabled,ChkOrgUserObjectProperty,ChkOrgUserSW,ChkOrgUserExp,ChkOrgUserPropertyValue,ChkCodeMapSW,ChkCodeMapFldName,Remark,UpdUser,UpdDateTime) ");
            sb.Append(" Values (").AppendParameter("RuleID", _RuleID);
            sb.Append("        ,").AppendParameter("ChkGrpNo", oDic["ChkGrpNo"]);
            sb.Append("        ,").AppendParameter("ChkSeqNo", oDic["ChkSeqNo"]);
            sb.Append("        ,").AppendParameter("IsEnabled", oDic["IsEnabled"]);
            sb.Append("        ,").AppendParameter("ChkOrgUserObjectProperty", oDic["ChkOrgUserObjectProperty"]);

            sb.Append("        ,").AppendParameter("ChkOrgUserSW", oDic["ChkOrgUserSW"]);
            sb.Append("        ,").AppendParameter("ChkOrgUserExp", oDic["ChkOrgUserExp"]);
            sb.Append("        ,").AppendParameter("ChkOrgUserPropertyValue", oDic["ChkOrgUserPropertyValue"]);
            sb.Append("        ,").AppendParameter("ChkCodeMapSW", oDic["ChkCodeMapSW"]);
            sb.Append("        ,").AppendParameter("ChkCodeMapFldName", oDic["ChkCodeMapFldName"]);

            sb.Append("        ,").AppendParameter("Remark", oDic["Remark"]);
            sb.Append("        ,").AppendParameter("UpdUser", UserInfo.getUserInfo().UserID);
            sb.Append("        ,").AppendDbDateTime();
            sb.Append(")");

            try
            {
                db.ExecuteNonQuery(sb.BuildCommand());
                _ChkGrpNo = int.Parse(oDic["ChkGrpNo"]);
                _ChkSeqNo = int.Parse(oDic["ChkSeqNo"]);

                Dictionary <string, string> dicKey = new Dictionary <string, string>();
                dicKey.Clear();
                dicKey.Add("RuleID", _RuleID);
                dicKey.Add("ChkGrpNo", _ChkGrpNo.ToString());
                dicKey.Add("ChkSeqNo", _ChkSeqNo.ToString());
                AclExpress.IsAclTableLog("AclRuleExp", dicKey, LogHelper.AppTableLogType.Create);

                Util.NotifyMsg("條件新增成功", Util.NotifyKind.Success);
            }
            catch
            {
                Util.NotifyMsg("條件新增失敗", Util.NotifyKind.Error);
            }

            Refresh(false, true);
        }
    }
Ejemplo n.º 28
0
    /// <summary>
    /// 確定更新
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        string strDocNo     = ((TextBox)Util.FindControlEx(fmMain, "txtDocNo")).Text;
        string strIsRelease = ((CheckBox)Util.FindControlEx(fmMain, "chkIsRelease")).Checked ? "Y" : "N";
        string strSubject   = ((Util_ucTextBox)Util.FindControlEx(fmMain, "ucSubject")).ucTextData;
        string strUsage     = ((Util_ucTextBox)Util.FindControlEx(fmMain, "ucUsage")).ucTextData;
        string strKeyword   = ((Util_ucCheckBoxList)Util.FindControlEx(fmMain, "ucKeyword")).ucSelectedIDList;
        string strRemark    = ((Util_ucTextBox)Util.FindControlEx(fmMain, "ucRemark")).ucTextData;
        Util_ucCascadingDropDown oCascading = (Util_ucCascadingDropDown)Util.FindControlEx(fmMain, "ucCascadingKind");


        DbHelper      db = new DbHelper(LegalSample._LegalSysDBName);
        CommandHelper sb = db.CreateCommandHelper();

        sb.Reset();
        sb.AppendStatement(string.Format("Update {0} Set ", LegalSample._LegalDocTableName));
        sb.Append("  IsRelease   = ").AppendParameter("IsRelease", strIsRelease);
        sb.Append(", Subject     = ").AppendParameter("Subject", strSubject);
        sb.Append(", Kind1       = ").AppendParameter("Kind1", oCascading.ucSelectedValue01);
        sb.Append(", Kind2       = ").AppendParameter("Kind2", oCascading.ucSelectedValue02);
        sb.Append(", Kind3       = ").AppendParameter("Kind3", oCascading.ucSelectedValue03);
        sb.Append(", Usage       = ").AppendParameter("Usage", strUsage);
        sb.Append(", Keyword     = ").AppendParameter("Keyword", strKeyword);
        sb.Append(", Remark      = ").AppendParameter("Remark", strRemark);

        UserInfo oUser = UserInfo.getUserInfo();

        sb.Append(", UpdUser = "******"User", oUser.UserID);
        sb.Append(", UpdUserName = "******"UserName", oUser.UserName);
        sb.Append(", UpdDateTime  = ").AppendDbDateTime();
        sb.Append("  Where DocNo = ").AppendParameter("DocNo", strDocNo);

        try
        {
            if (db.ExecuteNonQuery(sb.BuildCommand()) >= 0)
            {
                Util.NotifyMsg(RS.Resources.Msg_EditSucceed, Util.NotifyKind.Success); //資料更新成功
                fmMain.DataSource = null;
                fmMain.DataBind();
                divMainFormView.Visible = false;
                divMainGridview.Visible = true;
                ucGridView1.Refresh(true);
            }
        }
        catch (Exception ex)
        {
            //將 Exception 丟給 Log 模組
            LogHelper.WriteSysLog(ex);
            //資料更新失敗
            Util.NotifyMsg(RS.Resources.Msg_EditFail, Util.NotifyKind.Error);
        }
    }
Ejemplo n.º 29
0
    private void ClearBtn(string FlowCaseID)
    {
        DbHelper      db = new DbHelper(Aattendant._AattendantDBName);
        CommandHelper sb = db.CreateCommandHelper();

        sb.Append(" update " + FlowCustDB + "FlowOpenLog ");
        sb.Append(" set FlowStepBatchEnabled=null ");
        sb.Append(" ,FlowStepOpinion=null ");
        sb.Append(" ,FlowStepBtnInfoCultureCode=null ");
        sb.Append(" ,FlowStepBtnInfoJSON=null ");
        sb.Append(" where FlowCaseID='" + FlowCaseID + "' ");
        db.ExecuteNonQuery(sb.BuildCommand());
    }
Ejemplo n.º 30
0
    /// <summary>
    /// 刪除附件
    /// </summary>
    /// <param name="AttachID"></param>
    /// <returns></returns>
    public bool DeleteAttach(string AttachID)
    {
        bool isSuccess = false;

        try
        {
            DbHelper      db     = new DbHelper(_overtimeDBName);
            CommandHelper strSQL = db.CreateCommandHelper();
            DbConnection  cn     = db.OpenConnection();
            DbTransaction tx     = cn.BeginTransaction();

            strSQL.Reset();
            strSQL.AppendStatement(" UPDATE AttachInfo SET FileSize = -1,  FileBody = null WHERE AttachID = '" + AttachID + "'");

            using (DataTable dtSchedule = db.ExecuteDataSet(strSQL.BuildCommand()).Tables[0])
            {
                db.ExecuteNonQuery(strSQL.BuildCommand(), tx);
                tx.Commit();

                try
                {
                    Util.IsAttachInfoLog("AattendantDB", AttachID, 1, "Delete");
                    isSuccess = true;
                }
                catch (Exception es)
                {
                    Debug.Print(">>>IsAttachInfoLog: " + es.Message);
                    LogHelper.WriteSysLog(es.Message); //將 Exception 丟給 Log 模組
                }
            }
        }
        catch (Exception ex)
        {
            Debug.Print(">>>DeleteAttach: " + ex.Message);
            LogHelper.WriteSysLog(ex); //將 Exception 丟給 Log 模組
        }

        return(isSuccess);
    }