Esempio n. 1
0
 void myAdd(Num x)
 {
     if (expression.Text == "0")
         expression.Text = x.GetNum.ToString();
     else
         expression.Text = expression.Text + x.GetNum.ToString();
 }//操作数
Esempio n. 2
0
 private void one_Click(object sender, RoutedEventArgs e)
 {
     Num one = new Num();
     one.GetNum = 1;
     myAdd(one);
 }
Esempio n. 3
0
 private void zero_Click(object sender, RoutedEventArgs e)
 {
     Num zero = new Num();
     zero.GetNum = 0;
     myAdd(zero);
 }
Esempio n. 4
0
 private void eight_Click(object sender, RoutedEventArgs e)
 {
     Num eight = new Num();
     eight.GetNum = 8;
     myAdd(eight);
 }
Esempio n. 5
0
 private void six_Click(object sender, RoutedEventArgs e)
 {
     Num six = new Num();
     six.GetNum = 6;
     myAdd(six);
 }
Esempio n. 6
0
 private void four_Click(object sender, RoutedEventArgs e)
 {
     Num four = new Num();
     four.GetNum = 4;
     myAdd(four);
 }
		// Buffer a term in bufferedDeleteTerms, which records the
		// current number of documents buffered in ram so that the
		// delete term will be applied to those documents as well
		// as the disk segments.
		private void  AddDeleteTerm(Term term, int docCount)
		{
			lock (this)
			{
				Num num = (Num) bufferedDeleteTerms[term];
				if (num == null)
				{
					bufferedDeleteTerms[term] = new Num(docCount);
					// This is coarse approximation of actual bytes used:
					numBytesUsed += (term.Field().Length + term.Text().Length) * BYTES_PER_CHAR + 4 + 5 * OBJECT_HEADER_BYTES + 5 * OBJECT_POINTER_BYTES;
					if (ramBufferSize != IndexWriter.DISABLE_AUTO_FLUSH && numBytesUsed > ramBufferSize)
					{
						bufferIsFull = true;
					}
				}
				else
				{
					num.SetNum(docCount);
				}
				numBufferedDeleteTerms++;
			}
		}
        private cSnCodeSet DataFrmToClass()
        {
            cSnCodeSet tmpSnCodeSet = new cSnCodeSet();

            try
            {
                tmpSnCodeSet.FengSu = -1;
                if (cbbMachine.SelectedIndex == 1)
                {
                    switch (cbbFengSu.Text)
                    {
                    case "室内风机关":
                        tmpSnCodeSet.FengSu = 0;
                        break;

                    case "高风":
                        tmpSnCodeSet.FengSu = 1;
                        break;

                    case "中风":
                        tmpSnCodeSet.FengSu = 2;
                        break;

                    case "低风":
                        tmpSnCodeSet.FengSu = 3;
                        break;
                    }
                }
                if (cbbMachine.SelectedIndex == 5)
                {
                    if (cbbFengSu.Text == "高风(双风机)")
                    {
                        tmpSnCodeSet.FengSu = 0;
                    }
                    if (cbbFengSu.Text == "低风(风机1)")
                    {
                        tmpSnCodeSet.FengSu = 1;
                    }
                    if (cbbFengSu.Text == "低风(风机2)")
                    {
                        tmpSnCodeSet.FengSu = 2;
                    }
                    if (cbbFengSu.Text == "风机关")
                    {
                        tmpSnCodeSet.FengSu = 3;
                    }
                }
                tmpSnCodeSet.IsDanLen   = chkDanLen.Checked;
                tmpSnCodeSet.IsKuaiJian = chkKuaiJian.Checked;
                tmpSnCodeSet.MoShi      = -1;
                if (cbbMoshi.Text == "停机")
                {
                    tmpSnCodeSet.MoShi = 0;
                }
                if (cbbMoshi.Text == "制冷")
                {
                    tmpSnCodeSet.MoShi = 1;
                }
                if (cbbMoshi.Text == "制热")
                {
                    tmpSnCodeSet.MoShi = 2;
                }
                if (cbbMoshi.Text == "送风")
                {
                    tmpSnCodeSet.MoShi = 3;
                }
                tmpSnCodeSet.NeiJiNeng = -1;
                if (cbbMachine.SelectedIndex == 2)
                {
                    if (cbbNengJi.Text == "0.8匹(22机)")
                    {
                        tmpSnCodeSet.NeiJiNeng = 0;
                    }
                    if (cbbNengJi.Text == "1匹(25,26,28机)")
                    {
                        tmpSnCodeSet.NeiJiNeng = 1;
                    }
                    if (cbbNengJi.Text == "1.2匹(32机)")
                    {
                        tmpSnCodeSet.NeiJiNeng = 2;
                    }
                    if (cbbNengJi.Text == "1.5匹(35机)")
                    {
                        tmpSnCodeSet.NeiJiNeng = 3;
                    }
                }
                tmpSnCodeSet.NengLi = Num.IntParse(txtNengLi.Text);
                tmpSnCodeSet.PinLv  = Num.IntParse(txtPinLv.Text);
            }
            catch (Exception exc)
            {
                cMain.WriteErrorToLog("frmMideaSn:DataFrmToClass:" + exc.Message);
            }
            return(tmpSnCodeSet);
        }
Esempio n. 9
0
 public override bool IsNull() => Num.Equals(new T());
Esempio n. 10
0
 public override T1 Negative <T1>()
 {
     return((T1)(INegatable) new Rational <T>(Num.Negative <T>(), Den));
 }
Esempio n. 11
0
 internal class RectPointValueInterpolationHelper : ValueInterpolationHelper <RectPoint> { protected override RectPoint InterpolateCore(RectPoint start, RectPoint end, double progress) => new RectPoint(Num.Interpolate(start.XProgress, end.XProgress, progress), Num.Interpolate(start.YProgress, end.YProgress, progress)); }
Esempio n. 12
0
        public NewprocessesViewModel()
        {
            back = new Command(() => {
                Ico.getValue <ContentApp>().back();
            });

            save = new Command(async() => {
                erour = new List <string>();
                if (Name.ToString().Length == 0)
                {
                    erour.Add("الرجاء كتابة إسم العملية ");
                }
                if (Code.ToString().Length != 15)
                {
                    erour.Add(" كود العملية  يجب أن يحتوي على 15 حرف");
                }
                if (Num.ToString().Length == 0)
                {
                    erour.Add("الرجاء كتابة رقم الثابت للعملية ");
                }
                else
                {
                    string pattern = "[1-9]+/[1-9]+";
                    Regex rgx      = new Regex(pattern);
                    if (!rgx.IsMatch(Num.ToString()))
                    {
                        erour.Add("الرجاء كتابة رقم الثابت بشكل الصحيح ##/##   ");
                    }
                }



                if (erour.Count == 0)
                {
                    AcceptSample4Dialog();

                    await Task.Run(() =>
                    {
                        double totalCoast = 0;
                        var p             = new process()
                        {
                            Name     = Name,
                            date     = date,
                            Code     = Code,
                            num      = Num,
                            NewCost  = totalCoast,
                            location = Ico.getValue <IO>().CREATE_F_PRO(Code),
                            edit     = true
                        };
                        Ico.getValue <db>().GetUnivdb().processes.Add(p);
                        Ico.getValue <db>().GetUnivdb().SaveChanges();
                        CancelSample4Dialog();
                    });

                    Ico.getValue <ContentApp>().back();
                    Ico.getValue <ContentApp>().clear();
                }
                else
                {
                    OpenSample4Dialog();
                    Sample4Content = new Messagebox(erour, () => {
                        CancelSample4Dialog();
                    });
                }
            });
        }
Esempio n. 13
0
 public MoreItemDamageModifier(Num amount) : base(amount)
 {
 }
Esempio n. 14
0
 public MoreDamageModifier(Num amount)
 {
     Amount = amount;
 }
Esempio n. 15
0
 void Visit(Num num)
 {
 }
Esempio n. 16
0
		public static int Bytes(Num num)
		{
			return (num == Num._64) ? sizeof(UInt64) : sizeof(UInt32);
		}
Esempio n. 17
0
 /// <summary>
 /// Clamps the value between its min and max
 /// </summary>
 /// <param name="n">Value to clamp</param>
 private static Num Clamp(Num n)
 {
     if (n.value > maxValue)
     {
         return n - 1000;
     }
     if (n.value < minValue)
     {
         return n + 1000;
     }
     return n;
 }
Esempio n. 18
0
 public override bool IsUnit() => Num.Equals(Den);
Esempio n. 19
0
		// Buffer a term in bufferedDeleteTerms, which records the
		// current number of documents buffered in ram so that the
		// delete term will be applied to those ram segments as
		// well as the disk segments.
		private void  BufferDeleteTerm(Term term)
		{
			Num num = (Num) bufferedDeleteTerms[term];
			if (num == null)
			{
				bufferedDeleteTerms[term] = new Num(this, ramSegmentInfos.Count);
			}
			else
			{
				num.SetNum(ramSegmentInfos.Count);
			}
			numBufferedDeleteTerms++;
		}
Esempio n. 20
0
 public abstract int VisitNum(Num num);
Esempio n. 21
0
 private void three_Click(object sender, RoutedEventArgs e)
 {
     Num three = new Num();
     three.GetNum = 3;
     myAdd(three);
 }
Esempio n. 22
0
 static void Update(Num y)
 {
     y.i = 20;
 }
Esempio n. 23
0
 private void five_Click(object sender, RoutedEventArgs e)
 {
     Num five = new Num();
     five.GetNum = 5;
     myAdd(five);
 }
Esempio n. 24
0
        /// <summary>
        /// 신용카드 승인
        /// </summary>
        private void fnPay120_Reg()
        {
            try
            {
                int amt = int.Parse(Basic.MaskReplace(txtCreditAmt.Text.Trim()));


                /*if(this.txtCreditCardNo.Text.Trim().Length < 13)
                 * {
                 *
                 *  Basic.ShowMessage(1, "카드번호를 정확하게 입력하여 주십시요.");
                 *  txtCreditCardNo.Focus();
                 *  return;
                 * }
                 * else */if (amt <= 0)
                {
                    Basic.ShowMessage(1, "결제금액을 입력하여 주십시요.");
                    txtCreditAmt.Focus();
                    return;
                }
                else if (Basic.MaskReplace(Num.GetNumberOnly(PayInfomation.RoomInfo.C_Facipart)) + Basic.MaskReplace(Num.GetNumberOnly(PayInfomation.RoomInfo.C_RoomNo)).Trim() == "")
                {
                    Basic.ShowMessage(2, "Bill 번호를 생성 할 수 없습니다.\n\r\n\r동코드:" + PayInfomation.RoomInfo.C_Facipart + "\r\n객실번호:" + PayInfomation.RoomInfo.C_RoomNo);
                    return;
                }


                //객실이 마감되었는지 체크한다.
                bool IsClose = BizCommon.Gneral_D.IsRoomClose();
                if (PayInfo.useKind == UseKind.Room && IsClose)
                {
                    Basic.ShowMessage(1, "현재 마감작업중입니다. \n\r마감이 끝난후 작업을 계속하십시요");
                    return;
                }


                string SendCardNo = "";
                _TrackTowInfo = "";

                /* if(txtCreditCardNo.Text.Trim().IndexOf("=") < 0)
                 * {
                 *
                 *   SendCardNo = txtCreditCardNo.Text.Trim();
                 *
                 *   if(  this.txtCreditCardScope.Text.Trim() == "" &&
                 *           this.txtCreditCardNo.Text.Trim().IndexOf("=") < 0  )
                 *       {
                 *           Basic.ShowMessage(1, "키인 입력입니다 - 유효기간을 입력하세요.");
                 *           txtCreditCardScope.Focus();
                 *           return;
                 *       }
                 *
                 * }
                 * else
                 * {
                 *   if (txtCreditCardNo.Text.ToUpper().StartsWith("C"))
                 *       txtCreditCardNo.Text = txtCreditCardNo.Text.Remove(0, 1);
                 *   _TrackTowInfo = txtCreditCardNo.Text.Trim();
                 *   SendCardNo = txtCreditCardNo.Text.Trim();
                 *
                 *   string str1 = this.txtCreditCardNo.Text.Trim().Split('=')[0];
                 *   string str2 = this.txtCreditCardNo.Text.Trim().Split('=')[1];
                 *
                 *   this.txtCreditCardNo.Text = str1;
                 *
                 *   if(str2.Trim().Length < 4)
                 *   {
                 *       Basic.ShowMessage(1, "MSR 입력 - 카드번호가 잘못되었습니다.");
                 *       return;
                 *   }
                 *   string strscope = str2.Trim().Substring(0,4);
                 *   this.txtCreditCardScope.EditValue   = strscope ;
                 *
                 * }
                 */
                //유효기간
                string scope = Basic.MaskReplace(txtCreditCardScope.Text.Trim());

                if (scope.Length < 4)
                {
                    scope = "9999";
                }



                #region 서명모드
                /******************************************************************************/
                // 싸인패드가 체크 되어 있다면 서명모드 시작
                /******************************************************************************/

                byte[] b = null;
                string SignDataString = "";

                /*
                 * Van.RecivedData rvcSign = new RecivedData();
                 * bool  IsSucess = true;
                 * if(this.chkCreditSignPad.Checked)
                 * {
                 *  using(BizVanComunication bizVan = new BizVanComunication())
                 *  {
                 *
                 *      string reqdatas = bizVan.GetVanMakeCardProtocol( "PROJECT_D" ,
                 *                                                        JobKind.RegCard,
                 *                                                        CashKind.None,
                 *                                                        SendCardNo ,
                 *                                                        scope,
                 *                                                        Basic.MaskReplace(txtCreditAmtSplit.Text.Trim()),
                 *                                                        Basic.MaskReplace(txtCreditAmt.Text.Trim()) ,
                 *                                                        "1" ,
                 *                                                        "","","", CashGbn.None );
                 *
                 *
                 *      IsSucess =  bizVan.GetSign( "PROJECT_D",
                 *                                  int.Parse(Basic.MaskReplace(txtCreditAmt.Text.Trim())) ,
                 *                                  ref rvcSign,
                 *                                  reqdatas);
                 *      bizVan.Dispose();
                 *  }
                 *
                 * }
                 * if(!IsSucess) return;
                 */
                /******************************************************************************/
                // 서명모드 종료
                /******************************************************************************/
                #endregion

                /*
                 * SignDataString = rvcSign.SignStringData;
                 * b = rvcSign.SignData;
                 */
                //카드승인처리 시작
                /***********************************************************************************************************************************************/

                Van.RecivedData reqdata = new RecivedData();

                /*
                 * if(rvcSign.IsSignPadAgree)
                 * {
                 *  reqdata = rvcSign;
                 *  if(reqdata.IsAgreeError)
                 *  {
                 *      MessageBox.Show(reqdata.Message);
                 *      return;
                 *  }
                 * }
                 * else
                 *
                 */
                {
                    using (BizVanComunication bizAgree = new BizVanComunication())
                    {
                        reqdata = bizAgree.SendData("PROJECT_D",
                                                    JobKind.RegCard,
                                                    CashKind.None,
                                                    SendCardNo,
                                                    scope,
                                                    Basic.MaskReplace(txtCreditAmtSplit.Text.Trim()),
                                                    Basic.MaskReplace(txtCreditAmt.Text.Trim()),
                                                    "1",
                                                    SignDataString, "", "", CashGbn.None);


                        bizAgree.Dispose();
                    }

                    /***********************************************************************************************************************************************/

                    if (reqdata.IsAgreeError)
                    {
                        MessageBox.Show(reqdata.Message);
                        return;
                    }
                }

                this.Cursor = Cursors.WaitCursor;
                // 승인이 났다.
                //DB처리
                string AgreeDate = reqdata.AgreeDate.Substring(0, 4) + "-" +
                                   reqdata.AgreeDate.Substring(4, 2) + "-" +
                                   reqdata.AgreeDate.Substring(6, 2);

                AgreeDate = DateTime.Parse(AgreeDate).ToString("yyyyMMdd");

                string outSeq = "";

                string v_ret = fn_Card(Basic.MaskReplace(txtCreditAmt.Text.Trim()),
                                       //     txtCreditCardNo.Text.Trim(),
                                       Basic.MaskReplace(reqdata.CashRegNumber),
                                       Basic.MaskReplace(scope),
                                       reqdata.CardCoCode,
                                       reqdata.CardCoName,
                                       reqdata.ISSUCoCode,
                                       reqdata.ISSUCoName,
                                       reqdata.CardJoinNo,
                                       reqdata.AgreeNo,
                                       this.txtCreditAmtSplit.Text.Trim() == "" ? "0" : this.txtCreditAmtSplit.Text.Trim(),
                                       AgreeDate,
                                       reqdata.AgreeDate.Length > 6 ? reqdata.AgreeDate.Substring(6, 4) : DateTime.Now.ToString("hhmm"),
                                       _TrackTowInfo,
                                       "N",
                                       Parm.CurrentUserInformation.roomTask.gsCardTerminalID,
                                       Parm.CurrentUserInformation.id,
                                       ref outSeq);

                //DB 처리에러시 취소승인을
                //딴다.
                if (v_ret != "OK")
                {
                    Van.RecivedData reqdataCancel = new RecivedData();

                    using (BizVanComunication bizAgree = new BizVanComunication())
                    {
                        reqdataCancel = bizAgree.SendData("PROJECT_D",
                                                          JobKind.CancelCard,
                                                          CashKind.None,
                                                          _TrackTowInfo,
                                                          scope,
                                                          Basic.MaskReplace(txtCreditAmtSplit.Text.Trim()),
                                                          Basic.MaskReplace(txtCreditAmt.Text.Trim()),
                                                          "",
                                                          "",
                                                          reqdata.AgreeNo,
                                                          reqdata.AgreeDate.Substring(0, 6),
                                                          CashGbn.None);

                        bizAgree.Dispose();
                    }


                    /***********************************************************************************************************************************************/


                    if (reqdataCancel.IsAgreeError)
                    {
                        Basic.ShowMessage(3, "승인 후 DB 저장시 에러 입니다." + System.Environment.NewLine +
                                          "승인번호는 : " + reqdata.AgreeNo + " 입니다." + System.Environment.NewLine +
                                          "현재 내용을 CTL + C 로 복사하여 메모장에 붙여 넣으세요 - 붙여넣으신 내용으로 전산실에 문의하세요" + System.Environment.NewLine +
                                          "전산실에 문의하여 수기로 승인 취소를 하십시요" + System.Environment.NewLine + System.Environment.NewLine +
                                          "승인취소 에러 내용" + System.Environment.NewLine +
                                          reqdata.Message + System.Environment.NewLine + System.Environment.NewLine +
                                          "DB 처리 에러내용 :" + System.Environment.NewLine +
                                          v_ret);

                        Van.Log.Log.SaveLog("[승인후 DB 저장에러 - 승인취소실패] 에러내용 -  " + reqdataCancel.Message);
                        Van.Log.Log.SaveLog("[승인후 DB 저장에러 - 승인취소실패] 취소전문 - $" + reqdataCancel.FullSendData + "$");
                        return;
                    }

                    Basic.ShowMessage(2, v_ret);
                    return;
                }

                //메인데이터가 들어갔다면 싸인데이터도 넣어준다.
                //싸인데이터가 있다면

                if (b != null)
                {
                    string Query = @"INSERT INTO IAA030DT(
                                                         SALE_DATE     , 
                                                         BIZ_CODE      , 
                                                         FACILITY_CODE , 
                                                         POS_NO        , 
                                                         BILL_NO       , 
                                                         SALE_YN       , 
                                                         PAY_SEQ       , 
                                                         SIGN_IMG      , 
                                                         U_EMP_NO      , 
                                                         U_IP         
                                                    ) VALUES (
                                                                   :V_SALE_DATE     , 
                                                                   :V_BIZ_CODE      , 
                                                                   :V_FACILITY_CODE , 
                                                                   :V_POS_NO        , 
                                                                   :V_BILL_NO       , 
                                                                   :V_SALE_YN       , 
                                                                   :V_PAY_SEQ       , 
                                                                   :V_SIGN_IMG      , 
                                                                   :V_U_EMP_NO      , 
                                                                   :V_U_IP         
                                                               )";

                    DataTable dtParm = DataLayer.GetDataTableParameter(DataLayer.DatatableStyle.Parameter);
                    dtParm.Rows.Add(":V_SALE_DATE", PayInfomation.SaleDate);
                    dtParm.Rows.Add(":V_BIZ_CODE", PayInfomation.RoomInfo.C_Bizcode);
                    dtParm.Rows.Add(":V_FACILITY_CODE", PayInfomation.RoomInfo.C_Facilitycode);
                    dtParm.Rows.Add(":V_POS_NO", "01");
                    dtParm.Rows.Add(":V_BILL_NO", Basic.MaskReplace(Num.GetNumberOnly(PayInfomation.RoomInfo.C_Facipart)) + Basic.MaskReplace(Num.GetNumberOnly(PayInfomation.RoomInfo.C_RoomNo)));
                    dtParm.Rows.Add(":V_SALE_YN", "Y");
                    dtParm.Rows.Add(":V_PAY_SEQ", outSeq);
                    dtParm.Rows.Add(":V_SIGN_IMG", "#");
                    dtParm.Rows.Add(":V_U_EMP_NO", Parm.CurrentUserInformation.id);
                    dtParm.Rows.Add(":V_U_IP", Parm.CurrentUserInformation.ip);


                    //bill_Print_Card();

                    try
                    {
                        int ret = DataLayer.ExecuteNonQuery(Query, dtParm, b, DataLayer.MessageEncoding.Default);
                    }
                    catch (Exception ex)
                    {
                        Basic.ShowMessage(2, "카드승인은 정상승인 처리되었으며 자료도 정상저장 되었습니다. \n\r싸인 이미지만 DB 에 저장하지 못했습니다.\n\r" + ex.Message);
                    }

                    try
                    {
                        string _strBillNo = Basic.MaskReplace(Num.GetNumberOnly(PayInfomation.RoomInfo.C_Facipart)) + Basic.MaskReplace(Num.GetNumberOnly(PayInfomation.RoomInfo.C_RoomNo));
                        bill_Print_Card(outSeq, _strBillNo);
                    }
                    catch (Exception ex)
                    {
                        Basic.ShowMessage(2, "영수증 출력중 에러!");
                    }
                }
                else     // 사인데이터가 없어도 영수증 출력은 해준다로 변경함. (2015.07.15 정수환)
                {
                    string _strBillNo = Basic.MaskReplace(Num.GetNumberOnly(PayInfomation.RoomInfo.C_Facipart)) + Basic.MaskReplace(Num.GetNumberOnly(PayInfomation.RoomInfo.C_RoomNo));
                    bill_Print_Card(outSeq, _strBillNo);
                }

                Basic.ShowMessage(1, "저장 하였습니다.");


                txtCreditCardNo.Text    = "";
                txtCreditCardScope.Text = "";
                txtCreditAmtSplit.Text  = "0";
                txtCreditAmt.Text       = "0";
                _TrackTowInfo           = "";
                RaiseDataReflashEvent(true);
            }
            catch (Exception ex)
            {
                Basic.ShowMessage(3, ex.Message);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Esempio n. 25
0
 private void seven_Click(object sender, RoutedEventArgs e)
 {
     Num seven = new Num();
     seven.GetNum = 7;
     myAdd(seven);
 }
Esempio n. 26
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            string sqlStr   = "select * from Alldata where";
            string NeedStr1 = "";
            string NeedStr2 = "";
            string OrderStr = " order by bar,TestTime,TestNo,StepId";

            if (rbbTime.Checked)
            {
                NeedStr1 = string.Format(" TestTime between #{0} 00:00:01# and #{1} 23:59:59#", dateTimePicker1.Text, dateTimePicker2.Text);
            }
            if (rbbBar.Checked)
            {
                if (txtBar.Text.IndexOf("'") >= 0)
                {
                    MessageBox.Show("请不要输入非法字符", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                NeedStr1 = string.Format(" bar like '%{0}%'", txtBar.Text);
            }
            if (rbbMode.Checked)
            {
                NeedStr1 = string.Format(" mode like '%{0}%'", cbbMode.Text);
            }
            if (rbbNo.Checked)
            {
                NeedStr1 = string.Format(" testNo={0}", Num.IntParse(txtNo.Text));
            }
            IEnumerator ie = panel4.Controls.GetEnumerator();

            while (ie.MoveNext())
            {
                CheckBox cb    = (CheckBox)ie.Current;
                int      index = Num.IntParse(cb.Tag);
                if (index >= 0)
                {
                    if (cb.Checked)
                    {
                        NeedStr2 = NeedStr2 + " and b" + cb.Tag.ToString() + "=false";
                    }
                }
                else
                {
                    if (index == -2 && checkBox1.Checked)
                    {
                        NeedStr2 = NeedStr2 + " and isPass='******'";
                    }
                    if (index == -1 && checkBox2.Checked)
                    {
                        NeedStr2 = NeedStr2 + " and isPass='******'";
                    }
                }
            }
            sqlStr       = sqlStr + NeedStr1 + NeedStr2 + OrderStr;
            SqlSearchStr = sqlStr;
            dsSearch     = null;
            dsShow       = null;
            dsSearch     = cData.readData(sqlStr, cData.ConnData);
            dsShow       = cData.readData(sqlStr, cData.ConnData);
            initDataset();
            dtSource = dsShow.Tables[0];
            getFillDateset();
            btnFirst.Enabled = false;
            btnPre.Enabled   = false;
            btnNex.Enabled   = true;
            btnLast.Enabled  = true;
            for (int i = 0; i < dataGridView1.ColumnCount; i++)
            {
                dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
            }
        }
Esempio n. 27
0
 private void nine_Click(object sender, RoutedEventArgs e)
 {
     Num nine = new Num();
     nine.GetNum = 9;
     myAdd(nine);
 }
Esempio n. 28
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            string sqlStr   = "delete from Alldata where";
            string NeedStr1 = "";
            string NeedStr2 = "";

            if (rbbTime.Checked)
            {
                NeedStr1 = string.Format(" TestTime between #{0} 00:00:01# and #{1} 23:59:59#", dateTimePicker1.Text, dateTimePicker2.Text);
            }
            if (rbbBar.Checked)
            {
                if (txtBar.Text.IndexOf("'") >= 0)
                {
                    MessageBox.Show("请不要输入非法字符", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                NeedStr1 = string.Format(" bar like '%{0}%'", txtBar.Text);
            }
            if (rbbMode.Checked)
            {
                NeedStr1 = string.Format(" mode like '%{0}%'", cbbMode.Text);
            }
            if (rbbNo.Checked)
            {
                NeedStr1 = string.Format(" testNo={0}", Num.IntParse(txtNo.Text));
            }
            IEnumerator ie = panel4.Controls.GetEnumerator();

            while (ie.MoveNext())
            {
                CheckBox cb    = (CheckBox)ie.Current;
                int      index = Num.IntParse(cb.Tag);
                if (index >= 0)
                {
                    if (cb.Checked)
                    {
                        NeedStr2 = NeedStr2 + " and b" + cb.Tag.ToString() + "=false";
                    }
                }
                else
                {
                    if (index == -2 && checkBox1.Checked)
                    {
                        NeedStr2 = NeedStr2 + " and isPass='******'";
                    }
                    if (index == -1 && checkBox2.Checked)
                    {
                        NeedStr2 = NeedStr2 + " and isPass='******'";
                    }
                }
            }
            sqlStr = sqlStr + NeedStr1 + NeedStr2;
            int changeRow = cData.upData(sqlStr, cData.ConnData);

            if (changeRow > 0)
            {
                MessageBox.Show("删除成功", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("删除失败或没有数据可删除", "失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 29
0
        /// <summary>
        /// 读取2010模块数据
        /// </summary>
        /// <param name="ReturnBuff">返回读取9元素数组,0,1,2为电压,3,4,5为电流,6,7,8为功率</param>
        /// <returns>返回读取数据是否成功</returns>
        public bool WbGonglvRead_R(ref double[] ReturnBuff)
        {
            if (cMain.isDebug)
            {
                ReturnBuff[0] = 220 + 10 * Num.Rand();
                ReturnBuff[1] = 220 + 10 * Num.Rand();
                ReturnBuff[2] = 220 + 10 * Num.Rand();
                ReturnBuff[3] = 4; // +5 * Num.Rand();
                ReturnBuff[4] = 6; // +5 * Num.Rand();
                ReturnBuff[5] = 8; // +5 * Num.Rand();
                ReturnBuff[6] = ReturnBuff[0] * ReturnBuff[3];
                ReturnBuff[7] = ReturnBuff[1] * ReturnBuff[4];
                ReturnBuff[8] = ReturnBuff[2] * ReturnBuff[5];
                return(true);
            }
            bool returnValue = false;

            long[] mReturnBuff = new long[35];

            int i;

            long[]   ReturnBuff1 = new long[4];
            byte[]   WriteBuff   = new byte[10]; //发送数据
            byte[]   ReadBuff    = new byte[16]; //接收数据
            int      ReturnByte  = 0;            //返回数据
            bool     IsReturn    = false;        //是否成功返回
            bool     IsTimeOut   = false;        //是否超时
            DateTime NowTime;                    //当前时间
            TimeSpan ts;                         //时间差



            try
            {
                //05 03	24 10 00 06 CF 79
                WriteBuff[0] = 0x7E;
                WriteBuff[1] = 0x01;
                WriteBuff[2] = 0xFF;
                WriteBuff[3] = 0x50;
                WriteBuff[4] = 0xB0;
                WriteBuff[5] = 0x0D;

                NowTime = DateTime.Now;
                do
                {
                    //System.Windows.Forms.Application.DoEvents();
                    //Threading.Thread.Sleep(20);
                    if (comPort.BytesToRead >= 14)//收到数据
                    {
                        ReturnByte = comPort.BytesToRead;
                        IsReturn   = true;
                    }
                    ts = DateTime.Now - NowTime;
                    if (ts.TotalMilliseconds > timeOut)//时间超时
                    {
                        IsTimeOut = true;
                    }
                } while (!IsReturn && !IsTimeOut);
                if (!IsReturn && IsTimeOut)//超时
                {
                    if (ErrStr.IndexOf("接收数据已超时") < 0)
                    {
                        ErrStr = ErrStr + DateTime.Now.ToString() + ",WbGonglvRead," + ":读取失败,接收数据已超时" + (char)13 + (char)10;
                    }
                    returnValue = false;
                    return(returnValue);
                }
                comPort.Read(ReadBuff, 0, ReturnByte);
                if ((ReadBuff[0] != WriteBuff[0]) || (ReadBuff[1] != WriteBuff[1]))//数据检验失败
                {
                    //string tempStr = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{3},{14},{15},{16},{17},{18},{19},{20}",
                    //    ReadBuff[0], ReadBuff[1], ReadBuff[2], ReadBuff[3], ReadBuff[4], ReadBuff[5], ReadBuff[6], ReadBuff[7], ReadBuff[8],
                    //    ReadBuff[9], ReadBuff[10], ReadBuff[11], ReadBuff[12], ReadBuff[13], ReadBuff[14], ReadBuff[15], ReadBuff[16], ReadBuff[17]
                    //    , ReadBuff[18], ReadBuff[19], ReadBuff[20]);
                    //cMain.WriteErrorToLog(tempStr);
                    if (ErrStr.IndexOf("接收数据错误") < 0)
                    {
                        ErrStr = ErrStr + DateTime.Now.ToString() + ",WbGonglvRead," + ":读取失败,接收数据错误" + (char)13 + (char)10;
                    }
                    returnValue = false;
                    return(returnValue);
                }
                else
                {
                    for (i = 0; i < ReturnBuff1.Length; i++)
                    {
                        ReturnBuff1[i] = (ReadBuff[i * 2 + 7] & 0xFF) * 256 + (ReadBuff[i * 2 + 6] & 0xFF);
                        //if ((ReadBuff[i * 2 + 4] >> 7) == 1)//如果是负数
                        //{
                        //    ReturnBuff1[i] = -(ReturnBuff1[i] & 0xFFFF + 1);
                        //}
                        mReturnBuff[i] = ReturnBuff1[i];
                    }
                }
            }
            catch (Exception exc)
            {
                if (ErrStr.IndexOf(exc.ToString()) < 0)
                {
                    ErrStr = ErrStr + DateTime.Now.ToString() + ",WbGonglvRead," + ":" + exc.ToString() + (char)13 + (char)10;
                }
                returnValue = false;
                return(returnValue);
            }
            returnValue = true;


            if (returnValue)
            {
                ReturnBuff[0] = mReturnBuff[2] * 300 / (double)10000;//电压
                ReturnBuff[1] = 0;
                ReturnBuff[2] = 0;
                ReturnBuff[3] = mReturnBuff[3] * 25 / (double)10000;//电流
                ReturnBuff[4] = 0;
                ReturnBuff[5] = 0;

                ReturnBuff[6] = mReturnBuff[0] * 7500 / (double)10000;//功率


                ReturnBuff[7] = 0;


                ReturnBuff[8] = 0;
            }
            else
            {
                if (errStr.IndexOf(mStandarBoard.ErrStr) < 0)
                {
                    errStr = errStr + mStandarBoard.ErrStr;
                }
            }
            return(returnValue);
        }
Esempio n. 30
0
        static void Main(string[] args)
        {
            //Коллекция нетипизированная ОЧЕРЕДЬ
            Queue q1 = new Queue();

            q1.Enqueue("1");
            q1.Enqueue('2');
            q1.Enqueue("Three");
            q1.Enqueue(5);
            Console.WriteLine("First element: " + q1.Peek());
            Console.WriteLine("All elements: " + q1.Count);

            while (q1.Count > 0)
            {
                Console.WriteLine(q1.Dequeue());
            }

            /*
             * foreach (var item in q1)
             *  Console.WriteLine(item);
             */

            //Коллекция СТЕК
            Stack s1 = new Stack();

            s1.Push(6);
            s1.Push("2");
            s1.Push('1');
            s1.Push(3);
            Console.WriteLine("Upper element: " + s1.Peek());
            Console.WriteLine("All elements: " + s1.Count);
            //Извлечение элементов
            while (s1.Count > 0)
            {
                Console.WriteLine(" " + s1.Pop());
            }

            /*
             * //С первого элемента!
             * foreach (var item in s1)
             *  Console.WriteLine(s1.Pop());
             */

            Num n = new Num(2, 5, 9);

            foreach (var item in n)
            {
                Console.WriteLine(item);
            }

            Demo d = new Demo();

            foreach (int item in d)
            {
                Console.WriteLine(item);
            }

            TempRecord tr = new TempRecord();

            //Установка значений через индексатор
            //через set устанавливаются значения
            tr[3] = 15;
            tr[4] = 17;

            //Получение значений через индексатор
            for (int i = 0; i < tr.Length; i++)
            {
                Console.WriteLine("Element #{0} equals {1}", i, tr[i]);
            }

            //пример индексатора где индексатор принимает строку
            DemoStringIndex dm = new DemoStringIndex(5, 6);

            Console.WriteLine("{0}    {1}", dm["first"], dm["second"]);

            DemoArray a = new DemoArray(3, 3);

            for (int i = 0; i < a.LengthN; i++, Console.WriteLine())
            {
                for (int j = 0; j < a.LengthM; j++)
                {
                    a[i, j] = i * j; //использование индексаторов
                    Console.WriteLine("{0,5}", a[i, j]);
                }
            }
            Console.WriteLine();
            try
            {
                //Раскомментировать по очереди чтобы посмотреть на разные ошибки
                //Console.WriteLine(a[3, 3]);
                //a[0, 0] = 200;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            Cat      fluffy   = new Cat();
            Elephant slon     = new Elephant();
            Dog      goldy    = new Dog();
            Patients SickPets = new Patients();

            SickPets.AdmitPatient(fluffy);
            SickPets.AdmitPatient(slon);
            SickPets.AdmitPatient(goldy);
            foreach (object pet in SickPets)
            {
                Console.WriteLine(pet);
            }



            Console.ReadKey();
        }
Esempio n. 31
0
 private void two_Click(object sender, RoutedEventArgs e)
 {
     Num two = new Num();
     two.GetNum = 2;
     myAdd(two);
 }
 public static void TestGenericMethodBySpecifingTypeParameter()
 {
     double     d = 2.5;
     Num <byte> b = NumHelper.From <byte>(d);
 }
Esempio n. 33
0
 /// <summary>
 /// Tries to parse a string to a signed number and returns if it worked
 /// </summary>
 /// <param name="s">String to parse</param>
 /// <param name="n">Value to store the result into</param>
 public static bool TryParse(string s, ref Num n)
 {
     short result;
     bool success = short.TryParse(s, out result) && result >= minValue && result <= maxValue;
     if (success) { n = result; }
     return success;
 }
Esempio n. 34
0
 public OneMoreThan(Num _predecessor)
 {
     predecessor = _predecessor;
 }
Esempio n. 35
0
            internal static expr Convert(ConstantExpression expr) {
                expr ast;

                if (expr.Value == null)
                    return new Name("None", Load.Instance);
#if CLR2
                if (expr.Value is int || expr.Value is double || expr.Value is Int64 || expr.Value is BigInteger || expr.Value is Complex64)
#else
                if (expr.Value is int || expr.Value is double || expr.Value is Int64 || expr.Value is BigInteger || expr.Value is Complex)
#endif
                    ast = new Num(expr.Value);
                else if (expr.Value is string)
                    ast = new Str((string)expr.Value);
                else if (expr.Value is IronPython.Runtime.Bytes)
                    ast = new Str(Converter.ConvertToString(expr.Value));
                else if (expr.Value == PythonOps.Ellipsis)
                    ast = Ellipsis.Instance;
                else
                    throw new ArgumentTypeException("Unexpected constant type: " + expr.Value.GetType());

                return ast;
            }
        private string DataFrmToSn()
        {
            string SnCode = "";

            //string MoShi = "00";
            //string PinLv = "00";
            //string DuanKou = "00";
            //string WenDu = "00";
            //string FengSu = "00";
            //string KuaiJian = "00";
            byte[] SnCodeByte           = new byte[20];
            int    machineSelectedIndex = 1;

            string[] tempJiQiStr = cMain.JiQiStr[cMain.IndexLanguage].Split(',');
            for (int i = 0; i < tempJiQiStr.Length; i++)
            {
                if (tempJiQiStr[i] == cbbMachine.Text)
                {
                    machineSelectedIndex = i;
                    break;
                }
            }

            switch (machineSelectedIndex)
            {
            case 0:
            default:
                SnCode = "";
                break;

            case 1:
            case 3:
                SnCodeByte[0] = 0xAA;
                SnCodeByte[1] = 0x01;
                SnCodeByte[2] = 0x00;
                SnCodeByte[3] = 0x00;
                SnCodeByte[4] = 0x05;
                SnCodeByte[5] = 0x00;
                switch (cbbMoshi.Text)
                {
                case "停机":
                    SnCodeByte[5] = 0x00;
                    break;

                case "制冷":
                    SnCodeByte[5] = 0x01;
                    break;

                case "制热":
                    SnCodeByte[5] = 0x02;
                    break;

                case "送风":
                    SnCodeByte[5] = 0x03;
                    break;
                }
                if (machineSelectedIndex == 3)
                {
                    if (cbbMoshi.Text == "制冷")
                    {
                        SnCodeByte[5] = 0x02;
                    }
                    if (cbbMoshi.Text == "制热")
                    {
                        SnCodeByte[5] = 0x01;
                    }
                }
                SnCodeByte[6] = (byte)(Num.IntParse(txtPinLv.Text) & 0xFF);
                SnCodeByte[7] = 0x02;
                switch (cbbFengSu.Text)
                {
                case "室内风机关":
                    SnCodeByte[7] = 0x00;
                    break;

                case "高风":
                    SnCodeByte[7] = 0x02;
                    break;

                case "中风":
                    SnCodeByte[7] = 0x04;
                    break;

                case "低风":
                    SnCodeByte[7] = 0x08;
                    break;
                }
                if ((cbbMoshi.Text == "制热" && (machineSelectedIndex == 1 || machineSelectedIndex == 7)) ||//制热
                    (cbbMoshi.Text == "制冷" && machineSelectedIndex == 3))       //出口机制冷
                {
                    SnCodeByte[7] = (byte)((SnCodeByte[7] + 1) & 0xFF);
                }
                SnCodeByte[8]  = 0x00;
                SnCodeByte[9]  = 0x00;
                SnCodeByte[10] = 0x19;
                if (cbbMoshi.Text == "停机" || cbbMoshi.Text == "送风")
                {
                    SnCodeByte[10] = 0x19;
                }
                if (cbbMoshi.Text == "制冷")    //制冷
                {
                    SnCodeByte[10] = 0x11;
                }
                if (cbbMoshi.Text == "制热")    //制热
                {
                    SnCodeByte[10] = 0x1E;
                }
                SnCodeByte[11] = 0x01;
                SnCodeByte[12] = 0x7D;
                SnCodeByte[13] = 0x7D;
                SnCodeByte[14] = 0x00;
                SnCodeByte[15] = chkKuaiJian.Checked ? (byte)0x01 : (byte)0x00;
                cMideaSnCode.Crc(SnCodeByte, cMideaSnCode.CrcList.OldSn600, ref SnCodeByte[16], ref SnCodeByte[17]);
                SnCodeByte[17] = 0x55;
                for (int i = 0; i < 18; i++)
                {
                    SnCode = SnCode + string.Format("{0:X2}", SnCodeByte[i]);
                }
                break;

            case 2:    //A00100200C11
                SnCodeByte[0] = 0xA0;
                SnCodeByte[1] = 0x01;
                SnCodeByte[2] = 0x00;
                SnCodeByte[3] = 0x20;
                SnCodeByte[4] = 0x0C;
                SnCodeByte[5] = 0x11;
                SnCodeByte[6] = 0x00;
                switch (cbbMoshi.Text)
                {
                case "停机":
                    SnCodeByte[6] = 0x00;
                    break;

                case "制冷":
                    SnCodeByte[6] = 0x01;
                    break;

                case "制热":
                    SnCodeByte[6] = 0x02;
                    break;

                case "送风":
                    SnCodeByte[6] = 0x03;
                    break;
                }
                SnCodeByte[7] = (byte)(Num.IntParse(txtPinLv.Text) & 0xFF);
                SnCodeByte[8] = 0x02;
                switch (cbbFengSu.Text)
                {
                case "室内风机关":
                    SnCodeByte[8] = 0x00;
                    break;

                case "高风":
                    SnCodeByte[8] = 0x02;
                    break;

                case "中风":
                    SnCodeByte[8] = 0x04;
                    break;

                case "低风":
                    SnCodeByte[8] = 0x08;
                    break;
                }
                if (cbbMoshi.Text == "制热")
                {
                    SnCodeByte[8] = (byte)((SnCodeByte[8] + 1) & 0xFF);
                }
                SnCodeByte[9]  = 0x00;
                SnCodeByte[10] = 0x00;
                SnCodeByte[10] = 0x19;
                if (cbbMoshi.Text == "停机" || cbbMoshi.Text == "送风")
                {
                    SnCodeByte[10] = 0x19;
                }
                if (cbbMoshi.Text == "制冷")    //制冷
                {
                    SnCodeByte[10] = 0x11;
                }
                if (cbbMoshi.Text == "制热")    //制热
                {
                    SnCodeByte[10] = 0x1E;
                }
                SnCodeByte[12] = 0x01;
                SnCodeByte[13] = 0x75;
                SnCodeByte[14] = 0x75;
                SnCodeByte[15] = 0x08;
                switch (cbbNengJi.Text)
                {
                case "0.8匹(22机)":
                    SnCodeByte[15] = 0x08;
                    break;

                case "1匹(25,26,28机)":
                    SnCodeByte[15] = 0x0A;
                    break;

                case "1.2匹(32机)":
                    SnCodeByte[15] = 0x0C;
                    break;

                case "1.5匹(35机)":
                    SnCodeByte[15] = 0x0F;
                    break;
                }
                SnCodeByte[16] = chkKuaiJian.Checked ? (byte)0x01 : (byte)0x00;
                SnCodeByte[17] = 0x00;
                cMideaSnCode.Crc(SnCodeByte, cMideaSnCode.CrcList.NewSn600, ref SnCodeByte[18], ref SnCodeByte[19]);
                //SnCode = Encoding.ASCII.GetString(SnCodeByte, 0, 20);
                for (int i = 0; i < 20; i++)
                {
                    SnCode = SnCode + string.Format("{0:X2}", SnCodeByte[i]);
                }
                break;

            case 4:
            case 7:
                SnCodeByte[0] = 0x55;
                //00停  0C制热  02制冷  E0送风
                SnCodeByte[1] = 0x00;
                switch (cbbMoshi.Text)
                {
                case "停机":
                    SnCodeByte[1] = 0x00;
                    break;

                case "制冷":
                    SnCodeByte[1] = 0x02;
                    break;

                case "制热":
                    SnCodeByte[1] = 0x0C;
                    break;

                case "送风":
                    SnCodeByte[1] = 0xE0;
                    break;
                }
                SnCodeByte[2] = 0xFF;
                SnCodeByte[3] = 0x40;
                switch (cbbFengSu.Text)
                {
                case "室内风机关":
                    switch (cbbMoshi.Text)
                    {
                    case "停机":
                    case "送风":
                        SnCodeByte[3] = 0x00;
                        break;

                    case "制冷":
                        SnCodeByte[3] = 0x80;
                        break;

                    case "制热":
                        SnCodeByte[3] = 0x90;
                        break;
                    }
                    break;

                case "高风":
                    switch (cbbMoshi.Text)
                    {
                    case "停机":
                    case "送风":
                        SnCodeByte[3] = 0x40;
                        break;

                    case "制冷":
                        SnCodeByte[3] = 0xC0;
                        break;

                    case "制热":
                        SnCodeByte[3] = 0xD0;
                        break;
                    }
                    break;

                case "低风":
                    switch (cbbMoshi.Text)
                    {
                    case "停机":
                    case "送风":
                        SnCodeByte[3] = 0x20;
                        break;

                    case "制冷":
                        SnCodeByte[3] = 0xA0;
                        break;

                    case "制热":
                        SnCodeByte[3] = 0xB0;
                        break;
                    }
                    break;
                }
                SnCodeByte[4] = chkKuaiJian.Checked ? (byte)0x10 : (byte)0x00;
                cMideaSnCode.Crc(SnCodeByte, cMideaSnCode.CrcList.ShuMa1023, ref SnCodeByte[5], ref SnCodeByte[6]);
                //SnCode = Encoding.ASCII.GetString(SnCodeByte, 0, 6);
                for (int i = 0; i < 6; i++)
                {
                    SnCode = SnCode + string.Format("{0:X2}", SnCodeByte[i]);
                }
                break;

            case 5:    //1200
                SnCodeByte[0] = 0xAA;
                SnCodeByte[1] = 0x00;
                SnCodeByte[1] = 0x0E;
                switch (cbbFengSu.Text)
                {
                case "高风(双风机)":
                    switch (cbbMoshi.Text)
                    {
                    case "制冷":
                        SnCodeByte[1] = 0x0E;
                        break;

                    case "制热":
                        SnCodeByte[1] = 0x0F;
                        break;

                    case "送风":
                        SnCodeByte[1] = 0x06;
                        break;
                    }
                    break;

                case "低风(风机2)":
                    switch (cbbMoshi.Text)
                    {
                    case "制冷":
                        SnCodeByte[1] = 0x0C;
                        break;

                    case "制热":
                        SnCodeByte[1] = 0x0D;
                        break;

                    case "送风":
                        SnCodeByte[1] = 0x04;
                        break;
                    }
                    break;

                case "低风(风机1)":
                    switch (cbbMoshi.Text)
                    {
                    case "制冷":
                        SnCodeByte[1] = 0x0A;
                        break;

                    case "制热":
                        SnCodeByte[1] = 0x0B;
                        break;

                    case "送风":
                        SnCodeByte[1] = 0x02;
                        break;
                    }
                    break;

                case "风机关":
                    switch (cbbMoshi.Text)
                    {
                    case "制冷":
                        SnCodeByte[1] = 0x08;
                        break;

                    case "制热":
                        SnCodeByte[1] = 0x09;
                        break;
                    }
                    break;
                }
                SnCodeByte[2] = 0x00;
                switch (cbbMoshi.Text)
                {
                case "停机":
                    SnCodeByte[2] = 0x00;
                    break;

                case "制冷":
                    SnCodeByte[2] = 0x01;
                    break;

                case "制热":
                    SnCodeByte[2] = 0x02;
                    break;

                case "送风":
                    SnCodeByte[2] = 0x03;
                    break;
                }
                SnCodeByte[3] = 0x00;
                SnCodeByte[4] = chkDanLen.Checked ? (byte)0x00 : (byte)0x01;
                SnCodeByte[5] = 0x00;
                cMideaSnCode.Crc(SnCodeByte, cMideaSnCode.CrcList.TianHua1200, ref SnCodeByte[6], ref SnCodeByte[7]);
                SnCodeByte[7] = 0x55;
                //SnCode = Encoding.ASCII.GetString(SnCodeByte, 0, 8);
                for (int i = 0; i < 8; i++)
                {
                    SnCode = SnCode + string.Format("{0:X2}", SnCodeByte[i]);
                }
                break;

            case 6:
                SnCodeByte[0] = 0xAA;
                SnCodeByte[1] = 0x01;
                switch (cbbMoshi.Text)
                {
                case "停机":
                    SnCodeByte[2] = 0x00;
                    SnCodeByte[3] = 0x00;
                    SnCodeByte[4] = 0x19;
                    SnCodeByte[5] = 0x00;
                    break;

                case "制冷":
                    SnCodeByte[2] = 0x02;
                    SnCodeByte[3] = (byte)(Num.IntParse(txtNengLi.Text) * 30 & 0xFF);
                    SnCodeByte[4] = 0x11;
                    SnCodeByte[5] = 0x01;
                    break;

                case "制热":
                    SnCodeByte[2] = 0x03;
                    SnCodeByte[3] = (byte)(Num.IntParse(txtNengLi.Text) * 30 & 0xFF);
                    SnCodeByte[4] = 0x1E;
                    SnCodeByte[5] = 0x01;
                    break;

                case "送风":
                    SnCodeByte[2] = 0x01;
                    SnCodeByte[3] = 0x00;
                    SnCodeByte[4] = 0x19;
                    SnCodeByte[5] = 0x00;
                    break;
                }
                SnCodeByte[6] = 0xFA;
                SnCodeByte[7] = 0x00;
                cMideaSnCode.Crc(SnCodeByte, cMideaSnCode.CrcList.PQ, ref SnCodeByte[8], ref SnCodeByte[9]);
                SnCodeByte[9] = 0x55;
                for (int i = 0; i < 10; i++)
                {
                    SnCode = SnCode + string.Format("{0:X2}", SnCodeByte[i]);
                }
                break;
            }
            return(SnCode);
        }