コード例 #1
0
ファイル: Common.svc.cs プロジェクト: paraneye/WebService
        //public SigmaResultType AddMessageBox(TypeMessageBox objMessageBox)
        //{
        //    SigmaResultType result = new SigmaResultType();
        //    try
        //    {
        //        MessageBoxMgr messageBoxMgr = new MessageBoxMgr();
        //        result = messageBoxMgr.AddMessageBox(objMessageBox);
        //        return result;
        //    }
        //    catch (Exception ex)
        //    {
        //        // Log Exception
        //        ExceptionHelper.logException(ex);
        //        result.IsSuccessful = false;
        //        result.ErrorMessage = ex.Message;
        //        return result;
        //    }
        //}
        //public SigmaResultType UpdateMessageBox(TypeMessageBox objMessageBox)
        //{
        //    SigmaResultType result = new SigmaResultType();
        //    try
        //    {
        //        result.IsSuccessful = true;
        //        MessageBoxMgr messageBoxMgr = new MessageBoxMgr();
        //        result = messageBoxMgr.UpdateMessageBox(objMessageBox);
        //        return result;
        //    }
        //    catch (Exception ex)
        //    {
        //        // Log Exception
        //        ExceptionHelper.logException(ex);
        //        result.IsSuccessful = false;
        //        result.ErrorMessage = ex.Message;
        //        return result;
        //    }
        //}
        public SigmaResultType RemoveMessageBox(TypeMessageBox objMessageBox)
        {
            SigmaResultType result = new SigmaResultType();

            try
            {
                MessageBoxMgr messageBoxMgr = new MessageBoxMgr();
                result = messageBoxMgr.RemoveMessageBox(objMessageBox);
                return result;
            }
            catch (Exception ex)
            {
                // Log Exception
                ExceptionHelper.logException(ex);
                result.IsSuccessful = false;
                result.ErrorMessage = ex.Message;
                return result;
            }
        }
コード例 #2
0
ファイル: MessageBoxMgr.cs プロジェクト: paraneye/WebService
        //public SigmaResultType ListMessageBox(NameValueCollection queryParams)
        //{
        //    SigmaResultType result = new SigmaResultType();
        //    // Get connection string
        //    string connStr = ConnStrHelper.getDbConnString();
        //    // Compose parameters
        //    List<SqlParameter> paramList = new List<SqlParameter>();
        //    string max = queryParams["max"];
        //    string offset = queryParams["offset"];
        //    string o_option = queryParams["o_option"];
        //    string o_desc = queryParams["o_desc"];
        //    paramList.Add(new SqlParameter("@MaxNumRows", (max == null ? 1000 : int.Parse(max))));
        //    paramList.Add(new SqlParameter("@RetrieveOffset", (offset == null ? 0 : int.Parse(offset))));
        //    paramList.Add(new SqlParameter("@SortColumn", o_option));
        //    paramList.Add(new SqlParameter("@SortOrder", (o_desc != null ? o_desc.ToUpper() : null)));
        //    // Get Data
        //    DataSet ds = SqlHelper.ExecuteDataset(connStr, "usp_ListMessageBox", paramList.ToArray());
        //    // Convert to REST/JSON String
        //    result.JsonDataSet = JsonHelper.convertDataTableToJson(ds.Tables[0]);
        //    result.AffectedRow = (int)ds.Tables[1].Rows[0][0]; // returning count
        //    result.ScalarValue = (int)ds.Tables[2].Rows[0][0]; // total count by search
        //    result.IsSuccessful = true;
        //    // return
        //    return result;
        //}
        //public SigmaResultType AddMessageBox(TypeMessageBox objMessageBox)
        //{
        //    TransactionScope scope = null;
        //    SigmaResultType result = new SigmaResultType();
        //    // Get connection string
        //    string connStr = ConnStrHelper.getDbConnString();
        //    List<SqlParameter> paramList = new List<SqlParameter>();
        //    paramList.Add(new SqlParameter("@MsgTitle", objMessageBox.MsgTitle));
        //    paramList.Add(new SqlParameter("@MsgTo", objMessageBox.MsgTo));
        //    paramList.Add(new SqlParameter("@IsRead", objMessageBox.IsRead));
        //    paramList.Add(new SqlParameter("@IsDelete", objMessageBox.IsDelete));
        //    paramList.Add(new SqlParameter("@CreatedBy", objMessageBox.CreatedBy));
        //    paramList.Add(new SqlParameter("@ContextSeq", objMessageBox.ContextSeq));
        //    SqlParameter outParam = new SqlParameter("@NewId", SqlDbType.Int);
        //    outParam.Direction = ParameterDirection.Output;
        //    paramList.Add(outParam);
        //    using (scope = new TransactionScope(TransactionScopeOption.Required))
        //    {
        //        result.AffectedRow = SqlHelper.ExecuteNonQuery(connStr, CommandType.StoredProcedure, "usp_AddMessageBox", paramList.ToArray());
        //        result.IsSuccessful = true;
        //        result.ScalarValue = (int)outParam.Value;
        //        scope.Complete();
        //    }
        //    return result;
        //}
        //public SigmaResultType UpdateMessageBox(TypeMessageBox objMessageBox)
        //{
        //    TransactionScope scope = null;
        //    SigmaResultType result = new SigmaResultType();
        //    // Get connection string
        //    string connStr = ConnStrHelper.getDbConnString();
        //    List<SqlParameter> paramList = new List<SqlParameter>();
        //    paramList.Add(new SqlParameter("@MsgTypeCode", objMessageBox.MsgTypeCode));
        //    paramList.Add(new SqlParameter("@MsgSeq", objMessageBox.MsgSeq));
        //    paramList.Add(new SqlParameter("@MsgTitle", objMessageBox.MsgTitle));
        //    paramList.Add(new SqlParameter("@MsgTo", objMessageBox.MsgTo));
        //    paramList.Add(new SqlParameter("@IsRead", objMessageBox.IsRead));
        //    paramList.Add(new SqlParameter("@IsDelete", objMessageBox.IsDelete));
        //    paramList.Add(new SqlParameter("@ContextSeq", objMessageBox.ContextSeq));
        //    using (scope = new TransactionScope(TransactionScopeOption.Required))
        //    {
        //        result.AffectedRow = SqlHelper.ExecuteNonQuery(connStr, "usp_UpdateMessageBox", paramList.ToArray());
        //        result.IsSuccessful = true;
        //        scope.Complete();
        //    }
        //    return result;
        //}
        //public SigmaResultType UpdateMessageBox(TypeMessageBox objMessageBox)
        //{
        //    TransactionScope scope = null;
        //    SigmaResultType result = new SigmaResultType();
        //    // Get connection string
        //    string connStr = ConnStrHelper.getDbConnString();
        //    List<SqlParameter> paramList = new List<SqlParameter>();
        //    paramList.Add(new SqlParameter("@MsgTypeCode", objMessageBox.MsgTypeCode));
        //    paramList.Add(new SqlParameter("@MsgSeq", objMessageBox.MsgSeq));
        //    paramList.Add(new SqlParameter("@MsgTitle", objMessageBox.MsgTitle));
        //    paramList.Add(new SqlParameter("@MsgTo", objMessageBox.MsgTo));
        //    paramList.Add(new SqlParameter("@IsRead", objMessageBox.IsRead));
        //    paramList.Add(new SqlParameter("@IsDelete", objMessageBox.IsDelete));
        //    paramList.Add(new SqlParameter("@ContextSeq", objMessageBox.ContextSeq));
        //    using (scope = new TransactionScope(TransactionScopeOption.Required))
        //    {
        //        result.AffectedRow = SqlHelper.ExecuteNonQuery(connStr, "usp_UpdateMessageBox", paramList.ToArray());
        //        result.IsSuccessful = true;
        //        scope.Complete();
        //    }
        //    return result;
        //}
        public SigmaResultType RemoveMessageBox(TypeMessageBox objMessageBox)
        {
            TypeUserInfo userinfo = AuthMgr.GetUserInfo();

            SigmaResultType result = new SigmaResultType();
            TransactionScope scope = null;

            // Get connection string
            string connStr = ConnStrHelper.getDbConnString();

            // Compose parameters
            List<SqlParameter> paramList = new List<SqlParameter>();

            paramList.Add(new SqlParameter("@MsgTypeCode", objMessageBox.MsgTypeCode.Trim()));
            paramList.Add(new SqlParameter("@MsgSeq", Utilities.ToInt32(objMessageBox.MsgSeq.ToString().Trim())));
            paramList.Add(new SqlParameter("@UpdatedBy", userinfo.SigmaUserId.Trim()));

            using (scope = new TransactionScope(TransactionScopeOption.Required))
            {
                result.AffectedRow = SqlHelper.ExecuteNonQuery(connStr, "usp_RemoveMessageBox", paramList.ToArray());
                result.IsSuccessful = true;
                scope.Complete();
            }

            return result;
        }