Exemple #1
0
        private void LoadRemarkTypes()
        {
            using (var conn = new SqlConnection(DAL.ConnectionString))
            {
                conn.Open();

                var parameter = new SqlParameter("@ContextID", ContextId);
                var command   = new SqlCommand("spCPCmmGetRemarkTypes", conn);

                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(parameter);

                var reader = command.ExecuteReader();
                RemarkTypes = new OrderedDictionary();

                while (reader.Read())
                {
                    var remarkToAdd = new RemarkType
                    {
                        Context   = this,
                        TypeId    = (string)reader["TypeID"],
                        Caption   = (string)reader["Caption"],
                        ShowPopup = (short)reader["Priority"] == 1
                    };

                    RemarkTypes.Add(remarkToAdd.TypeId, remarkToAdd);
                }
            }
        }
Exemple #2
0
 public void Initialize(RemarkType remarkType, int memoKey, DateTime dateStamp, string memoText, bool isDirty)
 {
     RemarkType = remarkType;
     MemoKey    = memoKey;
     DateStamp  = dateStamp;
     MemoText   = memoText;
     IsDirty    = isDirty;
 }
Exemple #3
0
        public void AddRemark(object remarkIndex, string remarkText, string userId)
        {
            RemarkType remarkType = null;

            if (remarkIndex is int)
            {
                var index = Convert.ToInt32(remarkIndex);
                remarkType = (RemarkType)RemarkTypes[index];
            }

            if (remarkIndex is string)
            {
                var index = remarkIndex.ToString();
                remarkType = (RemarkType)RemarkTypes[index];
            }

            if (remarkType == null)
            {
                throw new Exception("Illegal remark type for this context");
            }

            if (Remarks == null)
            {
                Remarks = new List <Remark>();
            }

            var remark = new Remark();

            remark.RemarkType = remarkType;
            remark.MemoText   = remarkText;
            remark.UserId     = userId;
            remark.DateStamp  = DateTime.Now;
            remark.IsDirty    = true;

            Remarks.Add(remark);
        }