Пример #1
0
        //取消删除
        private void m_cmdCancelDelete_Click(object sender, EventArgs e)
        {
            if (this.m_lsvConcentration.SelectedItems.Count <= 0)
            {
                return;
            }
            Cursor.Current = Cursors.WaitCursor;
            this.m_cmdCancelDelete.Enabled = false;

            clsLisQCConcentrationVO obj     = (clsLisQCConcentrationVO)this.m_lsvConcentration.SelectedItems[0].Tag;
            clsLisQCConcentrationVO objCopy = new clsLisQCConcentrationVO();

            obj.m_mthCopyTo(objCopy);
            objCopy.m_enmStatus = enmQCStatus.Natrural;

            long lngRes = clsTmdQCBatchConcentrationSmp.s_object.m_lngUpdate(objCopy);

            if (lngRes > 0)
            {//成功
                obj.m_enmStatus = enmQCStatus.Natrural;
                this.m_objDeletedQCContrations.Remove(obj);
                this.m_objQCContrations.Add(obj);
                //
                this.m_lsvConcentration.SelectedItems[0].SubItems[6].Text = "";
                this.m_lsvConcentration.SelectedItems[0].ForeColor        = this.m_lsvConcentration.ForeColor;
                this.m_lsvConcentration_SelectedIndexChanged(this.m_lsvConcentration, null);
            }
            else
            {//失败
                clsCommonDialog.m_mthShowDBError();
            }

            this.m_cmdCancelDelete.Enabled = true;
            Cursor.Current = Cursors.Default;
        }
Пример #2
0
        //保存
        private void m_cmdSave_Click(object sender, EventArgs e)
        {
            if (this.m_lsvConcentration.SelectedItems.Count <= 0 &&
                !this.m_blnNew)
            {
                return;
            }

            Cursor.Current         = Cursors.WaitCursor;
            this.m_cmdSave.Enabled = false;

            if (this.m_blnNew)
            {//新增的保存
                if (this.m_blnNewCheck())
                {
                    clsLisQCConcentrationVO objQCConcentration = new clsLisQCConcentrationVO();
                    objQCConcentration.m_enmStatus           = enmQCStatus.Natrural;
                    objQCConcentration.m_intConcentrationSeq = m_cboConcentration.Value;
                    objQCConcentration.m_intQCBatchSeq       = m_intQCBatchSeq;
                    objQCConcentration.m_strConcentration    = m_cboConcentration.Text;
                    objQCConcentration.m_strDeviceSampleId   = m_txtDeviceSampleID.Text.Trim();
                    try { objQCConcentration.m_dblAVG = Convert.ToDouble(m_txtX.Text.Trim()); }
                    catch { objQCConcentration.m_dblAVG = DBAssist.NullDouble; }
                    try { objQCConcentration.m_dblSD = Convert.ToDouble(m_txtSD.Text.Trim()); }
                    catch { objQCConcentration.m_dblSD = DBAssist.NullDouble; }

                    try { objQCConcentration.m_dblCV = Convert.ToDouble(m_txtCV.Text.Trim()); }
                    catch { objQCConcentration.m_dblCV = DBAssist.NullDouble; }

                    long lngRes = clsTmdQCBatchConcentrationSmp.s_object.m_lngInsert(objQCConcentration);

                    if (lngRes > 0)
                    {//成功
                        //更新状态标志
                        this.m_blnNew = false;
                        //加入到集合
                        this.m_objQCContrations.Add(objQCConcentration);
                        //添加新项
                        ListViewItem item = new ListViewItem(objQCConcentration.m_intConcentrationSeq.ToString());
                        item.SubItems.Add(objQCConcentration.m_strConcentration);
                        item.SubItems.Add(objQCConcentration.m_strDeviceSampleId);
                        item.SubItems.Add(DBAssist.ToString(objQCConcentration.m_dblAVG));
                        item.SubItems.Add(DBAssist.ToString(objQCConcentration.m_dblSD));
                        item.SubItems.Add(DBAssist.ToString(objQCConcentration.m_dblCV));
                        item.SubItems.Add("");
                        item.Tag = objQCConcentration;
                        this.m_lsvConcentration.Items.Add(item);
                        this.m_lsvConcentration.Focus();
                        item.Selected = true;
                        item.Focused  = true;
                    }
                    else
                    {//失败
                        clsCommonDialog.m_mthShowDBError();
                    }
                }
            }
            else if (this.m_blnModifyCheck())
            {//修改的保存
                clsLisQCConcentrationVO objConcentration = (clsLisQCConcentrationVO)this.m_lsvConcentration.SelectedItems[0].Tag;

                clsLisQCConcentrationVO objTemp = new clsLisQCConcentrationVO();
                objConcentration.m_mthCopyTo(objTemp);
                objTemp.m_strDeviceSampleId = this.m_txtDeviceSampleID.Text.Trim();
                try { objTemp.m_dblAVG = Convert.ToDouble(m_txtX.Text.Trim()); }
                catch { objTemp.m_dblAVG = DBAssist.NullDouble; }
                try { objTemp.m_dblSD = Convert.ToDouble(m_txtSD.Text.Trim()); }
                catch { objTemp.m_dblSD = DBAssist.NullDouble; }

                try { objTemp.m_dblCV = Convert.ToDouble(m_txtCV.Text.Trim()); }
                catch { objTemp.m_dblCV = DBAssist.NullDouble; }

                long lngRes = clsTmdQCBatchConcentrationSmp.s_object.m_lngUpdate(objTemp);

                if (lngRes > 0)
                {//成功
                    objTemp.m_mthCopyTo(objConcentration);
                    this.m_lsvConcentration.SelectedItems[0].SubItems[2].Text = objConcentration.m_strDeviceSampleId;
                    this.m_lsvConcentration.SelectedItems[0].SubItems[3].Text = DBAssist.ToString(objConcentration.m_dblAVG);
                    this.m_lsvConcentration.SelectedItems[0].SubItems[4].Text = DBAssist.ToString(objConcentration.m_dblSD);
                    this.m_lsvConcentration.SelectedItems[0].SubItems[5].Text = DBAssist.ToString(objConcentration.m_dblCV);
                }
                else
                {//失败
                    clsCommonDialog.m_mthShowDBError();
                }
            }
            this.m_cmdSave.Enabled = true;
            Cursor.Current         = Cursors.Default;
        }