Beispiel #1
0
        public RemindSettings GetSettingByProjectId(int projectId)
        {
            var tableSettings = m_db.Query <TableRemindSettings>("select * from dbo.RemindSettings where project_id = @0", projectId);

            RemindSettings rs = null;

            foreach (var item in tableSettings)
            {
                rs = new RemindSettings(item);
            }
            return(rs);
        }
Beispiel #2
0
        public ConfigurationViewModel GetConfigInfoByProjectId(string projectId)
        {
            int id = -1;

            int.TryParse(projectId, out id);
            var         accounts    = m_dbAdapter.BankAccount.GetAccounts(id, false);
            var         contacts    = m_dbAdapter.Contact.GetContacts(id);
            var         reminders   = m_dbAdapter.Reminder.GetReminders(id);
            var         setting     = m_dbAdapter.RemindSetting.GetSettingByProjectId(id);
            NewsSetting newsSetting = m_dbAdapter.Monitor.GetNewsSettingByProjectId(id);

            if (newsSetting == null)
            {
                newsSetting = new NewsSetting()
                {
                    KeyWords = "", Range = ""
                };
            }

            if (setting == null)
            {
                RemindSettings rs = new RemindSettings()
                {
                    ProjectId   = id,
                    Frequency   = int.Parse(MyEnumConvertor.MyRemindSettingDictionary["H24"]),
                    RemindType  = int.Parse(MyEnumConvertor.MyRemindSettingDictionary["短信加邮件"]),
                    AutoRemind  = false,
                    RemindDaily = false,
                };
                m_dbAdapter.RemindSetting.AddRemindSettings(rs);
                setting = m_dbAdapter.RemindSetting.GetSettingByProjectId(id);
            }

            ConfigurationViewModel model = new ConfigurationViewModel();

            model.AccountList    = accounts;
            model.ContactList    = contacts;
            model.ReminderList   = reminders;
            model.RemindSettings = setting;
            model.NewsSetting    = newsSetting;

            if (id > 0)
            {
                var project = m_dbAdapter.Project.GetProjectById(id);
                model.CurrentProjectGuid = project.ProjectGuid;
            }

            return(model);
        }
Beispiel #3
0
        public ActionResult SaveRemindSettings(string rowId, string projectId, string autoRemind, string frequency, string typeId, string remindDaily)
        {
            RemindSettings rs = new RemindSettings()
            {
                RowId       = int.Parse(rowId),
                ProjectId   = int.Parse(projectId),
                AutoRemind  = bool.Parse(autoRemind),
                Frequency   = int.Parse(frequency),
                RemindType  = int.Parse(typeId),
                RemindDaily = bool.Parse(remindDaily),
            };

            m_dbAdapter.RemindSetting.UpdateRemindSettings(rs);
            return(Content("Success"));
        }
Beispiel #4
0
 public void UpdateRemindSettings(RemindSettings rs)
 {
     m_logger.Log(rs.ProjectId, "更新提醒设置");
     m_db.Update("RemindSettings", "row_id", rs.GetTableObject(), rs.RowId);
 }
Beispiel #5
0
 public void AddRemindSettings(RemindSettings rs)
 {
     m_logger.Log(rs.ProjectId, "新增默认提醒设置");
     m_db.Insert(rs.GetTableObject());
 }