当前位置: 首页>>代码示例>>C#>>正文


C# Common.Message类代码示例

本文整理汇总了C#中CRM.Library.Common.Message的典型用法代码示例。如果您正苦于以下问题:C# Message类的具体用法?C# Message怎么用?C# Message使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Message类属于CRM.Library.Common命名空间,在下文中一共展示了Message类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AssignQuestion

        /// <summary>
        /// Assign Question
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        public Message AssignQuestion(List<LOT_ExamQuestion_Section_ListeningTopic> list)
        {
            Message msg = null;
            try
            {
                if (list.Count > 0)
                {
                    int totalID = list.Count;
                    dbContext.LOT_ExamQuestion_Section_ListeningTopics.InsertAllOnSubmit(list);
                    dbContext.SubmitChanges();
                    // Show succes message
                    msg = new Message(MessageConstants.I0001, MessageType.Info, totalID.ToString() + " Question(s)", "assigned");
                }
                else
                {
                    // Show system error
                    msg = new Message(MessageConstants.E0033, MessageType.Error, "Please select listening question(s) to assign!");
                }
            }
            catch (Exception)
            {

                // Show system error
                msg = new Message(MessageConstants.E0007, MessageType.Error);
            }
            return msg;
        }
开发者ID:vuchannguyen,项目名称:lg-py,代码行数:32,代码来源:ExamQuestionSectionListeningTopicDao.cs

示例2: Insert

        public Message Insert(LOT_Candidate_Exam_Result objUI)
        {
            Message msg = null;
            try
            {
                if (!IsDublicateCandidateMark(objUI))
                {
                    objUI.CreateDate = System.DateTime.Now;
                    objUI.UpdateDate = System.DateTime.Now;
                    dbContext.LOT_Candidate_Exam_Results.InsertOnSubmit(objUI);
                    dbContext.SubmitChanges();

                    msg = new Message(MessageConstants.I0001, MessageType.Info, new CandidateExamDao().GetCandidateName(objUI.LOT_Candidate_Exam) + "'s " + objUI.LOT_Section.SectionName + " mark in " + objUI.LOT_Candidate_Exam.LOT_Exam.Title + " exam", "added");
                }
                else
                {
                    msg = new Message(MessageConstants.E0020, MessageType.Error, new CandidateExamDao().GetCandidateName(objUI.LOT_Candidate_Exam) + "'s " + objUI.LOT_Section.SectionName + " mark", objUI.LOT_Candidate_Exam.LOT_Exam.Title + " exam");
                }
            }
            catch (Exception)
            {
                msg = new Message(MessageConstants.E0007, MessageType.Error);
            }
            return msg;
        }
开发者ID:vuchannguyen,项目名称:lg-py,代码行数:25,代码来源:CandidateExamResultDao.cs

示例3: Delete

 public Message Delete(string[] idArr)
 {
     Message msg = null;
     DbTransaction trans = null;
     try
     {
         dbContext.Connection.Open();
         trans = dbContext.Connection.BeginTransaction();
         dbContext.Transaction = trans;
         foreach (string id in idArr)
             Delete(ConvertUtil.ConvertToInt(id));
         if (idArr.Length > 1)
             msg = new Message(MessageConstants.I0011, MessageType.Info,
                 idArr.Length + " materials have been deleted");
         else
             msg = new Message(MessageConstants.I0011, MessageType.Info,
                 idArr.Length + " material has been deleted");
         trans.Commit();
     }
     catch
     {
         trans.Rollback();
         msg = new Message(MessageConstants.E0007, MessageType.Error);
     }
     return msg;
 }
开发者ID:vuchannguyen,项目名称:lg-py,代码行数:26,代码来源:TrainingMaterialDao.cs

示例4: Delete

 public Message Delete(int menuID)
 {
     Message msg = null;
     //DbTransaction trans = null;
     try
     {
         //dbContext.Connection.Open();
         //trans = dbContext.Connection.BeginTransaction();
         //dbContext.Transaction = trans;
         Menu menu = GetByID(menuID, null);
         if (menu == null)
             msg = new Message(MessageConstants.E0005, MessageType.Error, "Selected menu", "database");
         else
         {
             List<Menu> childList = GetChild(menuID);
             foreach (var child in childList)
                 child.ParentId = null;
             menu.DeleteFlag = true;
             msg = new Message(MessageConstants.I0001, MessageType.Info, "Menu \"" + menu.Name + "\" ", "deleted");
             dbContext.SubmitChanges();
         }
     }
     catch
     {
         msg = new Message(MessageConstants.E0007, MessageType.Error);
     }
     return msg;
 }
开发者ID:vuchannguyen,项目名称:lg-py,代码行数:28,代码来源:MenuDao.cs

示例5: Delete

        public Message Delete(int userAdminID)
        {
            DbTransaction transaction = null;
            Message msg = null;
            try
            {
                dbContext.Connection.Open();
                transaction = dbContext.Connection.BeginTransaction();
                dbContext.Transaction = transaction;
                List<UserConfig> userConfigs = GetListUserConfig(userAdminID);
                if (userConfigs != null)
                {
                    dbContext.UserConfigs.DeleteAllOnSubmit(userConfigs);
                    dbContext.SubmitChanges();
                }

                transaction.Commit();
                msg = new Message(MessageConstants.I0001, MessageType.Info, "", "updated");
            }
            catch (Exception exception)
            {
                if (transaction != null) transaction.Rollback();
                msg = new Message(MessageConstants.E0007, MessageType.Error);
            }
            return msg;
        }
开发者ID:vuchannguyen,项目名称:lg-py,代码行数:26,代码来源:UserConfigDao.cs

示例6: ApproveAttendee

        public Message ApproveAttendee(Training_Attendee objUI)
        {
            Message msg = null;

            try
            {
                if (objUI != null)
                {
                    // Get current group in dbContext
                    Training_Attendee objDb = GetAttendeeByClassId(objUI.ClassId);

                    if (objDb != null)
                    {
                            // Update info by objUI
                            objDb.StatusId = Constants.TRAINING_REGISTRATION_STATUS_APPROVED;
                            objDb.UpdateDate = DateTime.Now;
                            objDb.UpdatedBy = objUI.UpdatedBy;

                            // Submit changes to dbContext
                            dbContext.SubmitChanges();

                            // Show success message
                            msg = new Message(MessageConstants.I0001, MessageType.Info, "Attendee '" + objDb.ClassId + "'", "approved");
                    }
                }
            }
            catch
            {
                // Show system error
                msg = new Message(MessageConstants.E0007, MessageType.Error);
            }

            return msg;
        }
开发者ID:vuchannguyen,项目名称:lg-py,代码行数:34,代码来源:TrainingAttendeeDao.cs

示例7: EngClassRegister

        public Message EngClassRegister(Training_Attendee objUI)
        {
            Message msg = null;
            try
            {
                if (!isDublicateEmpId(objUI))
                {
                    objUI.CreateDate = DateTime.Now;
                    objUI.UpdateDate = DateTime.Now;
                    objUI.DeleteFlag = false;
                    objUI.StatusId = Constants.TRAINING_REGISTRATION_STATUS_NEW;
                    objUI.SubmittingDate = DateTime.Now;
                    dbContext.Training_Attendees.InsertOnSubmit(objUI);
                    dbContext.SubmitChanges();
                    // Show success message
                    msg = new Message(MessageConstants.I0001, MessageType.Info, "Registration for this class ", "added");
                }
                else
                {
                    msg = new Message(MessageConstants.E0020, MessageType.Error, "Your name is ", "in this class");
                }

            }
            catch (Exception ex)
            {
                msg = new Message(MessageConstants.E0007, MessageType.Error);
                throw ex;
            }
            return msg;
        }
开发者ID:vuchannguyen,项目名称:lg-py,代码行数:30,代码来源:TrainingCenterDao.cs

示例8: AssignPermission

        public Message AssignPermission(int groupId, List<GroupPermission> groupList)
        {
            Message msg = null;
            DbTransaction trans = null;
            try
            {
                dbContext.Connection.Open();
                trans = dbContext.Connection.BeginTransaction();
                dbContext.Transaction = trans;

                List<GroupPermission> deleteGroup = dbContext.GroupPermissions.Where(c => c.GroupId == groupId)
                    .ToList<GroupPermission>();
                dbContext.GroupPermissions.DeleteAllOnSubmit(deleteGroup);
                dbContext.SubmitChanges();

                foreach (GroupPermission item in groupList)
                {
                    dbContext.GroupPermissions.InsertOnSubmit(item);
                    // Submit changes to dbContext
                    dbContext.SubmitChanges();
                }

                // Show succes message
                msg = new Message(MessageConstants.I0001, MessageType.Info, groupList.Count.ToString() + " permision(s)", "assigned");
                trans.Commit();
            }
            catch (Exception )
            {
                if (trans != null) trans.Rollback();
                // Show system error
                msg = new Message(MessageConstants.E0007, MessageType.Error);
            }

            return msg;
        }
开发者ID:vuchannguyen,项目名称:lg-py,代码行数:35,代码来源:GroupPermissionDao.cs

示例9: DeleteDueDate

        public Message DeleteDueDate(string id)
        {
            Message msg = null;
            DbTransaction transaction = null;
            try
            {
                dbContext.Connection.Open();
                transaction = dbContext.Connection.BeginTransaction();
                dbContext.Transaction = transaction;

                if (!string.IsNullOrEmpty(id))
                {
                    id = id.TrimEnd(',');
                    string[] ids = id.Split(',').Distinct().ToArray();

                    foreach (var s in ids)
                    {
                        var dueDate = GetDueDateById(s);
                        if (dueDate != null)
                        {
                            dbContext.SR_DueDates.DeleteOnSubmit(dueDate);
                            dbContext.SubmitChanges();
                        }
                    }
                    msg = new Message(MessageConstants.I0011, MessageType.Info, "DueDate had been deleted successful");
                    transaction.Commit();
                }
            }
            catch (Exception exception)
            {
                if (transaction != null) transaction.Rollback();
                msg = new Message(MessageConstants.E0007, MessageType.Error);
            }
            return msg;
        }
开发者ID:vuchannguyen,项目名称:lg-py,代码行数:35,代码来源:SRDueDateDao.cs

示例10: DeleteList

        public Message DeleteList(string ids, string stUpdatedBy)
        {
            Message msg = null;
            DbTransaction trans = null;
            bool canDelete = true;
            try
            {
                dbContext.Connection.Open();
                trans = dbContext.Connection.BeginTransaction();
                dbContext.Transaction = trans;

                if (!string.IsNullOrEmpty(ids))
                {
                    ids = ids.TrimEnd(',');
                    int groupID = 0;

                    string[] idArr = ids.Split(',');
                    int total = idArr.Count();
                    foreach (string id in idArr)
                    {
                        bool isValid = Int32.TryParse(id, out groupID);
                        Group group = GetById(groupID);
                        if (group != null)
                        {
                            if (group.User_Groups.Count > 0)
                            {
                                canDelete = false;
                                // Show succes message
                                msg = new Message(MessageConstants.E0006, MessageType.Error, "delete group '" + group.GroupName + "'", "this group");
                                break;
                            }
                            group.UpdatedBy = stUpdatedBy;
                            Delete(group);
                        }
                        else
                        {
                            total--;
                        }
                    }
                    if (canDelete)
                    {
                        // Show succes message
                        msg = new Message(MessageConstants.I0001, MessageType.Info, total.ToString() + " group(s)", "deleted");
                        trans.Commit();
                    }
                    else
                    {
                        trans.Rollback();
                    }
                }
            }
            catch (Exception)
            {
                if (trans != null) trans.Rollback();
                // Show system error
                msg = new Message(MessageConstants.E0007, MessageType.Error);
            }
            return msg;
        }
开发者ID:vuchannguyen,项目名称:lg-py,代码行数:59,代码来源:GroupDao.cs

示例11: DeleteList

        public Message DeleteList(string ids, string userName)
        {
            Message msg = null;
            DbTransaction trans = null;
            try
            {
                dbContext.Connection.Open();
                trans = dbContext.Connection.BeginTransaction();
                dbContext.Transaction = trans;
                bool isFalse = true;
                if (!string.IsNullOrEmpty(ids))
                {
                    ids = ids.TrimEnd(',');
                    string[] idArr = ids.Split(',');
                    int total = idArr.Count();
                    foreach (string id in idArr)
                    {
                        string empID = id;
                        Training_CertificationMaster trainingCer = GetById(empID);
                        Employee_Certification obj = dbContext.Employee_Certifications.Where(q => q.CertificationId.Equals(ConvertUtil.ConvertToInt(empID))).FirstOrDefault();
                        Training_NonEmpCertification non = dbContext.Training_NonEmpCertifications.Where(p => p.TypeId.Equals(ConvertUtil.ConvertToInt(empID))).FirstOrDefault();
                        if (obj == null && non == null)
                        {
                            trainingCer.UpdatedBy = userName;
                            Delete(trainingCer);
                        }
                        else
                        {

                            isFalse = false;
                            break;
                        }
                    }
                    if (isFalse)
                    {
                        // Show succes message
                        msg = new Message(MessageConstants.I0001, MessageType.Info, total.ToString() + " Certification(s)", "deleted");

                    }
                    else
                    {
                        msg = new Message(MessageConstants.E0006, MessageType.Error, "delete  ", "this certification");
                        //msg = new Message(MessageConstants.E0051, MessageType.Error);
                    }
                    trans.Commit();
                }
            }
            catch
            {
                if (trans != null) trans.Rollback();
                // Show system error
                msg = new Message(MessageConstants.E0007, MessageType.Error);
            }
            return msg;
        }
开发者ID:vuchannguyen,项目名称:lg-py,代码行数:55,代码来源:TrainingCertificationDao.cs

示例12: DeleteList

        /// <summary>
        /// Delete a list of job title
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public Message DeleteList(string ids)
        {
            Message msg = null;
            DbTransaction trans = null;
            bool isOK = true;
            try
            {
                //begin transaction
                dbContext.Connection.Open();
                trans = dbContext.Connection.BeginTransaction();
                dbContext.Transaction = trans;

                if (!string.IsNullOrEmpty(ids))
                {
                    //split ids by char ','
                    ids = ids.TrimEnd(':');
                    string[] idArr = ids.Split(':');
                    int totalID = idArr.Count();

                    //loop each id to delete
                    foreach (string sID in idArr)
                    {
                        string[] array = sID.Split(',');
                        int role = int.Parse(array[0]);
                        int resolution = int.Parse(array[1]);
                        bool hold = bool.Parse(array[2]);
                        msg = Delete(resolution, role, hold);
                        if (msg.MsgType == MessageType.Error)
                        {
                            isOK = false;
                            break;
                        }
                    }

                    if (isOK)
                    {
                        // Show succes message
                        msg = new Message(MessageConstants.I0001, MessageType.Info, totalID.ToString() + "  role-resolution(s)", "deleted");
                        trans.Commit();
                    }
                    else
                    {
                        trans.Rollback();
                    }
                }
            }
            catch
            {
                if (trans != null) { trans.Rollback(); }
                // Show system error
                msg = new Message(MessageConstants.E0006, MessageType.Error, "delete", "it");
            }
            return msg;
        }
开发者ID:vuchannguyen,项目名称:lg-py,代码行数:59,代码来源:ManageWorkFlowDao.cs

示例13: DeleteList

        public Message DeleteList(string ids, string stUpdatedBy)
        {
            Message msg = null;
            DbTransaction trans = null;
            bool canDelete = true;
            try
            {
                dbContext.Connection.Open();
                trans = dbContext.Connection.BeginTransaction();
                dbContext.Transaction = trans;

                if (!string.IsNullOrEmpty(ids))
                {
                    ids = ids.TrimEnd(',');
                    string[] idArr = ids.Split(',');
                    int totalId = idArr.Count();
                    foreach (string id in idArr)
                    {

                        Candidate candidateObj = GetById(id);
                        if (candidateObj != null)
                        {
                            candidateObj.UpdatedBy = stUpdatedBy;
                            candidateObj.DeleteFlag = true;
                            candidateObj.UpdateDate = DateTime.Now;
                            candidateObj.UpdatedBy = candidateObj.UpdatedBy;
                            new CandidateLogDao().WriteLogForCandidate(null, candidateObj, ELogAction.Delete);
                            dbContext.SubmitChanges();
                        }
                        else
                        {
                            totalId--;
                        }
                    }
                    if (canDelete)
                    {
                        // Show succes message
                        msg = new Message(MessageConstants.I0001, MessageType.Info, totalId.ToString()+ " candidate(s)", "deleted");
                        trans.Commit();
                    }
                    else
                    {
                        trans.Rollback();
                    }
                }
            }
            catch (Exception)
            {
                if (trans != null) trans.Rollback();
                // Show system error
                msg = new Message(MessageConstants.E0007, MessageType.Error);
            }
            return msg;
        }
开发者ID:vuchannguyen,项目名称:lg-py,代码行数:54,代码来源:CandidateDao.cs

示例14: DeleteList

        /// <summary>
        /// Delete List
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="userName"></param>
        /// <returns></returns>
        public Message DeleteList(string ids, string userName)
        {
            Message msg = null;
            DbTransaction trans = null;

            try
            {
                dbContext.Connection.Open();
                trans = dbContext.Connection.BeginTransaction();
                dbContext.Transaction = trans;

                if (!string.IsNullOrEmpty(ids))
                {
                    ids = ids.TrimEnd(',');
                    string[] idArr = ids.Split(',').Distinct().ToArray();
                    int total = idArr.Count();

                    foreach (string id in idArr)
                    {
                        Training_Class objClass = GetById(ConvertUtil.ConvertToInt(id));

                        if (objClass != null)
                        {
                            //Check item is closed then rollback and show message
                            if (objClass.RegStatusId == Constants.TRAINING_CENTER_COURSE_STATUS_CLOSED)
                            {
                                if (trans != null) trans.Rollback();
                                msg = new Message(MessageConstants.E0050, MessageType.Error, total.ToString() + " class(es)", "");
                                return msg;
                            }

                            objClass.UpdatedBy = userName;
                            Delete(objClass);
                        }
                        else
                        {
                            total--;
                        }
                    }

                    // Show succes message
                    msg = new Message(MessageConstants.I0011, MessageType.Info, (total >1 ? total + " classes have":total + " class has") + " been deleted" );
                    trans.Commit();
                }
            }
            catch
            {
                if (trans != null) trans.Rollback();
                // Show system error
                msg = new Message(MessageConstants.E0007, MessageType.Error);
            }
            return msg;
        }
开发者ID:vuchannguyen,项目名称:lg-py,代码行数:59,代码来源:TrainingClassDao.cs

示例15: InsertList

 public Message InsertList(List<SR_Comment> comment)
 {
     Message msg = null;
     try
     {
         dbContext.SR_Comments.InsertAllOnSubmit(comment);
         dbContext.SubmitChanges();
         msg = new Message(MessageConstants.I0001, MessageType.Info, "Comments", "added");
     }
     catch
     {
         msg = new Message(MessageConstants.E0007, MessageType.Error);
     }
     return msg;
 }
开发者ID:vuchannguyen,项目名称:lg-py,代码行数:15,代码来源:SRCommentDao.cs


注:本文中的CRM.Library.Common.Message类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。