void _Projection__OnClick(ProjectionControl obj)
 {
     obj.isPressed = !obj.isPressed;
     if (!obj.isPressed)
     {
         obj._ProjectionObject.BackColor = Color.WhiteSmoke;
         obj._ProjectionObject.ForeColor = Color.Black;
     }
     else
     {
         obj._ProjectionObject.BackColor = Color.SteelBlue;
         obj._ProjectionObject.ForeColor = Color.White;
     }
    GetSelectedProjectionName();
    cmdOK.Enabled = HasSelectedProjection();
 }
 private void GetData()
 {
     try
     {
         ProjectionDataSource = new DoctorController().GetProjection().Tables[0];
         ProjectionControl _Projection = null;
         foreach (DataRow dr in ProjectionDataSource.Rows)
         {
             _Projection = new ProjectionControl(this, dr["Code"].ToString(), Utility.sDbnull(dr["VN_Projection_NAME"].ToString(), "NO NAME"), Utility.sDbnull(dr["EN_Projection_NAME"].ToString(), "NO NAME"), Utility.Int32Dbnull(dr["STT"].ToString(), 0),false);
             _Projection._OnClick += new ProjectionControl.OnClick(_Projection__OnClick);
             pnlProjectionList.Controls.Add(_Projection);
         }
         cmdOK.Enabled = ProjectionDataSource.Rows.Count > 0;
     }
     catch
     {
     }
 }
        private void cmdRegister_Click(object sender, EventArgs e)
        {
            if (!CheckValidData()) return;
            _ACtrl = new ProjectionControl(txtCode.Text.Trim(), txtVnName.Text.Trim(), txtEngName.Text.Trim(), Convert.ToInt32(txtSTT.Text.Trim()), false);
            DoctorController _Ctrl = new DoctorController();

            ActionResult _ActionResult;
            if (Act == action.Insert) _ActionResult = _Ctrl.InsertProjection(_ACtrl.Code, _ACtrl.Vn_Name, _ACtrl.En_Name, _ACtrl.STT);
            else _ActionResult = _Ctrl.UpdateProjection(_ACtrl.Code, _ACtrl.Vn_Name, _ACtrl.En_Name, _ACtrl.STT);

            if (_ActionResult == ActionResult.Success)
            {
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            if (_ActionResult == ActionResult.ExistedRecord)
            {
                errorProvider1.SetError(txtCode, "Đã tồn tại vị trí chụp có mã " + _ACtrl.Code + ". Đề nghị bạn nhập lại mã khác!");
                Utility.FocusAndSelectAll(txtCode);
            }
        }
        void _NewProjection__OnClick(ProjectionControl obj)
        {
            try
            {
                if (lblMultiCheck.ImageIndex==1) ResetPreviousSelectedPObject(obj.Code);
                obj.isPressed = !obj.isPressed;
                if (!obj.isPressed)
                {
                    obj._ProjectionObject.BackColor = Color.WhiteSmoke;
                    obj._ProjectionObject.ForeColor = Color.Black;
                    if (cboBodySize.Items.Count > 0)
                    {
                        cboBodySize.SelectedIndex = 0;
                        nmrKVP.Value = 15;
                        nmrMA.Value = 0;
                        nmrMAS.Value = 1;
                        CHK_FILMHD.ImageIndex = 1;
                        chkIsLargeFocus.ImageIndex = 0;
                        chkAutoHFlip.ImageIndex = 1;
                        chkAutoVFlip.ImageIndex = 1;
                    }
                    txtRadCode.Text = "";
                }
                else
                {
                    _lastSelectedP=obj;
                    obj._ProjectionObject.BackColor = Color.SteelBlue;
                    obj._ProjectionObject.ForeColor = Color.White;
                    //Load tham số
                    if (cboBodySize.Items.Count > 0)
                    {
                        DataRow[] arrDr = APParams_DataSource.Select("ANATOMY_CODE='" + _Anatomy.Code + "' AND PROJECTION_CODE='" + obj.Code + "' AND BODYSIZE_CODE='" + cboBodySize.SelectedValue.ToString() + "'");
                        if (arrDr.Length > 0)
                        {
                            CHK_FILMHD.ImageIndex = Utility.Int32Dbnull(arrDr[0]["FILM_HD"], 0) == 1 ? 0 : 1;
                            nmrKVP.Value = Convert.ToDecimal(arrDr[0]["KVP"]);
                            nmrMA.Value = Convert.ToInt32(arrDr[0]["MA"]);
                            nmrMAS.Value = Convert.ToInt32(arrDr[0]["MAS"]);
                            DataRow[] arrDrAp = AP_DataSource.Select("ANATOMY_CODE='" + _Anatomy.Code + "' AND PROJECTION_CODE='" + obj.Code + "' AND DEVICE_ID=" + CurrDevice_ID);
                            if (arrDrAp.Length > 0)
                            {
                                chkIsLargeFocus.ImageIndex = Utility.Int32Dbnull(arrDrAp[0]["LARGE_FOCUS"], 0) == 1 ? 0 : 1;
                                chkAutoHFlip.ImageIndex = Utility.Int32Dbnull(arrDrAp[0]["AUTO_FLIPH"], 0) == 1 ? 0 : 1;
                                chkAutoVFlip.ImageIndex = Utility.Int32Dbnull(arrDrAp[0]["AUTO_FLIPV"], 0) == 1 ? 0 : 1;
                               
                            }
                            else
                            {
                                chkIsLargeFocus.ImageIndex = 0;
                                chkAutoHFlip.ImageIndex = 1;
                                chkAutoVFlip.ImageIndex = 1;
                               
                            }
                        }
                        else
                        {
                            CHK_FILMHD.ImageIndex = 1;
                            DataRow[] arrDrAp = AP_DataSource.Select("ANATOMY_CODE='" + _Anatomy.Code + "' AND PROJECTION_CODE='" + obj.Code + "' AND DEVICE_ID=" + CurrDevice_ID);
                            if (arrDrAp.Length > 0)
                            {
                                chkIsLargeFocus.ImageIndex = Utility.Int32Dbnull(arrDrAp[0]["LARGE_FOCUS"], 0) == 1 ? 0 : 1;
                                chkAutoHFlip.ImageIndex = Utility.Int32Dbnull(arrDrAp[0]["AUTO_FLIPH"], 0) == 1 ? 0 : 1;
                                chkAutoVFlip.ImageIndex = Utility.Int32Dbnull(arrDrAp[0]["AUTO_FLIPV"], 0) == 1 ? 0 : 1;
                            }
                            else
                            {
                                chkIsLargeFocus.ImageIndex = 0;
                                chkAutoHFlip.ImageIndex = 1;
                                chkAutoVFlip.ImageIndex = 1;
                            }
                        }
                    }
                    txtRadCode.Text = obj.RAD_Code;
                }
            }
            catch
            {
            }
            finally
            {
                cmdDelProjection.Enabled = HasSelectedProjection();
                cmdMakeAsEmerency.Enabled = cmdDelProjection.Enabled;
                pnlParams.Enabled = cmdDelProjection.Enabled;
            }

           
        }
 void BuildProjectionOfAnatomy(AnatomyControl obj)
 {
     try
     {
         DataRow[] arrDR = AP_DataSource.Select("ANATOMY_CODE='" + obj.Code + "' AND PROJECTION_CODE<>'' AND DEVICE_ID=" + CurrDevice_ID.ToString(),"P_STT");
         foreach (DataRow dr in arrDR)
         {
             ProjectionControl _NewProjection = new ProjectionControl( dr["PROJECTION_CODE"].ToString(), Utility.sDbnull(dr["VN_Projection_NAME"].ToString(), "NO NAME"), Utility.sDbnull(dr["EN_Projection_NAME"].ToString(), "NO NAME"), Utility.Int32Dbnull(0, 0),Utility.sDbnull(dr["IS_USED_FOR_EMERENCY"],"0")=="1"?true:false);
             _NewProjection.RAD_Code = Utility.sDbnull(dr["RAD_CODE"], "");
             _NewProjection._OnClick += new ProjectionControl.OnClick(_NewProjection__OnClick);
             pnlProjectionList.Controls.Add(_NewProjection);
         }
     }
     catch
     {
     }
 }
Beispiel #6
0
 public ProjectionControl Copy()
 {
     ProjectionControl newObj = new ProjectionControl(this.Code, this.Vn_Name, this.En_Name, this.STT,this.IsUsed4Emerency);
     return newObj;
 }
 public frm_AddNewProjection(ProjectionControl _ACtrl)
 {
     InitializeComponent();
     this._ACtrl = _ACtrl;
     txtSTT.KeyPress += new KeyPressEventHandler(_KeyPress);
 }
Beispiel #8
0
 void _Projection__OnClick(ProjectionControl obj)
 {
     try
     {
         ResetPreviousSelectedObject(obj.Code);
         obj.isPressed = !obj.isPressed;
         if (!obj.isPressed)
         {
             obj._ProjectionObject.BackColor = Color.WhiteSmoke;
             obj._ProjectionObject.ForeColor = Color.Black;
         }
         else
         {
             _currP = obj.Copy();
             obj._ProjectionObject.BackColor = Color.SteelBlue;
             obj._ProjectionObject.ForeColor = Color.White;
         }
         cmdDel.Enabled = HasSelectedProjection();
         cmdUpdate.Enabled = cmdDel.Enabled;
     }
     catch
     {
     }
 }
Beispiel #9
0
        private bool HasSelectedProjection()
        {

            try
            {
                foreach (Control ctr in pnlProjectionList.Controls)
                {
                    ProjectionControl _Projection = ctr as ProjectionControl;
                    if (_Projection.isPressed)
                        return true;
                }
                _currP = null;
                return false;
            }
            catch
            {
                return false;
            }
        }
        void updateProjectionStatus(ProjectionControl obj)
        {
            try
            {

                DataRow[] arrDR = AP_DataSource.Select("ANATOMY_CODE='" + _Anatomy.Code + "' AND PROJECTION_CODE='" + obj.Code + "'");// AND DEVICE_ID=" +CurrDevice_ID.ToString());
                if (arrDR.Length >0)
                {
                    arrDR[0]["CHON"] = obj.isPressed ? 1 : 0;
                }
                
                AP_DataSource.AcceptChanges();
            }
            catch
            {
            }
        }
        void _NewProjection__OnClick(ProjectionControl obj)
        {
            try
            {
                obj.isPressed = !obj.isPressed;
                if (!obj.isPressed)
                {
                    obj._ProjectionObject.BackColor = Color.WhiteSmoke;
                    obj._ProjectionObject.ForeColor = Color.Black;
                }
                else
                {
                    obj._ProjectionObject.BackColor = Color.SteelBlue;
                    obj._ProjectionObject.ForeColor = Color.White;
                }
            }
            catch
            {
            }
            finally
            {
                updateProjectionStatus(obj);
                cmdOK.Enabled = AP_DataSource.Select("CHON=1").Length>0;
            }

           
        }
 void BuildProjectionOfAnatomy(AnatomyControl obj)
 {
     try
     {
         DataRow[] arrDR = AP_DataSource.Select("ANATOMY_CODE='" + obj.Code + "' AND PROJECTION_CODE<>'' ");//AND DEVICE_ID=" + CurrDevice_ID.ToString());
         foreach (DataRow dr in arrDR)
         {
             if (!isExistProjection(dr["PROJECTION_CODE"].ToString()))
             {
                 ProjectionControl _NewProjection = new ProjectionControl(dr["PROJECTION_CODE"].ToString(), Utility.sDbnull(dr["VN_Projection_NAME"].ToString(), "NO NAME"), Utility.sDbnull(dr["EN_Projection_NAME"].ToString(), "NO NAME"), Utility.Int32Dbnull(0, 0), false);
                 _NewProjection._OnClick += new ProjectionControl.OnClick(_NewProjection__OnClick);
                 pnlProjectionList.Controls.Add(_NewProjection);
                 if (dr["CHON"].ToString() == "1") _NewProjection._ProjectionObject.PerformClick();
             }
         }
     }
     catch
     {
     }
     finally
     {
         
     }
 }