示例#1
0
 /// <summary>
 /// 数据下载
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void timerDownLoad_Tick(object sender, EventArgs e)
 {
     try
     {
         timerDownLoad.Enabled = false;
         if (!BaseVariable.NetworkStatus || !BaseVariable.ServerStatus)
         {
             MessageBox.Show("离线模式下不能下载数据,待在线模式下返修!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
         }
         else
         {
             FrmDataSync form = new FrmDataSync(SyncType.Download);
             form.ShowDialog();
             form.Dispose();
         }
     }
     catch (Exception ex)
     {
         CLog.WriteErrLog(ex.Message);
     }
 }
示例#2
0
        /// <summary>
        /// 上传数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUpData_Click(object sender, EventArgs e)
        {
            try
            {
                if (!BaseVariable.NetworkStatus || !BaseVariable.ServerStatus)
                {
                    MessageBox.Show("离线模式下不能上传数据,待在线模式下返修!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
                }
                else
                {
                    int BatchCount = lBatchDAL.GetRecordCount("");

                    int BrakeResultCount    = lBrakeResultDAL.GetRecordCount("");
                    int PedalResultCount    = lPedalResultDAL.GetRecordCount("");
                    int RadiatorResultCount = lRadiatorResultDAL.GetRecordCount("");

                    //添加前桥和后桥
                    int FrontAxleResultCount = lFrontAxleResultDAL.GetRecordCount("");
                    int RearAxleResultCount  = lRearAxleResultDAL.GetRecordCount("");
                    //添加副仪表板
                    int AuxiliaryFasiaResultCount = lAuxiliaryFasiaResultDAL.GetRecordCount("");

                    int total = BatchCount + BrakeResultCount + PedalResultCount + RadiatorResultCount + FrontAxleResultCount + RearAxleResultCount + AuxiliaryFasiaResultCount;
                    if (total > 0)
                    {
                        FrmDataSync form = new FrmDataSync(SyncType.Upload);
                        form.ShowDialog();
                        form.Dispose();
                    }
                    else
                    {
                        MessageBox.Show("没有数据需上传", "上传提示");
                    }
                }
            }
            catch (Exception ex)
            {
                CLog.WriteErrLog("[FrmMain.btnUpData]" + ex.Message);
            }
        }
示例#3
0
        /// <summary>
        /// 下载数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDnData_Click(object sender, EventArgs e)
        {
            try
            {
                if (!Opt.GlobalNetStatus())
                {
                    MessageBox.Show("离线模式下不能下载数据,待在线模式下下载数据!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
                }
                else
                {
                    FrmDataSync form = new FrmDataSync(SyncType.Download);
                    form.ShowDialog();
                    form.Dispose();
                    LoadForm();

                    //加载产品特征码列表
                    Opt.LoadProductInfo();
                }
            }
            catch (Exception ex)
            {
                CLog.WriteErrLog("[FrmMain.btnDnData]" + ex.Message);
            }
        }
示例#4
0
        /// <summary>
        /// 数据上传提示
        /// </summary>
        public void TipDataUpload()
        {
            try
            {
                string productType = BaseVariable.DeviceEntity.ProductType;
                //制动泵
                int BrakeResultCount = 0;
                //踏板
                int PedalResultCount = 0;
                //散热器
                int RadiatorResultCount = 0;
                int BatchCount          = 0;
                //添加前桥和后桥
                int FrontAxleResultCount = 0;
                int RearAxleResultCount  = 0;
                //添加副仪表板
                int AuxiliaryFasiaResultCount = 0;
                switch (productType)
                {
                case "踏板":
                    PedalResultCount = lPedalResultDAL.GetRecordCount("");
                    break;

                case "制动泵":
                    BrakeResultCount = lBrakeResultDAL.GetRecordCount("");
                    break;

                case "散热器":
                    RadiatorResultCount = lRadiatorResultDAL.GetRecordCount("");
                    break;

                case "前桥":
                    FrontAxleResultCount = lFrontAxleResultDAL.GetRecordCount("");
                    break;

                case "后桥":
                    RearAxleResultCount = lRearAxleResultDAL.GetRecordCount("");
                    break;

                case "副仪表板":
                    AuxiliaryFasiaResultCount = lAuxiliaryFasiaResultDAL.GetRecordCount("");
                    break;
                }

                BatchCount = lBatchDAL.GetRecordCount("");
                int total = BatchCount + BrakeResultCount + PedalResultCount + RadiatorResultCount + FrontAxleResultCount + RearAxleResultCount + AuxiliaryFasiaResultCount;
                if (!Opt.GlobalNetStatus() && total > 0)
                {
                    string msg = string.Format("当前有{0}条数据需要上传,请在网络好的情况下手动上传!", total);
                    MessageBox.Show(msg, "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                    return;
                }
                if (total > 0)
                {
                    string msg = string.Format("当前有{0}条数据需要上传,是否现在上传?", total);
                    if (MessageBox.Show(msg, "温馨提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                    {
                        FrmDataSync form = new FrmDataSync(SyncType.Upload);
                        form.ShowDialog();
                        form.Dispose();
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                CLog.WriteErrLog("Use UploadTip Exception:" + ex.Message);
            }
        }