コード例 #1
0
        internal void AddRemark(ModelReqmnt curReq, string sContents)
        {
            ModelRemark remark = new ModelRemark();

            remark.ProjectId     = curReq.ProjectId;
            remark.RequirementId = curReq.Id;
            remark.Contents      = sContents;
            curReq.AllRemark.Add(remark);

            DacFactory.Current.Requiremnt.AddRemark(remark);
        }
コード例 #2
0
        private void btnRemarkApply_Click(object sender, EventArgs e)
        {
            switch (m_curAction)
            {
            case RemarkAction.New:
                if (string.IsNullOrEmpty(txtRemark.Text) == false)
                {
                    DataManager.Current.Requirement.AddRemark(CurRequirement, txtRemark.Text);

                    txtRemark.Text          = string.Empty;
                    btnRemarkApply.Enabled  = false;
                    btnRemarkCancel.Enabled = false;
                    txtRemark.Enabled       = false;

                    btnRemarkNew.Enabled    = true;
                    btnRemarkEdit.Enabled   = true;
                    btnRemarkDelete.Enabled = true;

                    listRemark.Enabled = true;

                    listRemark.DataSource    = null;
                    listRemark.DataSource    = CurRequirement.AllRemark;
                    listRemark.DisplayMember = "Contents";

                    m_curAction = RemarkAction.NoAction;
                }
                break;

            case RemarkAction.Edit:
            {
                m_selectedRemark.Contents = txtRemark.Text;
                DataManager.Current.Requirement.UpdateRemark(m_selectedRemark);
                m_selectedRemark = null;

                txtRemark.Text          = string.Empty;
                btnRemarkApply.Enabled  = false;
                btnRemarkCancel.Enabled = false;
                txtRemark.Enabled       = false;

                btnRemarkNew.Enabled    = true;
                btnRemarkEdit.Enabled   = true;
                btnRemarkDelete.Enabled = true;

                listRemark.Enabled = true;

                listRemark.DataSource    = null;
                listRemark.DataSource    = CurRequirement.AllRemark;
                listRemark.DisplayMember = "Contents";

                m_curAction = RemarkAction.NoAction;
            }
            break;
            }
        }
コード例 #3
0
        internal List <ModelReqmnt> GetAllRequirements(ModelProject selectedProject, List <ModelCategory> aryAllCategory)
        {
            List <ModelReqmnt> aryResult = new List <ModelReqmnt>();

            DataTable     tbResult       = null;
            DataTable     tbResultRemark = null;
            UDataQuerySet set            = new UDataQuerySet("SP_REQ_SELECT", CommandType.StoredProcedure);

            set.AddParam("@PRJID", selectedProject.ID);

            UDataQuerySet setRemark = new UDataQuerySet("SP_REQ_REMARK_SELECT", CommandType.StoredProcedure);

            setRemark.AddParam("@PRJID", selectedProject.ID);

            try
            {
                tbResult       = m_agent.GetDataTable(set);
                tbResultRemark = m_agent.GetDataTable(setRemark);

                foreach (DataRow row in tbResult.Rows)
                {
                    ModelReqmnt req = new ModelReqmnt();
                    req.WriteData(row);
                    req.Category = aryAllCategory.Find(m => m.Id == req.CategoryIdFromDB);
                    aryResult.Add(req);

                    DataRow[] aryRemarks = tbResultRemark.Select(string.Format("REQID = {0}", req.Id));
                    foreach (DataRow rowRemark in aryRemarks)
                    {
                        ModelRemark remark = new ModelRemark();
                        remark.WriteData(rowRemark);
                        req.AllRemark.Add(remark);
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
            finally
            {
                if (tbResult != null)
                {
                    tbResult.Dispose();
                }
                if (tbResultRemark != null)
                {
                    tbResultRemark.Dispose();
                }
            }

            return(aryResult);
        }
コード例 #4
0
        internal void DeleteRemark(ModelRemark selectedRemark)
        {
            UDataQuerySet set = new UDataQuerySet("SP_REQ_REMARK_DELETE", CommandType.StoredProcedure);

            set.AddParam("@ID", selectedRemark.ID);

            try
            {
                m_agent.ExecuteQuery(set);
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
        }
コード例 #5
0
        public void UpdateRemark(ModelRemark remark)
        {
            UDataQuerySet set = new UDataQuerySet("SP_REQ_REMARK_UPDATE", CommandType.StoredProcedure);

            set.AddParam("@ID", remark.ID);
            set.AddParam("@REMARK", remark.Contents.Trim());

            try
            {
                m_agent.ExecuteQuery(set);
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
        }
コード例 #6
0
        private void btnRemarkDelete_Click(object sender, EventArgs e)
        {
            int nSelectedIndex = listRemark.SelectedIndex;

            if (nSelectedIndex > -1)
            {
                ModelRemark selectedRemark = (ModelRemark)listRemark.Items[nSelectedIndex];
                if (selectedRemark != null)
                {
                    string sMessage = string.Format("Really remove this remark\r\n {0}?", selectedRemark.Contents);
                    if (MessageBox.Show(sMessage, "CONFIRM", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        DataManager.Current.Requirement.DeleteRemark(CurRequirement, selectedRemark);
                        listRemark.DataSource    = null;
                        listRemark.DataSource    = CurRequirement.AllRemark;
                        listRemark.DisplayMember = "Contents";
                    }
                }
            }
        }
コード例 #7
0
        public void AddRemark(ModelRemark remark)
        {
            if (remark.RequirementId > -1)
            {
                UDataQuerySet set = new UDataQuerySet("SP_REQ_REMARK_INSERT", CommandType.StoredProcedure);
                set.AddParam("@PRJID", remark.ProjectId);
                set.AddParam("@REQID", remark.RequirementId);
                set.AddParam("@REMARK", remark.Contents.Trim());

                try
                {
                    int nRemarkID = m_agent.GetValue <int>(set);
                    remark.ID = nRemarkID;
                }
                catch (Exception ex)
                {
                    log.Error(ex);
                    remark.ID = -1;
                }
            }
        }
コード例 #8
0
        private void btnRemarkEdit_Click(object sender, EventArgs e)
        {
            int nSelectedIndex = listRemark.SelectedIndex;

            if (nSelectedIndex > -1)
            {
                m_selectedRemark = (ModelRemark)listRemark.Items[nSelectedIndex];
                txtRemark.Text   = m_selectedRemark.Contents;

                m_curAction        = RemarkAction.Edit;
                txtRemark.Enabled  = true;
                listRemark.Enabled = false;

                btnRemarkNew.Enabled    = false;
                btnRemarkEdit.Enabled   = false;
                btnRemarkDelete.Enabled = false;

                btnRemarkApply.Enabled  = true;
                btnRemarkCancel.Enabled = true;

                txtRemark.Focus();
            }
        }
コード例 #9
0
 internal void DeleteRemark(ModelReqmnt curReq, ModelRemark selectedRemark)
 {
     DacFactory.Current.Requiremnt.DeleteRemark(selectedRemark);
     curReq.AllRemark.Remove(selectedRemark);
 }
コード例 #10
0
 internal void UpdateRemark(ModelRemark selectedRemark)
 {
     DacFactory.Current.Requiremnt.UpdateRemark(selectedRemark);
 }