Inheritance: RAINAction
 private void btnReset_Click(object sender, EventArgs e)
 {
     vAction = action.Insert;
     txtID.Text = "-1";
     txtName.Clear();
     txtName.Focus();
 }
Example #2
0
 /// <summary>
 /// 运行线程
 /// </summary>
 private void run()
 {
     action task, domainUnload;
     action<Exception> onError;
     Monitor.Enter(threadLock);
     try
     {
         if (this.task == null) Monitor.Wait(threadLock);
         task = this.task;
         domainUnload = this.domainUnload;
         onError = this.onError;
         this.task = null;
         this.domainUnload = null;
         this.onError = null;
     }
     finally { Monitor.Exit(threadLock); }
     while (!isStop)
     {
         if (domainUnload != null) fastCSharp.domainUnload.Add(domainUnload);
         try
         {
             task();
         }
         catch (Exception error)
         {
             if (onError != null)
             {
                 try
                 {
                     onError(error);
                 }
                 catch (Exception error1)
                 {
                     log.Default.Add(error1, null, false);
                 }
             }
             else log.Default.Add(error, null, false);
         }
         finally
         {
             if (domainUnload != null) fastCSharp.domainUnload.Remove(domainUnload, false);
         }
         threadPool.Push(this);
         Monitor.Enter(threadLock);
         try
         {
             if (this.task == null) Monitor.Wait(threadLock);
             task = this.task;
             domainUnload = this.domainUnload;
             onError = this.onError;
             this.task = null;
             this.domainUnload = null;
             this.onError = null;
         }
         finally { Monitor.Exit(threadLock); }
     }
 }
 private void btnReset_Click(object sender, EventArgs e)
 {
     vAction = action.Insert;
     txtID.Text = "-1";
     txtName.Clear();
     txtDesc.Clear();
     ckbValid.Checked = true;
     txtName.Focus();
 }
Example #4
0
 // Use this for initialization
 void Awake()
 {
     gameObject.SetActive( firstActionDialogue );
     dialoguePanel = GameObject.Find( "Panel" );
     dialogueScript = dialoguePanel.GetComponent<loadDialogue>();
     GameObject actionObject = transform.Find( "Action" ).gameObject;
     Action = actionObject.GetComponent<action>();
     sceneSetUp = false;
 }
 void ClearControl()
 {
     foreach (Control control in grpControl.Controls)
     {
         if(control is Janus.Windows.GridEX.EditControls.EditBox)
         {
             ((Janus.Windows.GridEX.EditControls.EditBox)(control)).Clear();
         }
         em_Action = action.Insert;
         txtClinicCode.Focus();
     }
 }
 private void btnReset_Click(object sender, EventArgs e)
 {
     vAction = action.Insert;
     txtID.Text = "-1";
     txtName.Clear();
     txtAbbreviation.Clear();
     txtPrice.Value = 0;
     txtDesc.Clear();
     txtSequence.Value = 0;
     ckbPrintDetail.Checked = true;
     txtSequence.Focus();
 }
        private void ClearControl()
        {
            m_enAct = action.Insert;
            foreach (Control control in this.grpControl.Controls)
            {
                if (control is Janus.Windows.GridEX.EditControls.EditBox) control.Text = string.Empty;

            }
            txtMa.Enabled = true;
            cboKhoaNoiTru.SelectedIndex = 0;
            txtMa.Focus();
        }
Example #8
0
        private void ActionDevice(action vAction)
        {
            try
            {
                if (grdDevice.CurrentRow == null && (vAction == action.Update || vAction == action.Delete)) return;

                switch (vAction)
                {
                    case action.Normal:
                        dtDevice =
                            new Select(DDeviceList.Schema.Name + ".*", TTestTypeList.Columns.TestTypeName,
                                       LManufacture.Columns.SName)
                                .From(DDeviceList.Schema.Name).
                                LeftOuterJoin(TTestTypeList.TestTypeIdColumn, DDeviceList.TestTypeIdColumn).
                                LeftOuterJoin(LManufacture.IdColumn, DDeviceList.ManufactureIdColumn).
                                ExecuteDataSet().Tables[0];
                        grdDevice.DataSource = dtDevice;
                        break;
                    case action.Delete:
                        if (
                            DDataControl.CreateQuery().WHERE(DDataControl.Columns.DeviceId,Utility.Int32Dbnull(grdDevice.GetValue("Device_ID"))).
                                GetRecordCount() > 0)
                        {
                            Utility.ShowMsg("Danh mục đang được sử dụng. Không được xóa");
                            return;
                        }
                        if (Utility.AcceptQuestion("Thực hiện xóa " + grdDevice.GetValue("Device_Name"), "Thông báo",
                                                   true))
                        {
                            new Delete().From(DDeviceList.Schema.Name).Where(DDeviceList.Columns.DeviceId).IsEqualTo(
                                Utility.Int32Dbnull(grdDevice.GetValue("Device_ID"))).Execute();
                            grdDevice.CurrentRow.Delete();
                            grdDevice.UpdateData();
                        }
                        dtDevice.AcceptChanges();
                        break;
                    default:
                        var oForm = new frmDeviceList_AU();
                        oForm.vAction = vAction;
                        oForm.drList = Utility.GetDataRow(dtDevice, DDeviceList.Columns.DeviceId,
                                                          grdDevice.GetValue("Device_ID"));
                        oForm.dtList = dtDevice;
                        oForm.ShowDialog();
                        break;
                }
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
            }
        }
Example #9
0
 void ShowInfo()
 {
     Act = action.Insert;
     if (_ACtrl != null)
     {
         Act = action.Update;
         txtCode.Text = _ACtrl.Code;
         txtVnName.Text = _ACtrl.Vn_Name;
         txtEngName.Text = _ACtrl.En_Name;
         txtSTT.Text = _ACtrl.STT.ToString();
         txtCode.Enabled = false;
         txtVnName.Focus();
     }
 }
Example #10
0
 /// <summary>
 /// 等待单次运行
 /// </summary>
 /// <param name="runState">执行状态,0表示未运行,1表示运行中,2表示已经运行</param>
 /// <param name="run">执行委托</param>
 public static void WaitRunOnce(ref int runState, action run)
 {
     int isRun = Interlocked.CompareExchange(ref runState, 1, 0);
     if (isRun == 0)
     {
         try
         {
             run();
         }
         finally { runState = 2; }
     }
     else if (isRun == 1)
     {
         while (runState == 1) Thread.Sleep(1);
     }
 }
Example #11
0
 /// <summary>
 /// 初始化同步套接字
 /// </summary>
 /// <param name="socket">操作套接字</param>
 /// <param name="data">数据缓存</param>
 /// <param name="onClose">关闭套接字处理</param>
 /// <param name="dataPoint">数据缓存起始位置</param>
 protected topSocket(Socket socket, byte[] data, action<topSocket> onClose, byte* dataPoint = null)
 {
     if (socket == null) log.Default.Throw(null, "缺少套接字", true);
     if (data == null) log.Default.Throw(null, "缺少数据缓存", true);
     if (dataPoint != null)
     {
         fixed (byte* dataFixed = data)
         {
             if (dataFixed != dataPoint) log.Default.Throw(null, "数据缓存起始位置不正确", true);
         }
         this.dataPoint = dataPoint;
     }
     this.socket = socket;
     this.data = data;
     this.onClose = onClose;
 }
 private void btnReset_Click(object sender, EventArgs e)
 {
     vAction = action.Insert;
     txtID.Enabled = true;
     txtName.Clear();
     txtMeasureUnit.Clear();
     txtNormalLevel.Clear();
     txtNormalLevelW.Clear();
     txtDesc.Clear();
     txtSequence.Value = 0;
     txtDataPoint.Value = 0;
     ckbDataPrint.Checked = true;
     ckbDataView.Checked = true;
     txtID.Focus();
     txtID.Clear();
 }
Example #13
0
        private void button1_Click(object sender, EventArgs e)
        {
            file_dataclassesDataContext database = new file_dataclassesDataContext();
               /* var log_data = from u in database.users
                           where u.login == textBox1.Text && u.password == textBox2.Text
                           select new { u.u_id };*/
            SqlConnection conn = new SqlConnection("Data Source=.\\SQLSRVR;AttachDbFilename=G:\\GitHub\\mmnote\\Data_base\\Data_base\\files_db.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");

            SqlDataReader log_data = null;
            var ex = 0;
            string quer = "select u_id from users where login = '******' and password = '******'";

            try
            {
                conn.Open();

                SqlCommand cmd = new SqlCommand(quer, conn);

                log_data = cmd.ExecuteReader();

                while(log_data.Read())
                {
                    ex++;
                    uid = (int)log_data[0];
                }

            }
            finally
            {
                if (conn != null) conn.Close();
            }

            if (ex == 0)
            {
                label3.Text = "Inncorect login or password!";
                return;
            }
            action log_act = new action
            {
                u_id = uid,
                act_type = "LOG",
                action_time = DateTime.Now
            };
            database.actions.InsertOnSubmit(log_act);
            database.SubmitChanges();
            Close();
        }
Example #14
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != "")
            {

                var get_money = from m in pay_doc.Element("payments").Elements("userdata").Elements("u_paid")
                                where (string)m.Attribute("idp").Value == user_id.ToString()
                                select m;

                foreach (var m in get_money)
                {
                    money = Convert.ToInt32(m.Value);
                }

                money++;

                var inc = max_files + 5;
                max_files += 5;
                XElement ref_to_files =  pay_doc.Element("payments").Elements("userdata").Elements("u_files")
                                            .Where(id => (string)id.Attribute("idf").Value == user_id.ToString()).FirstOrDefault();

                ref_to_files.SetValue(inc.ToString());

                XElement ref_to_paid = pay_doc.Element("payments").Elements("userdata").Elements("u_paid")
                                            .Where(id => (string)id.Attribute("idp").Value == user_id.ToString()).FirstOrDefault();

                ref_to_paid.SetValue(money.ToString());

                pay_doc.Save("Payments.xml");
                file_dataclassesDataContext database = new file_dataclassesDataContext();
                action pay_act = new action
                {
                    u_id = user_id,
                    act_type = "PAY",
                    action_time = DateTime.Now
                };
                database.actions.InsertOnSubmit(pay_act);
                database.SubmitChanges();

                Close();
            }
            else
            {
                MessageBox.Show("Invalid code!", "Error");
                return;
            }
        }
Example #15
0
        private void ActionDepartment(action vAction)
        {
            try
            {
                if (grdDepartment.CurrentRow == null && (vAction == action.Update || vAction == action.Delete)) return;

                switch (vAction)
                {
                    case action.Normal:
                        dtDepartment = new Select().From(LDepartment.Schema.Name).ExecuteDataSet().Tables[0];
                        grdDepartment.DataSource = dtDepartment;
                        break;
                    case action.Delete:
                        if (
                            LPatientInfo.CreateQuery().WHERE(LPatientInfo.Columns.DepartmentID,
                                                             Utility.Int32Dbnull(grdDepartment.GetValue("ID"))).
                                GetRecordCount() > 0)
                        {
                            Utility.ShowMsg("Danh mục đang được sử dụng. Không được xóa");
                            return;
                        }
                        if (Utility.AcceptQuestion("Thực hiện xóa " + grdDepartment.GetValue("sName"), "Thông báo", true))
                        {
                            new Delete().From(LDepartment.Schema.Name).Where(LDepartment.Columns.Id).IsEqualTo(
                                Utility.Int32Dbnull(grdDepartment.GetValue("ID"))).Execute();
                            grdDepartment.CurrentRow.Delete();
                            grdDepartment.UpdateData();
                        }
                        dtDepartment.AcceptChanges();
                        break;
                    default:
                        var oForm = new frmDepartmentList_AU();
                        oForm.vAction = vAction;
                        oForm.drList = Utility.GetDataRow(dtDepartment, LDepartment.Columns.Id,
                                                          grdDepartment.GetValue("ID"));
                        oForm.dtList = dtDepartment;
                        oForm.ShowDialog();
                        break;
                }
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (!DataValid())
                {
                    return;
                }
                if (vAction==action.Insert)
                {
                    DataRow dr = m_dtResultDetail.NewRow();
                    dr[TResultDetail.Columns.TestDetailId] = -1;
                    dr[TResultDetail.Columns.TestId] = vTestID;
                    m_dtResultDetail.Rows.InsertAt(dr,0);
                    m_dtResultDetail.AcceptChanges();
                    grdResultDetail.MoveFirst();
                    //dr[TResultDetail.Columns.TestId] = Utility.Int32Dbnull(grdTestInfo.GetValue("Test_ID"));
                    //dr[TResultDetail.Columns.PatientId] = Utility.Int32Dbnull(grdPatients.GetValue("Patient_ID"));
                    //dr[TResultDetail.Columns.TestTypeId] = Utility.Int32Dbnull(grdTestInfo.GetValue("TestType_ID"));
                    //dr[TResultDetail.Columns.Barcode] = Utility.sDbnull(grdTestInfo.GetValue("Barcode"));
                }
                //drResultDetail[TResultDetail.Columns.ParaName] = txtPara_Name.Text;
                //drResultDetail[TResultDetail.Columns.NormalLevel] = txtNormal_Level.Text;
                //drResultDetail[TResultDetail.Columns.NormalLevelW] = txtNormal_LevelW.Text;
                //drResultDetail[TResultDetail.Columns.MeasureUnit] = txtMeasure_Unit.Text;
                //drResultDetail[TResultDetail.Columns.TestResult] = txtTest_Result.Text;
                //drResultDetail[TResultDetail.Columns.Note] = txtNote.Text;
                //drResultDetail[TResultDetail.Columns.DataSequence] = Utility.Int32Dbnull(txtSequence.Value);

                grdResultDetail.CurrentRow.Cells[TResultDetail.Columns.ParaName].Value = txtPara_Name.Text;
                grdResultDetail.CurrentRow.Cells[TResultDetail.Columns.NormalLevel].Value = txtNormal_Level.Text;
                grdResultDetail.CurrentRow.Cells[TResultDetail.Columns.NormalLevelW].Value = txtNormal_LevelW.Text;
                grdResultDetail.CurrentRow.Cells[TResultDetail.Columns.MeasureUnit].Value = txtMeasure_Unit.Text;
                grdResultDetail.CurrentRow.Cells[TResultDetail.Columns.TestResult].Value = txtTest_Result.Text;
                grdResultDetail.CurrentRow.Cells[TResultDetail.Columns.Note].Value = txtNote.Text;
                grdResultDetail.CurrentRow.Cells[TResultDetail.Columns.DataSequence].Value = Utility.Int32Dbnull(txtSequence.Value);
                vAction = action.ConfirmData;
                Dispose();
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
            }
        }
 public void actionAsynchronous(action<fastCSharp.setup.cSharp.tcpBase.asynchronousReturn> _onReturn_)
 {
     bool _isCall_ = false;
     try
     {
         fastCSharp.net.tcpClient _client_ = _tcpClient_;
         if (_client_ != null)
         {
             _isCall_ = true;
             _client_.Call(new fastCSharp.setup.cSharp.tcpBase.asyncReturn { OnReturn = _onReturn_ }.CallOnReturn, _c1);
         }
     }
     catch (Exception _error_)
     {
         fastCSharp.log.Default.Add(_error_, null, false);
     }
     finally
     {
         if (!_isCall_) _onReturn_(new fastCSharp.setup.cSharp.tcpBase.asynchronousReturn{ IsReturn = false });
     }
 }
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                txtID.Text = txtID.Text.ToUpper();
                if (ValidData())
                    switch (vAction)
                    {
                        case action.Insert:
                            var obj = new LObjectType();
                            obj.SName = Utility.sDbnull(txtName.Text);
                            obj.SDesc = Utility.sDbnull(txtDesc.Text);
                            obj.IsNew = true;
                            obj.Save();

                            drList = dtList.NewRow();
                            drList[LObjectType.Columns.Id] =
                                LObjectType.CreateQuery().GetMax(LObjectType.Columns.Id);
                            ApplyData2Datarow();
                            dtList.Rows.InsertAt(drList, 0);
                            dtList.AcceptChanges();

                            txtID.Text = Utility.sDbnull(drList[LObjectType.Columns.Id]);
                            vAction = action.Update;
                            break;
                        case action.Update:
                            new Update(LObjectType.Schema.Name).Set(LObjectType.Columns.SName).EqualTo(txtName.Text).
                                Set(LObjectType.Columns.SDesc).EqualTo(txtDesc.Text).
                                Where(LObjectType.Columns.Id).IsEqualTo(Utility.Int32Dbnull(txtID.Text)).
                                Execute();
                            ApplyData2Datarow();
                            drList.AcceptChanges();
                            break;
                    }
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
            }
        }
Example #19
0
 /// <summary>
 /// 表达式转换
 /// </summary>
 protected expressionConverter()
 {
     converters = new action<converter, Expression>[Enum.GetMaxValue<ExpressionType>(-1) + 1];
     converters[(int)ExpressionType.OrElse] = convertOrElse;
     converters[(int)ExpressionType.AndAlso] = convertAndAlso;
     converters[(int)ExpressionType.Equal] = convertEqual;
     converters[(int)ExpressionType.NotEqual] = convertNotEqual;
     converters[(int)ExpressionType.GreaterThanOrEqual] = convertGreaterThanOrEqual;
     converters[(int)ExpressionType.GreaterThan] = convertGreaterThan;
     converters[(int)ExpressionType.LessThan] = convertLessThan;
     converters[(int)ExpressionType.LessThanOrEqual] = convertLessThanOrEqual;
     converters[(int)ExpressionType.Add] = convertAdd;
     converters[(int)ExpressionType.AddChecked] = convertAdd;
     converters[(int)ExpressionType.Subtract] = convertSubtract;
     converters[(int)ExpressionType.SubtractChecked] = convertSubtract;
     converters[(int)ExpressionType.Multiply] = convertMultiply;
     converters[(int)ExpressionType.MultiplyChecked] = convertMultiply;
     converters[(int)ExpressionType.Divide] = convertDivide;
     converters[(int)ExpressionType.Modulo] = convertModulo;
     converters[(int)ExpressionType.Power] = convertPower;
     converters[(int)ExpressionType.Or] = convertOr;
     converters[(int)ExpressionType.And] = convertAnd;
     converters[(int)ExpressionType.ExclusiveOr] = convertExclusiveOr;
     converters[(int)ExpressionType.LeftShift] = convertLeftShift;
     converters[(int)ExpressionType.RightShift] = convertRightShift;
     converters[(int)ExpressionType.FieldAccess] = convertFieldAccess;
     converters[(int)ExpressionType.PropertyAccess] = convertPropertyAccess;
     converters[(int)ExpressionType.Not] = convertNot;
     converters[(int)ExpressionType.Unbox] = convertUnbox;
     converters[(int)ExpressionType.Negate] = convertNegate;
     converters[(int)ExpressionType.NegateChecked] = convertNegate;
     converters[(int)ExpressionType.UnaryPlus] = convertUnaryPlus;
     converters[(int)ExpressionType.IsTrue] = convertIsTrue;
     converters[(int)ExpressionType.IsFalse] = convertIsFalse;
     converters[(int)ExpressionType.Convert] = convertConvert;
     converters[(int)ExpressionType.ConvertChecked] = convertConvert;
     converters[(int)ExpressionType.Conditional] = convertConditional;
     converters[(int)ExpressionType.Call] = convertCall;
 }
Example #20
0
        void parseline(string s)
        {
            if (!s.StartsWith("trace:"))
            {
                return;
            }

            s = s.Replace("~", "dtor_");

            List <Frame> tmpstack = new List <Frame>();

            string[] act    = s.Substring(6, s.IndexOf(";") - 6).Split('|');
            string[] frames = s.Substring(s.IndexOf(";") + 1).Split(';');
            int      ptr    = 0;
            string   prev   = "";

            action a = new action();

            a.name     = act[0];
            a.type     = act[1];
            a.refcount = int.Parse(act[2]);

            foreach (string frame in frames)
            {
                string[] parts = frame.Split('|');
                if (parts.Length != 3)
                {
                    break;
                }
                if (prev == parts[2])
                {
                    continue;
                }
                Frame f = new Frame();
                if (!int.TryParse(parts[0], out f.type))
                {
                    Console.WriteLine(frame);
                    continue;
                }
                f.ptr = int.Parse(parts[1], NumberStyles.AllowHexSpecifier);
                if (ptr == 0)
                {
                    ptr = f.ptr;
                }
                if (f.type == 1)
                {
                    if (parts[2].IndexOf("_ref") > 0 || parts[2].IndexOf("_unref") > 0)
                    {
                        f.name = parts[2];
                    }
                    else
                    {
                        f.name = parts[2];                        //.Substring (0, parts[2].IndexOf ("_"));
                    }
                }
                else
                {
                    f.name = parts[2];
                }

                if (f.name.IndexOf("Track") > 0)
                {
                    continue;
                }
                f.name = Regex.Replace(f.name, "[:(),.-/&`]", "_");
                f.name = f.name.Replace(" ", "_");
                f.name = f.name.Replace("-", "_");

                prev = f.name;
                tmpstack.Add(f);
            }
            a.frames = tmpstack;
            a.ptr    = ptr;
            if (!objects.ContainsKey(ptr))
            {
                objects[ptr] = new obj(ptr);
            }
            else if (objects[ptr].type == null && a.type != "")
            {
                objects[ptr].type = a.type;
            }

            objects[ptr].actions.Add(a);
        }
Example #21
0
 void cmdSua_Click(object sender, EventArgs e)
 {
     m_enAct = action.Update;
     AllowedChanged_maskedEdit = true;
     SetControlStatus();
 }
Example #22
0
 public Action(action action, SpecialSourceType source)
 {
     this.action = action;
     this.source = source;
     this.index  = 0;
 }
 /// <summary>
 /// hàm thực hiện cho phép nhập liên tục thông tin
 /// </summary>
 private void NhapLienTuc()
 {
     em_Action = action.Insert;
     ClearControl();
     InitData();
 }
Example #24
0
 //新增数据
 public ActionResult Add(action input)
 {
     IdalCommon.IactionEx.insert(input);
     return(this.AddSuccessMsg());
 }
Example #25
0
 public ActionResult SubmitForm(action ac, string keyValue)
 {
     actionex.SubmitForm(ac, keyValue);
     return(Success("操作成功。"));
 }
Example #26
0
 private void cmdDelete_Click(object sender, EventArgs e)
 {
     Act = action.Delete;
     ExecuteAction();
     Act = action.FirstOrFinished;
     SetControlStatus();
 }
Example #27
0
 /// <summary>
 /// Constructor setting x,y accel to 0. It let's to set action.
 /// </summary>
 /// <param name="act">Mouse Event action</param>
 public MouseEvent(action act)
 {
     x        = 0;
     y        = 0;
     this.act = act;
 }
Example #28
0
 /// <summary>
 /// Create action in model
 /// </summary>
 /// <param name="action">Action object</param>
 /// <returns>Newly created action ID</returns>
 public async Task <int> CreateActionAsyc(action action)
 {
     _context.action.Add(action);
     return(await _context.SaveChangesAsync());
 }
Example #29
0
        protected override void Update(GameTime gameTime)
        {
            now = DateTime.Now;
            millisecondsElapsed = (now - lastIteration).TotalMilliseconds;
            action act = myMenu.Update(curScreen);

            if (changingKey)
            {
                if (Keyboard.GetState().GetPressedKeyCount() == 1 && Keyboard.GetState().IsKeyUp(Keys.Enter))
                {
                    if (thrust == Keys.None)
                    {
                        thrust       = Keyboard.GetState().GetPressedKeys()[0];
                        KeyConfig[0] = thrust;
                        myMenu.updateThrust(this.thrust);
                    }
                    else if (rotLeft == Keys.None)
                    {
                        rotLeft      = Keyboard.GetState().GetPressedKeys()[0];
                        KeyConfig[1] = rotLeft;
                        myMenu.updateRotLeft(this.rotLeft);
                    }
                    else if (rotRight == Keys.None)
                    {
                        rotRight     = Keyboard.GetState().GetPressedKeys()[0];
                        KeyConfig[2] = rotRight;
                        myMenu.updateRotRight(this.rotRight);
                    }
                    changingKey = false;
                }
            }
            else
            {
                if (act != action.NULL)
                {
                    switch (act)
                    {
                    case action.PLAY:
                        prepNewTerrain(screen.LEVEL1);
                        createPolygon(new Point(0, (int)(screenHeight * (0.8))), new Point(screenWidth, (int)(screenHeight * (0.8))));
                        break;

                    case action.HIGH_SCORES:
                        curScreen = screen.HIGH_SCORES;
                        break;

                    case action.CONTROLS:
                        curScreen = screen.CONTROLS;
                        break;

                    case action.CREDITS:
                        curScreen = screen.CREDITS;
                        break;

                    case action.BACK:
                        curScreen = myMenu.destinationScreen;
                        break;

                    case action.QUIT:    //Generic quit vs. Terminate?
                        Quit();
                        break;

                    case action.CONTINUE:    //Quit menu
                        break;

                    case action.CHANGE_UP:
                        thrust = Keys.None;
                        myMenu.updateThrust(Keys.None);
                        changingKey = true;
                        break;

                    case action.CHANGE_LEFT:
                        rotLeft = Keys.None;
                        myMenu.updateRotLeft(Keys.None);
                        changingKey = true;
                        break;

                    case action.CHANGE_RIGHT:
                        rotRight = Keys.None;
                        myMenu.updateRotRight(Keys.None);
                        changingKey = true;
                        break;
                    }
                }
                switch (curScreen)
                {
                case screen.WIN1:
                    System.Threading.Thread.Sleep(3000);
                    if (curScreen == screen.WIN1)
                    {
                        prepNewTerrain(screen.LEVEL2);

                        createPolygon(new Point(0, (int)(screenHeight * (0.8))), new Point(screenWidth, (int)(screenHeight * (0.8))));     //TODO: Random doubles in range for start points
                    }
                    break;

                case screen.LEVEL1:
                case screen.LEVEL2:
                    if (Keyboard.GetState().IsKeyDown(Keys.F1))
                    {
                        if (!keyPressed)
                        {
                            prepNewTerrain();
                            createPolygon(new Point(0, (int)(screenHeight * (0.8))), new Point(screenWidth, (int)(screenHeight * (0.8))));
                            keyPressed = true;
                        }
                    }
                    if (Keyboard.GetState().IsKeyDown(rotLeft))
                    {
                        lander.angle -= 0.04f;
                    }
                    if (Keyboard.GetState().IsKeyDown(rotRight))
                    {
                        lander.angle += 0.04f;
                    }
                    if (Keyboard.GetState().IsKeyDown(thrust))
                    {
                        if (lander.fuel > 0)
                        {
                            emitParticles = true;
                            Vector2 direction = new Vector2((float)Math.Cos(lander.angle - Math.PI / 2), (float)Math.Sin(lander.angle - Math.PI / 2));
                            horizontalMomentum += direction.X * 0.04f;
                            gravitationalForce += direction.Y * 0.04f;
                            lander.fuel        -= 0.1f;
                        }
                        else
                        {
                            emitParticles = false;
                        }
                    }
                    else
                    {
                        emitParticles = false;
                    }

                    if (crashed)
                    {
                        transitionTime += (int)millisecondsElapsed;
                        if (transitionTime < 500)
                        {
                            particleEmitterFire.shipCrash(lander.position);
                            //particleEmitterSmoke.shipCrash(lander.position);
                            particleEmitterFire.shipThrust(gameTime, lander.position, true, -1);
                            particleEmitterSmoke.shipThrust(gameTime, lander.position, false, -1);
                        }
                        else if (transitionTime < 2000)
                        {
                            particleEmitterFire.shipThrust(gameTime, lander.position, false, -1);
                            particleEmitterSmoke.shipThrust(gameTime, lander.position, false, -1);
                        }
                        else
                        {
                            crashed   = false;
                            curScreen = screen.LOSE;
                        }
                    }
                    else
                    {
                        float landerRadius = (screenWidth * 0.03958f) / 2;
                        particleEmitterSmoke.shipThrust(gameTime, lander.position + new Vector2(((float)Math.Cos(lander.angle + Math.PI / 2) * landerRadius), ((float)Math.Sin(lander.angle + Math.PI / 2) * landerRadius)), emitParticles, lander.angle, 0.3);
                        particleEmitterFire.shipThrust(gameTime, lander.position + new Vector2(((float)Math.Cos(lander.angle + Math.PI / 2) * landerRadius), ((float)Math.Sin(lander.angle + Math.PI / 2) * landerRadius)), emitParticles, lander.angle, 0.2);
                    }

                    if (detectCollision() && !stop)
                    {
                        //detect win/loss condition
                        if (isWin())
                        {
                            //1. Wait while sound plays
                            //2. play sound
                            //3. Switch to WIN1 screen
                            MediaPlayer.Stop();
                            soundEffects[1].CreateInstance().Play();
                            stop = true;
                            if (curScreen == screen.LEVEL1)
                            {
                                curScreen = screen.WIN1;
                            }
                            else
                            {
                                curScreen = screen.WIN2;
                            }
                            myMenu.Update(curScreen);
                            System.Threading.Thread.Sleep(1000);


                            themePlaying = false;
                            generateScore();
                        }
                        else
                        {
                            //1. Wait while ship explodes
                            //2. play sound
                            //3. Switch to lose screen
                            MediaPlayer.Stop();
                            soundEffects[0].CreateInstance().Play();
                            stop               = true;
                            crashed            = true;
                            lander.fuel        = 0;
                            lander.angle       = 0;
                            gravitationalForce = 0;
                            themePlaying       = false;
                            currentScore       = 0;
                        }
                    }


                    if (!stop)
                    {
                        //Move Lander
                        //Lander position.X += horizontalmomentum
                        //Lander Position.Y += gravitationalForce
                        //Given direction of lander, increment/decrement gravity and momentum given thrust_YN
                        Vector2 movement = new Vector2(horizontalMomentum, gravitationalForce);
                        lander.position    += movement * (int)millisecondsElapsed * 0.2f;
                        gravitationalForce += 0.01f;
                        if (horizontalMomentum != 0)
                        {
                            if (horizontalMomentum > 0)
                            {
                                horizontalMomentum -= 0.01f;
                            }
                            else
                            {
                                horizontalMomentum += 0.01f;
                            }
                        }
                    }

                    break;
                }
            }
            if (Keyboard.GetState().GetPressedKeyCount() == 0)
            {
                keyPressed = false;
            }

            lastIteration = now;
            base.Update(gameTime);
        }
Example #30
0
 public Action(action action)
 {
     this.action = action;
     this.source = SpecialSourceType.desktop1;
     this.index  = 0;
 }
Example #31
0
 public Action(action action, int index)
 {
     this.action = action;
     this.source = SpecialSourceType.desktop1;
     this.index  = index;
 }
Example #32
0
 [Test] public void Action_AND_Action()
 {
     action w = @void && @void;
 }
Example #33
0
 foreach (var(action, enabled) in actions)
Example #34
0
 /// <summary>
 /// 抓取页面字节流
 /// </summary>
 /// <param name="onCrawlData">异步事件</param>
 /// <param name="request">URI请求信息</param>
 public void CrawlData(action <byte[]> onCrawlData, request request)
 {
     new dataCrawler {
         WebClient = this, OnCrawlData = onCrawlData, Request = request
     }.Crawl();
 }
Example #35
0
        public ActionResult GetDocument(string id)
        {
            action aa = IdalCommon.IactionEx.getEntityById(int.Parse(id));

            return(this.SuccessData(aa));
        }
Example #36
0
 public void UpdateAction(action currentaction)
 {
     this.ObjectContext.action.AttachAsModified(currentaction, this.ChangeSet.GetOriginal(currentaction));
 }
Example #37
0
 //修改数据
 public ActionResult Update(action input)
 {
     IdalCommon.IactionEx.update(input);
     return(this.UpdateSuccessMsg());
 }
Example #38
0
 /// <summary>
 /// 获取泛型回调委托
 /// </summary>
 /// <typeparam name="valueType">返回值类型</typeparam>
 /// <param name="callback">回调委托</param>
 /// <returns>泛型回调委托</returns>
 private static object getGenericParameterCallback <valueType>(action <fastCSharp.setup.cSharp.tcpBase.asynchronousReturn <object> > callback)
 {
     return((action <fastCSharp.setup.cSharp.tcpBase.asynchronousReturn <valueType> >) new genericParameterCallback <valueType> {
         OnCallback = callback
     }.Callback);
 }
Example #39
0
 void cmdxoa_Click(object sender, EventArgs e)
 {
     Xoatamung();
     m_enAct = action.FirstOrFinished;
     SetControlStatus();
 }
        /// <summary>
        /// hàm thực hiện việc thêm phiếu nhập kho thuốc
        /// </summary>
        private void ThemPhieuthanhly()
        {
            TPhieuNhapxuatthuoc objPhieuNhap = CreatePhieuNhapKho();

            ActionResult actionResult = new XuatThuoc().ThemPhieuXuatKho(objPhieuNhap, CreateArrPhieuChiTiet());
            switch (actionResult)
            {
                case ActionResult.Success:
                    txtIDPhieuNhapKho.Text = Utility.sDbnull(objPhieuNhap.IdPhieu);
                    txtMaPhieu.Text = Utility.sDbnull(objPhieuNhap.MaPhieu);
                    TPhieuNhapxuatthuoc objPhieu = TPhieuNhapxuatthuoc.FetchByID(Utility.Int32Dbnull(txtIDPhieuNhapKho.Text));
                    DataRow newDr = p_mDataPhieuNhapKho.NewRow();
                    Utility.FromObjectToDatarow(objPhieu, ref newDr);
                    TDmucKho objKho = TDmucKho.FetchByID(Utility.Int32Dbnull(cboKhohuy.SelectedValue, -1));
                    if (objKho != null)
                        newDr["ten_khoxuat"] = Utility.sDbnull(objKho.TenKho);
                    p_mDataPhieuNhapKho.Rows.Add(newDr);
                    Utility.GonewRowJanus(grdList, TPhieuNhapxuatthuoc.Columns.IdPhieu, Utility.sDbnull(txtIDPhieuNhapKho.Text));
                    //Utility.ShowMsg("Bạn thêm mới phiếu chuyển kho thành công", "Thông báo");
                    m_enAction = action.Insert;

                    b_Cancel = true;
                    this.Close();
                    break;
                case ActionResult.Error:
                    Utility.ShowMsg("Lỗi trong quá trình thêm phiếu", "Thông báo lỗi", MessageBoxIcon.Error);
                    break;
            }
        }
Example #41
0
 /// <summary>
 /// hàm thực hiện cho phép nhập liên tục thông tin
 /// </summary>
 private void NhapLienTuc()
 {
     m_enAct = action.Insert;
     ClearControl();
     IntialDataControl();
 }
Example #42
0
 ProcessInstruction(action, inputValue);
Example #43
0
 /// <summary>
 /// 获取泛型回调委托
 /// </summary>
 /// <param name="type">返回值类型</param>
 /// <param name="callback">回调委托</param>
 /// <returns>泛型回调委托</returns>
 public static object GetGenericParameterCallback(fastCSharp.setup.remoteType type, action <fastCSharp.setup.cSharp.tcpBase.asynchronousReturn <object> > callback)
 {
     return(((func <action <fastCSharp.setup.cSharp.tcpBase.asynchronousReturn <object> >, object>)Delegate.CreateDelegate(typeof(func <action <fastCSharp.setup.cSharp.tcpBase.asynchronousReturn <object> >, object>), getGenericParameterCallbackMethod.MakeGenericMethod(type.Type)))(callback));
 }
Example #44
0
        private void ThemLanKham()
        {
            KcbDanhsachBenhnhan objBenhnhan = CreatePatientInfo();
            objLuotkham = CreatePatientExam();
            KcbDangkyKcb objRegExam = CreateNewRegExam();
            ActionResult actionResult = _KCB_DANGKY.ThemmoiLuotkham(objBenhnhan, objLuotkham, objRegExam,
                                                                             Utility.Int32Dbnull(cboKieuKham.Value, -1));

            switch (actionResult)
            {
                case ActionResult.Success:

                    PtramBhytCu = Utility.DecimaltoDbnull(txtPtramBHYT.Text, 0);
                    PtramBhytGocCu = Utility.DecimaltoDbnull(txtptramDauthe.Text, 0);
                    txtMaLankham.Text = Utility.sDbnull(objLuotkham.MaLuotkham);
                    txtMaBN.Text = Utility.sDbnull(objLuotkham.IdBenhnhan);
                    UpdateStatusQMS();
                    m_blnHasJustInsert = true;
                    m_enAction = action.Update;
                    LaydanhsachdangkyKCB();
                    setMsg(uiStatusBar1.Panels["MSG"], "Bạn thêm mới lần khám bệnh nhân thành công", false);
                    ThemMoiLanKhamVaoLuoi();
                    if (_OnActionSuccess != null) _OnActionSuccess();
                    if (objRegExam != null)
                    {
                        Utility.GotoNewRowJanus(grdRegExam, KcbDangkyKcb.Columns.IdKham, Utility.sDbnull(objRegExam.IdKham));
                        if (PropertyLib._MayInProperties.InPhieuKCBsaukhiluu)
                        {
                            InPhieu();
                        }
                        else
                        {
                            cmdInPhieuKham.Focus();
                        }
                    }
                    LoadThongTinChoKham();
                    Utility.GotoNewRowJanus(grdList, KcbLuotkham.Columns.MaLuotkham, txtMaLankham.Text);
                    cmdThemMoiBN_Click(cmdThemMoiBN, new EventArgs());
                    m_blnCancel = false;
                    break;
                case ActionResult.Error:
                    setMsg(uiStatusBar1.Panels["MSG"], "Lỗi trong quá trình thêm lần khám !", true);
                    cmdSave.Focus();
                    break;
            }
        }
Example #45
0
 /// <summary>
 /// 异步抓取页面HTML代码
 /// </summary>
 /// <param name="onCrawlHtml">异步事件</param>
 /// <param name="request">URI请求信息</param>
 /// <param name="encoding">页面编码</param>
 /// <returns>页面HTML代码,失败返回null</returns>
 public void CrawlHtml(action <string> onCrawlHtml, request request, Encoding encoding = null)
 {
     CrawlData(new htmlCrawler {
         WebClient = this, OnCrawlHtml = onCrawlHtml, Encoding = encoding
     }.onCrawlData, request);
 }
Example #46
0
        /// <summary>
        /// hàm thực hiện việc làm sách thông tin của bệnh nhân
        /// </summary>
        private void ClearControl()
        {
            setMsg(uiStatusBar1.Panels["MSG"], "", false);
            m_blnHasJustInsert = false;
            txtSolankham.Text = "1";
            txtTEN_BN.Clear();
            txtNamSinh.Clear();
            dtpBOD.Value = globalVariables.SysDate;
            txtTuoi.Clear();
            txtCMT.Clear();
            txtNgheNghiep.Clear();
            txtDiachi.Clear();
            txtDantoc.Clear();
            txtTrieuChungBD.Clear();
            txtSoDT.Clear();
            chkChuyenVien.Checked = false;
            txtNoichuyenden.SetCode("-1");
            txtKieuKham.ClearMe();
            txtPhongkham.ClearMe();

            txtLoaiBN.SetCode("-1");
            txtNoigioithieu.Clear();
            txtEmail.Clear();
            if (THU_VIEN_CHUNG.IsNgoaiGio())
            {
               this.Text= "Bệnh nhân đang khám dịch vụ ngoài giờ";
            }

            ModifyCommand();
            EnumerableRowCollection<DataRow> query = from kham in m_dtExamTypeRelationList.AsEnumerable()
                                                     select kham;
            if (query.Count() > 0)
            {
                cboKieuKham.SelectedIndex = -1;
                cboKieuKham.Text = "CHỌN PHÒNG KHÁM";
            }
            AllowTextChanged = false;
            XoathongtinBHYT(true);

            _MaDoituongKcb = Utility.sDbnull(cboDoituongKCB.SelectedValue);
            objDoituongKCB = new Select().From(DmucDoituongkcb.Schema).Where(DmucDoituongkcb.MaDoituongKcbColumn).IsEqualTo(_MaDoituongKcb).ExecuteSingle<DmucDoituongkcb>();
            if (objDoituongKCB == null) return;
            _IdDoituongKcb = objDoituongKCB.IdDoituongKcb;
            _IdLoaidoituongKcb = objDoituongKCB.IdLoaidoituongKcb;
            _TenDoituongKcb = objDoituongKCB.TenDoituongKcb;
            PtramBhytCu = objDoituongKCB.PhantramTraituyen.Value;
            PtramBhytGocCu = PtramBhytCu;
            txtPtramBHYT.Text = objDoituongKCB.PhantramTraituyen.ToString();
            txtptramDauthe.Text = objDoituongKCB.PhantramTraituyen.ToString();
            if (objDoituongKCB.IdLoaidoituongKcb == 0)//ĐỐi tượng BHYT
            {
                pnlBHYT.Enabled = true;
                lblPtram.Text = "Phần trăm BHYT";
                TinhPtramBHYT();
                NapThongtinDichvuKCB();
                txtMaDtuong_BHYT.SelectAll();
                txtMaDtuong_BHYT.Focus();
            }
            else//Đối tượng khác BHYT
            {
                pnlBHYT.Enabled = false;
                lblPtram.Text = "P.trăm giảm giá";
                //XoathongtinBHYT(PropertyLib._KCBProperties.XoaBHYT);
                NapThongtinDichvuKCB();
                txtTEN_BN.Focus();
            }

            chkTraiTuyen.Checked = false;
            lblTuyenBHYT.Text = chkTraiTuyen.Checked ? "TRÁI TUYẾN" : "ĐÚNG TUYẾN";
            lblPtramdauthe.Visible = objDoituongKCB.IdLoaidoituongKcb == 0;
            txtptramDauthe.Visible = objDoituongKCB.IdLoaidoituongKcb == 0;
            chkChuyenVien.Checked = false;
            chkCapCuu.Checked = false;
            txtPtramBHYT.Text = "0";
            txtptramDauthe.Text = "0";
            AllowTextChanged = true;
            //Chuyển về trạng thái thêm mới
            m_enAction = action.Insert;
            if (PropertyLib._KCBProperties.SexInput) cboPatientSex.SelectedIndex = -1;
            lnkThem.Visible = false;
            SinhMaLanKham();
            m_dataDataRegExam.Clear();
            if (pnlBHYT.Enabled)
            {
                lblPtram.Text = "Phần trăm BHYT";
                txtMaDtuong_BHYT.Focus();
            }
            else
            {
                lblPtram.Text = "P.trăm giảm giá";
                PtramBhytCu = objDoituongKCB.PhantramTraituyen.Value;
                PtramBhytGocCu = PtramBhytCu;
                txtPtramBHYT.Text = objDoituongKCB.PhantramTraituyen.ToString();
                txtptramDauthe.Text = objDoituongKCB.PhantramTraituyen.ToString();
                txtTEN_BN.Focus();
            }
            if (m_enAction == action.Insert)
            {
                dtpInputDate.Value = globalVariables.SysDate;
                dtCreateDate.Value = globalVariables.SysDate;
                dtInsFromDate.Value = new DateTime(globalVariables.SysDate.Year, 1, 1);
                dtInsToDate.Value = new DateTime(globalVariables.SysDate.Year, 12, 31);
            }
            SetActionStatus();
            DmucDichvukcb objDmucDichvukcb = DmucDichvukcb.FetchByID(QMS_IdDichvuKcb);
            if (objDmucDichvukcb != null)
            {

                txtKieuKham.SetId(objDmucDichvukcb.IdKieukham);
                txtPhongkham.SetId(objDmucDichvukcb.IdPhongkham);
                txtExamtypeCode.SetCode(objDmucDichvukcb.MaDichvukcb);
                cboKieuKham.Text = objDmucDichvukcb.TenDichvukcb;

            }
            txtExamtypeCode.TabStop = objDmucDichvukcb == null;
            cboKieuKham.TabStop = objDmucDichvukcb == null;
        }
Example #47
0
 /// <summary>
 /// Here you can set all parameters. Used only with scrolling.
 /// </summary>
 /// <param name="act">action</param>
 /// <param name="x">x acceleration</param>
 /// <param name="y">y acceleration</param>
 public MouseEvent(action act, int x, int y)
 {
     this.x   = x;
     this.y   = y;
     this.act = act;
 }
Example #48
0
        // private  b_QMSStop=false;
        /// <summary>
        /// hàm thực hiện việc lấy thông tin của phần dữ liệu
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frm_KCB_DANGKY_Load(object sender, EventArgs e)
        {
            try
            {
                AllowTextChanged = false;
                b_HasLoaded = false;
                dtInsFromDate.Value = new DateTime(globalVariables.SysDate.Year, 1, 1);
                dtInsToDate.Value = new DateTime(globalVariables.SysDate.Year, 12, 31);
                Utility.SetColor(lblDiachiBHYT, THU_VIEN_CHUNG.Laygiatrithamsohethong("KCB_BATNHAP_DIACHI_BHYT", "1", false) == "1" ? lblHoten.ForeColor : lblMatheBHYT.ForeColor);
                Utility.SetColor(lblDiachiBN, THU_VIEN_CHUNG.Laygiatrithamsohethong("KCB_BATNHAP_DIACHI_BENHNHAN", "1", false) == "1" ? lblHoten.ForeColor : lblMatheBHYT.ForeColor);
                chkTraiTuyen.Visible = THU_VIEN_CHUNG.Laygiatrithamsohethong("KCB_CHOPHEPTIEPDON_TRAITUYEN", "1", false) == "1";

                XoathongtinBHYT(true);
                AddAutoCompleteDiaChi();
                Get_DanhmucChung();
                AutocompleteBenhvien();
                LoadThongTinChoKham();
                NapThongtinDichvuKCB();
                DataBinding.BindDataCombobox(cboDoituongKCB, THU_VIEN_CHUNG.LaydanhsachDoituongKcb(), DmucDoituongkcb.Columns.MaDoituongKcb, DmucDoituongkcb.Columns.TenDoituongKcb, "", false);
                objDoituongKCB = new Select().From(DmucDoituongkcb.Schema).Where(DmucDoituongkcb.MaDoituongKcbColumn).IsEqualTo(_MaDoituongKcb).ExecuteSingle<DmucDoituongkcb>();
                cboDoituongKCB.SelectedIndex = Utility.GetSelectedIndex(cboDoituongKCB, _MaDoituongKcb);
                ChangeObjectRegion();
                if (m_enAction == action.Insert)//Thêm mới BN
                {
                    objLuotkham = null;
                    if (PropertyLib._KCBProperties.SexInput)
                        cboPatientSex.SelectedIndex = -1;
                    SinhMaLanKham();
                    txtTEN_BN.Select();
                }
                else if (m_enAction == action.Update)//Cập nhật thông tin Bệnh nhân
                {
                    LoadThongtinBenhnhan();
                    LaydanhsachdangkyKCB();
                    txtTEN_BN.Select();
                }
                else if (m_enAction == action.Add) //Thêm mới lần khám
                {
                    objLuotkham = null;
                    string ngay_kham = globalVariables.SysDate.ToString("dd/MM/yyyy");
                    if (!NotPayment(txtMaBN.Text.Trim(), ref ngay_kham))//Nếu đã thanh toán xong hết thì thêm lần khám mới
                    {
                        SinhMaLanKham();
                        LoadThongtinBenhnhan();
                        LaydanhsachdangkyKCB();
                        txtKieuKham.Select();
                    }
                    else//Còn lần khám chưa thanh toán-->Kiểm tra
                    {
                        //nếu là ngày hiện tại thì đặt về trạng thái sửa
                        if (ngay_kham == "NOREG" || ngay_kham==globalVariables.SysDate.ToString("dd/MM/yyyy"))
                        {
                            LoadThongtinBenhnhan();
                            if (ngay_kham == "NOREG")//Bn chưa đăng ký phòng khám nào cả.
                            {
                                //Nếu ngày hệ thống=Ngày đăng ký gần nhất-->Sửa
                                if (globalVariables.SysDate.ToString("dd/MM/yyyy") == dtpInputDate.Value.ToString("dd/MM/yyyy"))
                                {
                                    m_enAction = action.Update;

                                    Utility.ShowMsg(
                                       "Bệnh nhân vừa được đăng ký ngày hôm nay nên hệ thống sẽ chuyển về chế độ Sửa thông tin. Nhấn OK để bắt đầu sửa");
                                    LaydanhsachdangkyKCB();
                                    txtTEN_BN.Select();
                                }
                                else//Thêm lần khám cho ngày mới
                                {
                                    m_enAction = action.Add;
                                    SinhMaLanKham();
                                    LaydanhsachdangkyKCB();
                                    txtKieuKham.Select();
                                }
                            }
                            else//Quay về trạng thái sửa
                            {
                                m_enAction = action.Update;

                                Utility.ShowMsg(
                                   "Bệnh nhân vừa được đăng ký ngày hôm nay nên hệ thống sẽ chuyển về chế độ Sửa thông tin. Nhấn OK để bắt đầu sửa");
                                LaydanhsachdangkyKCB();
                                txtTEN_BN.Select();
                            }
                        }
                        else //Không cho phép thêm lần khám khác nếu chưa thanh toán lần khám của ngày hôm trước
                        {
                            Utility.ShowMsg(
                                "Bệnh nhân đang có lần khám chưa được thanh toán. Cần thanh toán hết các lần đến khám bệnh của Bệnh nhân trước khi thêm lần khám mới. Nhấn OK để hệ thống chuyển về trạng thái thêm mới Bệnh nhân");
                            cmdThemMoiBN_Click(cmdThemMoiBN, new EventArgs());
                        }
                    }
                }
                StatusControl();
                ModifyCommand();
                AllowTextChanged = true;
            }
            catch
            {
            }
            finally
            {
                this.Text = "Đăng ký KCB -->Demo 5000";
                SetActionStatus();
                if (Nhieuhon2Manhinh())
                {
                    pThongTinQMS.Enabled = true;
                    b_HasSecondScreen = true;
                    ShowScreen();
                }
                else
                {
                    b_HasSecondScreen = false;
                    pThongTinQMS.Enabled = false;
                }

                ModifyCommand();
                ModifyButtonCommandRegExam();

                b_HasLoaded = true;
                CanhbaoInphoi();

            }
        }
Example #49
0
 private void cmdCancel_Click(object sender, EventArgs e)
 {
     Act = action.FirstOrFinished;
     SetControlStatus();
 }
Example #50
0
 /// <summary>
 /// Constructor with two acceleration parameters setting action as MOVE.
 /// This event will be handled by MouseMover.
 /// </summary>
 /// <param name="x">x acceleration</param>
 /// <param name="y">y acceleration</param>
 public MouseEvent(int x, int y)
 {
     this.x = x;
     this.y = y;
     act    = action.MOVE;
 }
        private void cmdSave_Click(object sender, EventArgs e)
        {
            try
            {
                txtID.Text = txtID.Text.ToUpper();
                if (ValidData())
                    switch (vAction)
                    {
                        case action.Insert:
                            var obj = new LStandardTest();
                            obj.TestDataId = Utility.sDbnull(txtID.Text, "NONE");
                            obj.DataName = Utility.sDbnull(txtName.Text, "NONE");
                            obj.DataSequence = Utility.Int32Dbnull(txtSequence.Value, 0);
                            obj.TestTypeId = Utility.Int32Dbnull(cboTestType.SelectedValue, -1);
                            obj.MeasureUnit = Utility.sDbnull(txtMeasureUnit.Text);
                            obj.NormalLevel = Utility.sDbnull(txtNormalLevel.Text);
                            obj.NormalLevelW = Utility.sDbnull(txtNormalLevelW.Text);
                            obj.DataPoint = (short)Utility.Int32Dbnull(txtDataPoint.Value,0);
                            obj.DataView = ckbDataView.Checked;
                            obj.DataPrint = ckbDataPrint.Checked;
                            obj.Description = Utility.sDbnull(txtDesc.Text);
                            obj.IsNew = true;
                            obj.Save();

                            drData = dtTestDataList.NewRow();
                            ApplyData2Datarow();
                            dtTestDataList.Rows.InsertAt(drData, 0);
                            dtTestDataList.AcceptChanges();
                            txtID.Enabled = false;
                            vAction=action.Update;
                            break;
                        case action.Update:
                            new Update(LStandardTest.Schema.Name).Set(LStandardTest.Columns.TestDataId).EqualTo(txtID.Text).
                                Set(LStandardTest.Columns.DataName).EqualTo(txtName.Text).
                                Set(LStandardTest.Columns.DataSequence).EqualTo(txtSequence.Text).
                                Set(LStandardTest.Columns.TestTypeId).EqualTo(Utility.Int32Dbnull(cboTestType.SelectedValue, -1)).
                                Set(LStandardTest.Columns.MeasureUnit).EqualTo(txtMeasureUnit.Text).
                                Set(LStandardTest.Columns.NormalLevel).EqualTo(txtNormalLevel.Text).
                                Set(LStandardTest.Columns.NormalLevelW).EqualTo(txtNormalLevelW.Text).
                                Set(LStandardTest.Columns.DataPoint).EqualTo(txtDataPoint.Text).
                                Set(LStandardTest.Columns.DataView).EqualTo(ckbDataView.Checked).
                                Set(LStandardTest.Columns.DataPrint).EqualTo(ckbDataPrint.Checked).
                                Set(LStandardTest.Columns.Description).EqualTo(txtDesc.Text).
                                Where(LStandardTest.Columns.TestDataId).IsEqualTo(txtID.Text).Execute();
                            ApplyData2Datarow();
                            drData.AcceptChanges();
                            break;
                    }
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
            }
        }
Example #52
0
    public void SetKey(action key, KeyCode keyCode)
    {
        var json = JsonUtility.ToJson(keyCode);

        PlayerPrefs.SetString(KeyName[key], json);
    }
Example #53
0
        /// <summary>
        /// hàm thực hienej phím tắt của form hiện tại
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frm_KCB_DANGKY_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F3)
            {
                if (this.ActiveControl != null && this.ActiveControl.Name == txtTEN_BN.Name && Utility.DoTrim(txtTEN_BN.Text)!="")
                {
                    frm_DSACH_BN_TKIEM Timkiem_Benhnhan = new frm_DSACH_BN_TKIEM();
                    Timkiem_Benhnhan.AutoSearch = true;
                    Timkiem_Benhnhan.FillAndSearchData(false, "", "", Utility.DoTrim(txtTEN_BN.Text), "", "", "-1");
                    if (Timkiem_Benhnhan.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        txtNoiDKKCBBD.Clear();
                        txtNoiphattheBHYT.Clear();
                        isAutoFinding = true;
                        FindPatient(Timkiem_Benhnhan.IdBenhnhan.ToString());
                        isAutoFinding = false;
                    }
                }
                else if (this.ActiveControl != null && this.ActiveControl.Name == txtCMT.Name && Utility.DoTrim(txtCMT.Text) != "")
                {
                    frm_DSACH_BN_TKIEM Timkiem_Benhnhan = new frm_DSACH_BN_TKIEM();
                    Timkiem_Benhnhan.AutoSearch = true;
                    Timkiem_Benhnhan.FillAndSearchData(false, "", "", "", Utility.DoTrim(txtCMT.Text), "", "-1");
                    if (Timkiem_Benhnhan.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        txtNoiDKKCBBD.Clear();
                        txtNoiphattheBHYT.Clear();
                        isAutoFinding = true;
                        FindPatient(Timkiem_Benhnhan.IdBenhnhan.ToString());
                        isAutoFinding = false;
                    }
                }
                else if (this.ActiveControl != null && this.ActiveControl.Name == txtSoDT.Name && Utility.DoTrim(txtSoDT.Text) != "")
                {
                    frm_DSACH_BN_TKIEM Timkiem_Benhnhan = new frm_DSACH_BN_TKIEM();
                    Timkiem_Benhnhan.AutoSearch = true;
                    Timkiem_Benhnhan.FillAndSearchData(false, "", "", "", "", Utility.DoTrim(txtSoDT.Text), "-1");
                    if (Timkiem_Benhnhan.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        txtNoiDKKCBBD.Clear();
                        txtNoiphattheBHYT.Clear();
                        isAutoFinding = true;
                        FindPatient(Timkiem_Benhnhan.IdBenhnhan.ToString());
                        isAutoFinding = false;
                    }
                }
                return;
            }

            if (e.Control && e.KeyCode == Keys.D)
            {

                _MaDoituongKcb = "DV";
                cboDoituongKCB.SelectedIndex = Utility.GetSelectedIndex(cboDoituongKCB, _MaDoituongKcb);
                return;
            }
            if (e.Control && e.KeyCode == Keys.B)
            {
                _MaDoituongKcb = "BHYT";
                cboDoituongKCB.SelectedIndex = Utility.GetSelectedIndex(cboDoituongKCB, _MaDoituongKcb);
                return;
            }
            if (e.Control && (e.KeyCode == Keys.C || e.KeyCode == Keys.P))
            {
                AllowTextChanged = false;
                txtDiachi._Text = txtDiachi_bhyt.Text;
                DiachiBNCu = DiachiBHYTCu;
                AllowTextChanged = true;
                return;
            }

            string ngay_kham = globalVariables.SysDate.ToString("dd/MM/yyyy");
            if (e.Control && e.KeyCode == Keys.K)
            {
                if (!NotPayment(txtMaBN.Text.Trim(), ref ngay_kham))
                {
                    m_enAction = action.Add;
                    SinhMaLanKham();
                    LaydanhsachdangkyKCB();
                    txtKieuKham.Focus();
                }
                else
                {
                    //nếu là ngày hiện tại thì đặt về trạng thái sửa
                    if (ngay_kham == globalVariables.SysDate.ToString("dd/MM/yyyy"))
                    {
                        Utility.ShowMsg(
                            "Bệnh nhân đang có lần khám chưa được thanh toán. Cần thanh toán hết các lần đến khám bệnh của Bệnh nhân trước khi thêm lần khám mới.Nhấn OK để hệ thống quay về trạng thái sửa thông tin BN");
                        m_enAction = action.Update;
                        AllowTextChanged = false;
                        LoadThongtinBenhnhan();
                        LaydanhsachdangkyKCB();
                        txtTEN_BN.Focus();
                    }
                    else //Không cho phép thêm lần khám khác nếu chưa thanh toán lần khám của ngày hôm trước
                    {
                        Utility.ShowMsg(
                            "Bệnh nhân đang có lần khám chưa được thanh toán. Cần thanh toán hết các lần đến khám bệnh của Bệnh nhân trước khi thêm lần khám mới. Nhấn OK để hệ thống chuyển về trạng thái thêm mới Bệnh nhân");
                        cmdThemMoiBN_Click(cmdThemMoiBN, new EventArgs());
                    }
                }
                return;
            }
            if (e.Control && e.KeyCode == Keys.F)
            {
                txtMaBN.SelectAll();
                txtMaBN.Focus();
            }

            if (e.KeyCode == Keys.F10) LoadThongTinChoKham();
            if (e.KeyCode == Keys.F1)
            {
                tabControl1.SelectedTab = tabControl1.TabPages[0];
                return;
            }
            if (e.KeyCode == Keys.F2)
            {
                tabControl1.SelectedTab = tabControl1.TabPages[1];
                return;
            }
            if (e.KeyCode == Keys.F11) Utility.ShowMsg(this.ActiveControl.Name);
            if (e.KeyCode == Keys.F4) cmdInPhieuKham.PerformClick();
            if (e.KeyCode == Keys.Escape && this.ActiveControl != null && this.ActiveControl.GetType()!=txtDantoc.GetType())
            {

                Close();
            }
            if (e.KeyCode == Keys.S && e.Control) cmdSave.PerformClick();
            if (e.KeyCode == Keys.T && e.Control) cmdThanhToanKham.PerformClick();
            // if(e.KeyCode==Keys.P&&e.Control)cmdSaveAndPrint.PerformClick();
            if (e.KeyCode == Keys.N && e.Control) cmdThemMoiBN.PerformClick();
            if (e.KeyCode == Keys.Enter) SendKeys.Send("{TAB}");
        }
Example #54
0
 public bool GetKey(action a)
 {
     return(Input.GetKey(GetKeyCode(a)));
 }
Example #55
0
        private void InsertPatient()
        {
            KcbDanhsachBenhnhan objBenhnhan = CreatePatientInfo();
            objLuotkham = CreatePatientExam();
            KcbDangkyKcb objRegExam = CreateNewRegExam();
            long v_id_kham = -1;
            ActionResult actionResult = _KCB_DANGKY.ThemmoiBenhnhan(objBenhnhan, objLuotkham, objRegExam,
                                                                            Utility.Int32Dbnull(cboKieuKham.Value, -1), ref v_id_kham);

            switch (actionResult)
            {
                case ActionResult.Success:

                    PtramBhytCu = Utility.DecimaltoDbnull(txtPtramBHYT.Text, 0);
                    PtramBhytGocCu = Utility.DecimaltoDbnull(txtptramDauthe.Text, 0);
                    txtMaLankham.Text = Utility.sDbnull(objLuotkham.MaLuotkham);
                    txtMaBN.Text = Utility.sDbnull(objLuotkham.IdBenhnhan);
                    mavuasinh = Utility.sDbnull(objLuotkham.IdBenhnhan);
                    UpdateStatusQMS();
                    m_enAction = action.Update;
                    m_blnHasJustInsert = true;
                    m_strMaluotkham = txtMaLankham.Text;
                    LaydanhsachdangkyKCB();
                    ThemMoiLanKhamVaoLuoi();
                    if (_OnActionSuccess != null) _OnActionSuccess();
                    setMsg(uiStatusBar1.Panels["MSG"], "Bạn thêm mới bệnh nhân thành công", false);
                    Utility.GotoNewRowJanus(grdList, KcbLuotkham.Columns.MaLuotkham, txtMaLankham.Text);
                    Utility.GotoNewRowJanus(grdRegExam, KcbDangkyKcb.Columns.IdKham, v_id_kham.ToString());
                    m_blnCancel = false;
                    if (objRegExam != null)
                    {
                        Utility.GotoNewRowJanus(grdRegExam, KcbDangkyKcb.Columns.IdKham, Utility.sDbnull(objRegExam.IdKham));
                        if (PropertyLib._MayInProperties.InPhieuKCBsaukhiluu && THU_VIEN_CHUNG.Laygiatrithamsohethong("KCB_TIEPDON_INPHIEUKCB", "0", false) == "1")
                        {
                            InPhieu();
                        }
                        else
                        {
                            cmdInPhieuKham.Focus();
                        }
                    }
                    if (Utility.Byte2Bool(objDoituongKCB.TudongThanhtoan)) Thanhtoan(false);
                    cboKieuKham.Text = "CHỌN PHÒNG KHÁM";
                    cboKieuKham.SelectedIndex = -1;
                    txtKieuKham.ClearMe();
                    txtPhongkham.ClearMe();
                    if (PropertyLib._KCBProperties.Tudongthemmoi) cmdThemMoiBN_Click(cmdThemMoiBN, new EventArgs());
                    txtMaBN.Text = Utility.sDbnull(mavuasinh);
                    LoadThongTinChoKham();
                    break;
                case ActionResult.Error:
                    setMsg(uiStatusBar1.Panels["MSG"], "Bạn thực hiện thêm dữ liệu không thành công !", true);
                    cmdSave.Focus();
                    break;
            }
        }
Example #56
0
 RunClient(action, stream, shmid, ctl, st, Int32.Parse(pid), Boolean.Parse(initial));
Example #57
0
        private void AutoFindLastExamandFetchIntoControls(string patientID, string sobhyt)
        {
            try
            {
                if (!Utility.CheckLockObject(m_strMaluotkham, "Tiếp đón", "TD"))
                    return;
                //Trả lại mã lượt khám nếu chưa được dùng đến
                new Update(KcbDmucLuotkham.Schema)
                       .Set(KcbDmucLuotkham.Columns.TrangThai).EqualTo(0)
                       .Set(KcbDmucLuotkham.Columns.UsedBy).EqualTo(DBNull.Value)
                       .Set(KcbDmucLuotkham.Columns.StartTime).EqualTo(DBNull.Value)
                       .Set(KcbDmucLuotkham.Columns.EndTime).EqualTo(null)
                       .Where(KcbDmucLuotkham.Columns.MaLuotkham).IsEqualTo(Utility.Int32Dbnull(m_strMaluotkham, "-1"))
                       .And(KcbDmucLuotkham.Columns.TrangThai).IsEqualTo(1)
                       .And(KcbDmucLuotkham.Columns.UsedBy).IsEqualTo(globalVariables.UserName)
                       .And(KcbDmucLuotkham.Columns.Nam).IsEqualTo(globalVariables.SysDate.Year).Execute();
                ;

                SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema)
                    .Where(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(patientID);
                if (!string.IsNullOrEmpty(sobhyt))
                {
                    sqlQuery.And(KcbLuotkham.Columns.MatheBhyt).IsEqualTo(sobhyt);
                }
                sqlQuery.OrderDesc(KcbLuotkham.Columns.NgayTiepdon);

                var objLuotkham = sqlQuery.ExecuteSingle<KcbLuotkham>();
                if (objLuotkham != null)
                {
                    txtMaBN.Text = patientID;
                    txtMaLankham.Text = Utility.sDbnull(objLuotkham.MaLuotkham);
                    m_strMaluotkham = objLuotkham.MaLuotkham;
                    m_enAction = action.Update;
                    AllowTextChanged = false;
                    LoadThongtinBenhnhan();
                    CanhbaoInphoi();
                    LaydanhsachdangkyKCB();
                    string ngay_kham = globalVariables.SysDate.ToString("dd/MM/yyyy");
                    if (!NotPayment(txtMaBN.Text.Trim(), ref ngay_kham))//Đã thanh toán-->Kiểm tra ngày hẹn xem có được phép khám tiếp
                    {

                        KcbChandoanKetluan _Info = new Select().From(KcbChandoanKetluan.Schema).Where(KcbChandoanKetluan.MaLuotkhamColumn).IsEqualTo(objLuotkham.MaLuotkham).ExecuteSingle<KcbChandoanKetluan>();
                        if (_Info != null && _Info.SongayDieutri != null)
                        {
                            int SoNgayDieuTri = 0;
                            if (_Info.SongayDieutri.Value.ToString() == "")
                            {
                                SoNgayDieuTri = 0;
                            }
                            else
                            {
                                SoNgayDieuTri = _Info.SongayDieutri.Value;
                            }
                            DateTime ngaykhamcu = _Info.NgayTao.Value; ;
                            DateTime ngaykhammoi = globalVariables.SysDate;
                            TimeSpan songay = ngaykhammoi - ngaykhamcu;

                            int kt = songay.Days;
                            int kt1 = SoNgayDieuTri - kt;
                            kt1 = Utility.Int32Dbnull(kt1);
                            // nếu khoảng cách từ lần khám trước đến ngày hiện tại lớn hơn ngày điều trị.
                            if (kt >= SoNgayDieuTri)
                            {
                                m_enAction = action.Add;
                                SinhMaLanKham();
                                //txtTongChiPhiKham.Text = "0";
                                m_dataDataRegExam.Rows.Clear();
                                txtKieuKham.Select();
                            }
                            else if (kt < SoNgayDieuTri)
                            {
                                DialogResult dialogResult =
                                    MessageBox.Show(
                                        "Bác Sỹ hẹn :  " + SoNgayDieuTri + "ngày" + "\nNgày khám gần nhất:  " +
                                        ngaykhamcu + "\nCòn: " + kt1 + " ngày nữa mới được tái khám" +
                                        "\nBạn có muốn tiếp tục thêm lần khám ", "Thông Báo", MessageBoxButtons.YesNo);

                                if (dialogResult == DialogResult.Yes)
                                {
                                    m_enAction = action.Add;
                                    SinhMaLanKham();
                                    //Reset dịch vụ KCB
                                    //txtTongChiPhiKham.Text = "0";
                                    m_dataDataRegExam.Rows.Clear();
                                    txtKieuKham.Select();
                                }
                                else if (dialogResult == DialogResult.No)
                                {
                                    ClearControl();
                                    return;
                                }
                            }
                        }
                        else//Chưa thăm khám-->Để nguyên trạng thái cập nhật
                        {
                        }
                    }
                    else//Còn lần khám chưa thanh toán-->Kiểm tra
                    {
                        //nếu là ngày hiện tại thì đặt về trạng thái sửa
                        if (ngay_kham == "NOREG" || ngay_kham == globalVariables.SysDate.ToString("dd/MM/yyyy"))
                        {
                            //LoadThongtinBenhnhan();
                            if (ngay_kham == "NOREG")//Bn chưa đăng ký phòng khám nào cả.
                            {
                                //Nếu ngày hệ thống=Ngày đăng ký gần nhất-->Sửa
                                if (globalVariables.SysDate.ToString("dd/MM/yyyy") == dtpInputDate.Value.ToString("dd/MM/yyyy"))
                                {
                                    m_enAction = action.Update;

                                    Utility.ShowMsg(
                                       "Bệnh nhân vừa được đăng ký ngày hôm nay nên hệ thống sẽ chuyển về chế độ Sửa thông tin. Nhấn OK để bắt đầu sửa");
                                    //LaydanhsachdangkyKCB();
                                    txtTEN_BN.Select();
                                }
                                else//Thêm lần khám cho ngày mới
                                {
                                    m_enAction = action.Add;
                                    SinhMaLanKham();
                                    //Reset dịch vụ KCB
                                    //txtTongChiPhiKham.Text = "0";
                                    m_dataDataRegExam.Rows.Clear();
                                    txtKieuKham.Select();
                                }
                            }
                            else//Quay về trạng thái sửa
                            {
                                m_enAction = action.Update;

                                Utility.ShowMsg(
                                   "Bệnh nhân vừa được đăng ký ngày hôm nay nên hệ thống sẽ chuyển về chế độ Sửa thông tin. Nhấn OK để bắt đầu sửa");
                                //LaydanhsachdangkyKCB();
                                txtTEN_BN.Select();
                            }
                        }
                        else //Không cho phép thêm lần khám khác nếu chưa thanh toán lần khám của ngày hôm trước
                        {
                            Utility.ShowMsg(
                                "Bệnh nhân đang có lần khám chưa được thanh toán. Cần thanh toán hết các lần đến khám bệnh của Bệnh nhân trước khi thêm lần khám mới. Nhấn OK để hệ thống chuyển về trạng thái thêm mới Bệnh nhân");
                            cmdThemMoiBN_Click(cmdThemMoiBN, new EventArgs());
                        }
                    }
                    StatusControl();

                    ModifyCommand();
                    txtKieuKham.SetCode("-1");
                    txtPhongkham.SetCode("-1");
                    if (PropertyLib._KCBProperties.GoMaDvu)
                    {
                        txtExamtypeCode.SelectAll();
                        txtExamtypeCode.Focus();
                    }
                    else
                    {
                        txtKieuKham.SelectAll();
                        txtKieuKham.Focus();
                    }
                }
                else
                {
                    Utility.ShowMsg(
                        "Bệnh nhân này chưa có lần khám nào-->Có thể bị lỗi dữ liệu. Đề nghị liên hệ với VNS để được giải đáp");
                }
            }
            catch (Exception ex)
            {
                Utility.ShowMsg("AutoFindLastExam().Exception-->" + ex.Message);
            }
            finally
            {
                SetActionStatus();
                AllowTextChanged = true;
            }
        }
Example #58
0
 public GUIButton(Rectangle rectangle, string text, action clickAction, bool visible = false) : base(rectangle, visible)
 {
     this.text        = text;
     this.clickAction = clickAction;
 }
        private void UpdatePhieuXuatKho()
        {
            TPhieuNhapxuatthuoc objPhieuNhap = CreatePhieuNhapKho();

            ActionResult actionResult = new XuatThuoc().UpdatePhieuXuatKho(objPhieuNhap, CreateArrPhieuChiTiet());
            switch (actionResult)
            {
                case ActionResult.Success:
                    TPhieuNhapxuatthuoc objPhieu = TPhieuNhapxuatthuoc.FetchByID(Utility.Int32Dbnull(txtIDPhieuNhapKho.Text));
                    DataRow[] arrDr =
                        p_mDataPhieuNhapKho.Select(string.Format("{0}={1}", TPhieuNhapxuatthuoc.Columns.IdPhieu,
                                                                 Utility.Int32Dbnull(txtIDPhieuNhapKho.Text)));
                    if (arrDr.GetLength(0) > 0)
                    {
                        arrDr[0].Delete();
                    }
                    DataRow newDr = p_mDataPhieuNhapKho.NewRow();
                    Utility.FromObjectToDatarow(objPhieu, ref newDr);
                    TDmucKho objKho = TDmucKho.FetchByID(Utility.Int32Dbnull(cboKhohuy.SelectedValue, -1));
                    if (objKho != null)
                        newDr["ten_khoxuat"] = Utility.sDbnull(objKho.TenKho);
                    p_mDataPhieuNhapKho.Rows.Add(newDr);

                    Utility.GonewRowJanus(grdList, TPhieuNhapxuatthuoc.Columns.IdPhieu, Utility.sDbnull(txtIDPhieuNhapKho.Text));
                    //Utility.ShowMsg("Bạn sửa  phiếu thành công", "Thông báo");
                    m_enAction = action.Insert;
                    this.Close();
                    b_Cancel = true;
                    break;
                case ActionResult.Error:
                    Utility.ShowMsg("Lỗi trong quá trình sửa phiếu", "Thông báo lỗi", MessageBoxIcon.Error);
                    break;
            }
        }
Example #60
0
    // Update is called once per frame
    void Update()
    {
        switch (curr_action)
        {
        case action.wait:
            break;

        case action.card_select_target:
            state_text.gameObject.SetActive(true);
            state_text.text = "Choose a target";

            if (turn_info.turn != turn_type.strategy)
            {
                state_text.gameObject.SetActive(false);

                curr_action = action.wait;
            }

            break;

        case action.card_target_selected:
        {
            if (turn_info.turn != turn_type.strategy)
            {
                state_text.gameObject.SetActive(false);
                break;
            }

            Player client = GetClientPlayer().GetComponent <Player>();
            CardUseSend(last_clicked_card, (int)client.GetNavigationEntity().GetGridPos().x, (int)client.GetNavigationEntity().GetGridPos().y, client.GetInstanceID().ToString(), target.GetNetworkId().ToString());

            state_text.gameObject.SetActive(false);

            curr_action = action.wait;
        }
        break;

        case action.check_if_all_players_finished_moving:
        {
            if (turn_info.turn == turn_type.action && players_ready_perform_actions == players.Count)
            {
                bool can_perform = true;

                for (int i = 0; i < players.Count; i++)
                {
                    Player player = players[i].GetComponent <Player>();

                    if (player.IsMoving())
                    {
                        can_perform = false;
                    }
                }

                if (can_perform)
                {
                    curr_action = action.perform_attacks;
                }
            }
        }
        break;

        case action.perform_attacks:
        {
            players_ready_perform_actions = 0;

            for (int i = 0; i < players.Count; i++)
            {
                Player player = players[i].GetComponent <Player>();

                // Attack
                if (player.GetAttack())
                {
                    player.Attack();
                }

                // SetStealth
                if (player.GetStealth())
                {
                    if (player.GetVisible())
                    {
                        player.GainStealth();
                    }
                }
                else
                {
                    if (!player.GetVisible())
                    {
                        player.LoseStealth();
                    }
                }
            }

            for (int i = 0; i < cards_to_attack.Count; i++)
            {
                Player.Card card = cards_to_attack[i];
                card.GetOwner().UseCard(card.GetName(), card.GetTarget());
            }
            cards_to_attack.Clear();

            curr_action = action.wait;
        }
        break;

        case action.client_die:
        {
            finish_player_turn.gameObject.SetActive(false);
            attack_button.gameObject.SetActive(false);
            nav_map.DeleteMarker();

            curr_action = action.wait;
        }
        break;
        }

        DecreaseTurnTime();
    }