//实时数据 //0000005E0000000200000000CFCDDE09595329CE000D94900000177000001996000000000050000002A300000D5C000001570000002000000000000000000000000000016697000000000000000000000000000000000000000000000000 private static byte[] OnResolveRealData(byte[] b, int c) { //设备一分钟传输一次数据,如果一分钟之内有可能是重复数据 try { // int Total_Length = int.Parse(ConvertData.ToHexString(b, 0, 4)); //4 Unsigned Integer消息总长度(含消息头及消息体) Zhgd_iot_dust_noise_current data = new Zhgd_iot_dust_noise_current(); short Command_Id = short.Parse(ConvertData.ToHexString(b, 4, 4));//4 Unsigned Short命令或响应类型0x0802; //(监控数据)7 // data.Sequence_Id = ConvertDataInt32(ConvertData.ToHexString(b, 8, 4));//4 Unsigned Integer消息流水号(保留未启用) //int sss = ConvertDataInt32(ConvertData.ToHexString(b, 12, 4));//4Unsigned Integer设备编号 data.sn = ConvertDataUInt32(ConvertData.ToHexString(b, 12, 4)).ToString(); //4Unsigned Integer设备编号 data.timestamp = ConvertDataInt32(ConvertData.ToHexString(b, 16, 4)); //4Unisgned时间戳(unixtime) data.timestamp = data.timestamp * 1000; // data.Data_type = short.Parse(ConvertData.ToHexString(b, 18, 4));//4 Unsigned Short数据类型类型 //data.SPM = ((Decimal)ConvertDataInt32(ConvertData.ToHexString(b, 20, 4))) / (Decimal)10000;//4 Unsigned Integer粉尘数据(需要除10000) data.tsp = (double)(((Decimal)ConvertDataInt32(ConvertData.ToHexString(b, 20, 4))) / (Decimal)10000) / 1000; //4 Unsigned Integer粉尘数据(需要除10000) 歌瑞丽单位ug/m3 所以还得除以1000 data.pm2_5 = (double)((Decimal)ConvertDataInt32(ConvertData.ToHexString(b, 24, 4)) / (Decimal)100); //4 Unsigned IntegerPM2.5 data.pm10 = (double)((Decimal)ConvertDataInt32(ConvertData.ToHexString(b, 28, 4)) / (Decimal)100); //4 Unsigned IntegerPM10 // data.TYPE = Convert.ToInt16(("0x" + ConvertData.ToHexString(b, 32, 2)), 16);//2 UnsignedShort0:SPM有效 //1:PM2.5有效 //2:PM10 有效 //3:3个都有效 //data.windDirection = (Decimal)ConvertDataInt32(ConvertData.ToHexString(b, 34, 4)) / (Decimal)100;//4 Unsigned Integer风向角度0,后台显示正北 //data.windSpeed = (Decimal)ConvertDataInt32(ConvertData.ToHexString(b, 38, 4)) / (Decimal)10; //4 Unsigned Integer风速为0,后台显示0m/S //风速和风向先调整一下 data.wind_direction = (double)((Decimal)ConvertDataInt32(ConvertData.ToHexString(b, 38, 4)) / (Decimal)10); //4 现在是风角度 data.wind_speed = (double)((Decimal)ConvertDataInt32(ConvertData.ToHexString(b, 34, 4)) / (Decimal)100); //4 现在是风速 2016/10/31号更改成除以100 // data.windSpeed = (Decimal)ConvertDataInt32(ConvertData.ToHexString(b, 34, 4)) / (Decimal)10; //4 现在是风速 data.temperature = (double)((Decimal)ConvertDataInt32(ConvertData.ToHexString(b, 42, 4)) / (Decimal)100); //4 Unsigned Integer温度数据(2661 表示 26.61度) data.humidity = (double)((Decimal)ConvertDataInt32(ConvertData.ToHexString(b, 46, 4)) / (Decimal)10); //4 Unsigned Integer湿度数据(7661 表示76.61) data.noise = (double)((Decimal)ConvertDataInt32(ConvertData.ToHexString(b, 50, 4)) / (Decimal)10); //4 Unsigned Integer噪音等效值(763噪音值为76.3) // data.maxNoise = (Decimal)ConvertDataInt32(ConvertData.ToHexString(b, 54, 4)) / (Decimal)10;//4 Unsigned Integer噪音峰值(927噪音峰值为92.7) #region 创塔的协议 //data.GPS_Y = HexToDouble(ConvertData.ToHexString(b, 58, 8));//8 DoubleGPS经度 //data.GPS_X = HexToDouble(ConvertData.ToHexString(b, 66, 8));//8 DoubleGPS纬度 //data.Pressure = HexToFloat(ConvertData.ToHexString(b, 74, 4));//78Float大气压值 //data.Remark = ConvertData.ToHexString(b, 152, 16);//16UnsignedChar保留字段(16BYTE) #endregion #region 格瑞利等其它 //data.GPS_Y = (double)ConvertDataInt32(ConvertData.ToHexString(b, 58, 4)) / 1000000d;//8 DoubleGPS经度 //data.GPS_X = (double)ConvertDataInt32(ConvertData.ToHexString(b, 62, 4)) / 1000000d;//8 DoubleGPS纬度 //data.Pressure = (float)ConvertDataInt32(ConvertData.ToHexString(b, 66, 4));//78Float大气压值 //data.Remark = ConvertData.ToHexString(b, 152, 16);//16UnsignedChar保留字段(16BYTE) #endregion byte[] replayrb = new byte[12]; replayrb[0] = 0; replayrb[1] = 0; replayrb[2] = 0; replayrb[3] = 12; replayrb[4] = 0x80; replayrb[5] = 0x20; replayrb[6] = 0; replayrb[7] = 0; replayrb[8] = 0; replayrb[9] = 0; //byte[] replayrb = new byte[10]; //replayrb[0] = b[0];//长度怎么这样赋值呢?????????? //replayrb[1] = b[1]; //replayrb[2] = b[2]; //replayrb[3] = b[3]; //replayrb[4] = 0x80; //replayrb[5] = 0x20; //replayrb[6] = b[6]; //replayrb[7] = b[7]; //replayrb[8] = b[8]; //replayrb[9] = b[9]; Dust_noise_operation.Send_dust_noise_Current(data); return(replayrb); } catch (Exception ex) { ToolAPI.XMLOperation.WriteLogXmlNoTail(System.Windows.Forms.Application.StartupPath + @"\CT", "创塔设备实时数据解析异常:", ex.Message); return(null); } }
public static void Main(string[] args) { Console.Write("Tratamento de tabela: "); try { //aqui vc passa o local do arquivo e abre a conecao com a tabela DataT = new TreatsData(@"Base de Dados.xlsx"); DataT.Clear(); //metodo q elimina duplicidade DataT.DuplicityEliminate(); //metodo elimina duplicidades sem logica DataT.mergeTable("Qual a media da sua renda? (Em Salários Mínimos)", "Incluindo você, qual a soma da renda das pessoas que residem com você?", "Qual a media da sua renda? (Em Salários Mínimos)"); DataT.mergeTable("Como você respondeu na pergunta acima que estuda no periodo matutino, em qual período exerce atividade remunerada:", "Como você respondeu na pergunta acima que estuda no periodo noturno, em qual período exerce atividade remunerada:", "Em qual período exerce atividade remunerada:"); //metodo q preenche os campos vazios com null DataT.TreatsNull(); //salva as alteracoes DataT.Save(); DataT.CloseExcel(); Console.WriteLine("Confere"); } catch { Console.WriteLine("Erro"); } Console.Write("Validação: "); try { //fecha a a conexao Validate = new ValidateData(@"Base de Dados.xlsx"); Validate.validateEmail(); Validate.validateIdade(); Validate.validateDuplic(); Validate.validateAll(); var t = Validate.CompareTable(@"Validate.xlsx"); Validate.Save(); Validate.Close(); if (!(t)) { throw new Exception(); } Console.WriteLine("Confere"); } catch { Console.WriteLine("Erro"); } var Convert = new ConvertData(@"Base de Dados.xlsx"); Convert.CreateJson(); Console.WriteLine("Aperte uma tecla para finalizar "); Console.ReadKey(); }
void Print() { try { Sale_Header_Info _Sale_Header_Info = (Sale_Header_Info)dgrSaleHeader.SelectedItem; if (_Sale_Header_Info == null) { return; } List <Product_Info> _list_Product_Buy = c_Product_Controller.Get_Product_By_Sale_Header(_Sale_Header_Info.SoHoaDon); #region Kết xuất FlexCel.Report.FlexCelReport flcReport = new FlexCel.Report.FlexCelReport(); string _path = CommonData.ExcelDesignFilePath; string _fileExcelName = "Hoa_Don_Ban_Le.xls"; DataSet ds_all = new DataSet(); DataTable _dt = ConvertData.ConvertToDatatable(_list_Product_Buy); _dt.Columns.Add("STT"); int index = 1; foreach (DataRow item in _dt.Rows) { item["STT"] = index; index++; } ds_all.Tables.Add(_dt); ds_all.Tables[0].TableName = "BanLe"; if (ds_all.Tables.Count <= 0) { Mouse.OverrideCursor = null; NoteBox.Show("Không có dữ liệu để kết xuất", "Thông báo", NoteBoxLevel.Note); return; } if (ds_all.Tables[0].Rows.Count <= 0) { Mouse.OverrideCursor = null; NoteBox.Show("Không có dữ liệu để kết xuất", "Thông báo", NoteBoxLevel.Note); return; } _path += _fileExcelName; CommonFunction.SetValueExportByDataTable(ref flcReport, ds_all); CommonFunction.SetValueExportByString(ref flcReport, "SoHoaDon", _Sale_Header_Info.SoHoaDon); CommonFunction.SetValueExportByString(ref flcReport, "Customer", _Sale_Header_Info.Customer_Name); CommonFunction.SetValueExportByString(ref flcReport, "Address", _Sale_Header_Info.Address); string _tienBangChu = ConvertData.ConvertMoneyToStr(Convert.ToDouble(_Sale_Header_Info.Total_Amount)); CommonFunction.SetValueExportByString(ref flcReport, "TienBangChu", _tienBangChu); System.Windows.Forms.SaveFileDialog saveReport = new System.Windows.Forms.SaveFileDialog(); saveReport.Filter = "Excel files (*.xls)|*.xls"; if (saveReport.ShowDialog() == System.Windows.Forms.DialogResult.OK) { CommonFunction.ExportExcel(flcReport, _path, saveReport); } #endregion } catch (Exception ex) { CommonData.log.Error(ex.ToString()); } }
public ActionResult ExportData_View(decimal pAppHeaderId, string p_appCode, string p_Language) { try { string _datetimenow = DateTime.Now.ToString("ddMMyyyyHHmm"); string language = AppsCommon.GetCurrentLang(); var objBL = new A05_BL(); List <A05_Info_Export> _lst = new List <A05_Info_Export>(); List <AppDocumentInfo> appDocumentInfos = new List <AppDocumentInfo>(); List <AppFeeFixInfo> _lst_appFeeFixInfos = new List <AppFeeFixInfo>(); ApplicationHeaderInfo applicationHeaderInfo = new ApplicationHeaderInfo(); List <Other_MasterInfo> _lst_Other_MasterInfo = new List <Other_MasterInfo>(); List <AppDocumentOthersInfo> _LstDocumentOthersInfo = new List <AppDocumentOthersInfo>(); A05_Info_Export pDetail = objBL.GetByID_Exp(pAppHeaderId, language, ref applicationHeaderInfo, ref appDocumentInfos, ref _lst_appFeeFixInfos, ref _lst_Other_MasterInfo, ref _LstDocumentOthersInfo); pDetail.IMG_URL = Server.MapPath(pDetail.IMG_URL); string fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A05_VN_" + _datetimenow + ".pdf"); if (pDetail.Languague_Code == Language.LangVI) { fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A05_VN_" + _datetimenow + ".pdf"); SessionData.CurrentUser.FilePreview = "/Content/Export/" + "A05_VN_" + _datetimenow + ".pdf"; } else { fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A05_EN_" + _datetimenow + ".pdf"); SessionData.CurrentUser.FilePreview = "/Content/Export/" + "A05_EN_" + _datetimenow + ".pdf"; } Prepare_Data_Export_A05(ref pDetail, applicationHeaderInfo, appDocumentInfos, _lst_appFeeFixInfos, _lst_Other_MasterInfo, _LstDocumentOthersInfo); _lst.Add(pDetail); DataSet _ds_all = ConvertData.ConvertToDataSet <A05_Info_Export>(_lst, false); _ds_all.WriteXml(@"C:\inetpub\A05.xml", XmlWriteMode.WriteSchema); CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); string _tempfile = "A05.rpt"; if (p_Language == Language.LangEN) { _tempfile = "A05_EN.rpt"; } oRpt.Load(Path.Combine(Server.MapPath("~/Report/"), _tempfile)); #region Set vị trí ảnh CrystalDecisions.CrystalReports.Engine.PictureObject _pic01; _pic01 = (CrystalDecisions.CrystalReports.Engine.PictureObject)oRpt.ReportDefinition.Sections[0].ReportObjects["Picture1"]; _pic01.Width = 200; _pic01.Height = 200; try { Bitmap img = new Bitmap(pDetail.IMG_URL); try { double _Const = 6.666666666666 / 2; int _left = 0, _top = 0, _marginleft = 225, _margintop = 3540; int _h = 600; double _d1 = (_h - img.Width) / 2; _d1 = _Const * _d1; _left = _marginleft + Convert.ToInt32(_d1); if (_left < 0) { _left = _marginleft; } _pic01.Left = _left; // top _d1 = (_h - img.Height) / 2; _d1 = _Const * _d1; _top = _margintop + Convert.ToInt32(_d1); if (_top < 0) { _top = _margintop; } _pic01.Top = _top; } catch (Exception ex) { Logger.LogException(ex); } finally { img.Dispose(); } } catch (Exception ex) { } System.IO.FileInfo file = new System.IO.FileInfo(pDetail.IMG_URL); #endregion if (_ds_all != null) { _ds_all.Tables[0].TableName = "Table1"; oRpt.SetDataSource(_ds_all); } oRpt.Refresh(); Response.Buffer = false; Response.ClearContent(); Response.ClearHeaders(); //oRpt.ExportToDisk(ExportFormatType.PortableDocFormat, fileName_pdf); System.IO.Stream oStream = oRpt.ExportToStream(ExportFormatType.PortableDocFormat); byte[] byteArray = new byte[oStream.Length]; oStream.Read(byteArray, 0, Convert.ToInt32(oStream.Length - 1)); System.IO.File.WriteAllBytes(fileName_pdf, byteArray.ToArray()); // Requires System.Linq return(Json(new { success = 0 })); } catch (Exception ex) { Logger.LogException(ex); return(Json(new { success = 0 })); } }
public ActionResult ExportData_View_IU(ApplicationHeaderInfo pInfo, A02_Info pDetail, List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo, List <AuthorsInfo> pAppAuthorsInfo, List <Other_MasterInfo> pOther_MasterInfo, List <AppClassDetailInfo> pAppClassInfo, List <AppDocumentOthersInfo> pAppDocOtherInfo, List <UTienInfo> pUTienInfo, List <AppDocumentOthersInfo> pAppDocDesign) { try { string _datetimenow = DateTime.Now.ToString("ddMMyyyyHHmm"); string language = AppsCommon.GetCurrentLang(); var objBL = new A02_BL(); List <A02_Info_Export> _lst = new List <A02_Info_Export>(); string p_appCode = "A02_Preview"; string fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A02_VN_" + _datetimenow + ".pdf"); if (language == Language.LangVI) { fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A02_VN_" + _datetimenow + ".pdf"); SessionData.CurrentUser.FilePreview = "/Content/Export/" + "A02_VN_" + _datetimenow + ".pdf"; } else { fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A02_EN_" + _datetimenow + ".pdf"); SessionData.CurrentUser.FilePreview = "/Content/Export/" + "A02_EN_" + _datetimenow + ".pdf"; } A02_Info_Export _A02_Info_Export = new A02_Info_Export(); A02_Info_Export.CopyA02_Info(ref _A02_Info_Export, pDetail); // Phí cố định List <AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_A02(pDetail, pAppDocumentInfo, pAppDocDesign); Prepare_Data_Export_A02(ref _A02_Info_Export, pInfo, pAppDocumentInfo, _lstFeeFix, pAppAuthorsInfo, pOther_MasterInfo, pAppDocOtherInfo, pAppDocDesign); _lst.Add(_A02_Info_Export); DataSet _ds_all = ConvertData.ConvertToDataSet <A02_Info_Export>(_lst, false); //_ds_all.WriteXml(@"C:\inetpub\A02.xml", XmlWriteMode.WriteSchema); CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); string _tempfile = "A02.rpt"; if (language == Language.LangEN) { _tempfile = "A02_EN.rpt"; } oRpt.Load(Path.Combine(Server.MapPath("~/Report/"), _tempfile)); if (_ds_all != null) { _ds_all.Tables[0].TableName = "Table1"; oRpt.SetDataSource(_ds_all); } oRpt.Refresh(); Response.Buffer = false; Response.ClearContent(); Response.ClearHeaders(); System.IO.Stream oStream = oRpt.ExportToStream(ExportFormatType.PortableDocFormat); byte[] byteArray = new byte[oStream.Length]; oStream.Read(byteArray, 0, Convert.ToInt32(oStream.Length - 1)); System.IO.File.WriteAllBytes(fileName_pdf, byteArray.ToArray()); // Requires System.Linq return(Json(new { success = 0 })); } catch (Exception ex) { Logger.LogException(ex); return(Json(new { success = 0 })); } }
/// <summary> /// 导出为csv /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ToCsv(object sender, EventArgs e) { DataTable dt = ChangeDataTable(); ConvertData.ExportCsv(dt, this); }
/// <summary> /// 实时数据 /// </summary> /// <param name="b"></param> /// <param name="bCount"></param> /// <param name="client"></param> /// <param name="df"></param> public static void OnResolveCurrent(byte[] b, int bCount, TcpSocketClient client) { string tStr = ConvertData.ToHexString(b, 0, 2); if (tStr != "7A7A") { return; } Zhgd_iot_dust_noise_current current = new Zhgd_iot_dust_noise_current(); byte[] t = new byte[8]; for (int i = 8, j = 0; i < 16; i++, j++) { t[j] = b[i]; } current.sn = Encoding.ASCII.GetString(t); tStr = ConvertData.ToHexString(b, 16, 6); try { current.timestamp = DPC_Tool.GetTimeStamp(DateTime.ParseExact(tStr, "yyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture)); } catch { current.timestamp = DPC_Tool.GetTimeStamp(DateTime.Now); } UShortValue s = new UShortValue(); s.bValue1 = b[22]; s.bValue2 = b[23]; if (s.sValue.ToString() == "0") { current.pm2_5 = 5; } else { current.pm2_5 = s.sValue; } s.bValue1 = b[24]; s.bValue2 = b[25]; if (s.sValue.ToString() == "0") { current.pm10 = 5; } else { current.pm10 = s.sValue; } s.bValue1 = b[26]; s.bValue2 = b[27]; current.noise = double.Parse((float.Parse(s.sValue.ToString()) / 10).ToString("0.0")); s.bValue1 = b[28]; s.bValue2 = b[29]; current.temperature = double.Parse((float.Parse(s.sValue.ToString()) / 10).ToString("0.0")); s.bValue1 = b[30]; s.bValue2 = b[31]; current.humidity = double.Parse((float.Parse(s.sValue.ToString()) / 10).ToString("0.0")); s.bValue1 = b[32]; s.bValue2 = b[33]; current.wind_speed = double.Parse((float.Parse(s.sValue.ToString()) / 10).ToString("0.0")); s.bValue1 = b[34]; s.bValue2 = b[35]; current.wind_direction = s.sValue; // current.GprsSignal = ((sbyte)b[36]).ToString(); // current.automatic = b[37].ToString(); //current.Manual = b[38].ToString(); s.bValue1 = b[39]; s.bValue2 = b[40]; current.air_pressure = double.Parse((float.Parse(s.sValue.ToString()) / 100).ToString("0.00")); s.bValue1 = b[41]; s.bValue2 = b[42]; current.tsp = s.sValue; Dust_noise_operation.Send_dust_noise_Current(current); }
//处理运涛数据 public void ReadFromHttp() { localCached = new ConvertData(); //清除之前的一条条信息 BanBattleProcess.Instance.list_Item.Clear(); list_BattleRole.Clear(); list_AttAoYi.Clear(); list_DefAoYi.Clear(); #if DEBUG ConsoleEx.DebugLog(JsonFx.Json.JsonWriter.Serialize(Core.Data.temper.warBattle)); #endif int headerIndex = 0; List <CMsgHeader> battleInfo = Core.Data.temper.warBattle.battleData.info; foreach (CMsgHeader aHeader in battleInfo) { headerIndex++; switch (aHeader.status) { case CMsgHeader.STATUS_WAR_BEGIN: WarBegin(aHeader); //战斗开始,读取队伍信息,怒气槽等信息 CMsgWarBegin aWarBegin = aHeader as CMsgWarBegin; localCached.attAPCount = aWarBegin.attTeam.angryCnt; localCached.defAPCount = aWarBegin.defTeam.angryCnt; break; case CMsgHeader.STATUS_ROUND_BEGIN: //回合开始 RoundBegin(aHeader); break; case CMsgHeader.STATUS_PROPERTY_KILL: //属性相克 Property_Kill(aHeader); break; case CMsgHeader.STATUS_ATTACK: NormalAttack(aHeader); break; case CMsgHeader.STATUS_WAR_END: WarEnd(aHeader); break; case CMsgHeader.STATUS_NSK_401: case CMsgHeader.STATUS_NSK_402: case CMsgHeader.STATUS_NSK_403: case CMsgHeader.STATUS_NSK_404: case CMsgHeader.STATUS_NSK_405: case CMsgHeader.STATUS_NSK_406: case CMsgHeader.STATUS_NSK_408: case CMsgHeader.STATUS_NSK_409: case CMsgHeader.STATUS_NSK_410: case CMsgHeader.STATUS_NSK_411: case CMsgHeader.STATUS_NSK_412: case CMsgHeader.STATUS_NSK_413: case CMsgHeader.STATUS_NSK_414: case CMsgHeader.STATUS_NSK_415: case CMsgHeader.STATUS_NSK_417: case CMsgHeader.STATUS_NSK_419: case CMsgHeader.STATUS_NSK_420: CastSkill(aHeader.status, aHeader); break; case CMsgHeader.STATUS_NSK_407: case CMsgHeader.STATUS_NSK_418: CastSkill(aHeader.status, aHeader, battleInfo, headerIndex); break; default: #if DEBUG BanTools.LogWarning(BanTools.Serialize(aHeader)); #endif break; } } }
void Search() { try { Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; string _status = cboStatus.SelectedValue.ToString(); if (_status == ((decimal)Enum_Contract_Status.Den_Han_Thong_Bao).ToString()) { c_lst = c_Contract_Controller.Contract_Search_DenHanTB(ConvertData.ConvertDate2String(DateTime.Now), ConvertData.ConvertDate2String(DateTime.Now.AddDays(60))); } else { c_lst = c_Contract_Controller.Contract_Search_ByContract_Type(CommonData.c_All_Value, CommonData.c_All_Value, cboStatus.SelectedValue.ToString(), CommonData.c_All_Value, "-1"); //c_lst = c_Contract_Controller.Contract_Render_Search(CommonData.c_All_Value, cboStatus.SelectedValue.ToString(), CommonData.c_All_Value, "-1", CommonData.c_All_Value); } Mouse.OverrideCursor = null; dgrContract.ItemsSource = c_lst; DataGridHelper.NVSFocus(dgrContract, 0, 0); } catch (Exception ex) { Mouse.OverrideCursor = null; ErrorLog.log.Error(ex.ToString()); } }
void Export() { try { #region Kết xuất FlexCel.Report.FlexCelReport flcReport = new FlexCel.Report.FlexCelReport(); string _path = CommonData.ExcelDesignFilePath; string _fileExcelName = "Contract_Report.xls"; DataSet ds_all = new DataSet(); DataTable _dt = ConvertData.ConvertToDatatable(c_lst); _dt.Columns.Add("STT"); int index = 1; foreach (DataRow item in _dt.Rows) { item["STT"] = index; index++; } ds_all.Tables.Add(_dt); ds_all.Tables[0].TableName = "Contract"; if (ds_all.Tables.Count <= 0) { Mouse.OverrideCursor = null; NoteBox.Show("Không có dữ liệu để kết xuất", "Thông báo", NoteBoxLevel.Note); return; } if (ds_all.Tables[0].Rows.Count <= 0) { Mouse.OverrideCursor = null; NoteBox.Show("Không có dữ liệu để kết xuất", "Thông báo", NoteBoxLevel.Note); return; } _path += _fileExcelName; string _title_report = ""; string _status = cboStatus.SelectedValue.ToString(); if (_status == ((decimal)Enum_Contract_Status.Het_Han).ToString()) { _title_report = "BÁO CÁO HỢP ĐỒNG HẾT HẠN"; } else if (_status == ((decimal)Enum_Contract_Status.Gia_Han).ToString()) { _title_report = "BÁO CÁO HỢP ĐỒNG RA HẠN"; } else if (_status == ((decimal)Enum_Contract_Status.Den_Han_Thong_Bao).ToString()) { _title_report = "BÁO CÁO HỢP ĐỒNG ĐẾN HẠN THÔNG BÁO"; } else if (_status == ((decimal)Enum_Contract_Status.Dong_Trc_Thoi_Han).ToString()) { _title_report = "BÁO CÁO HỢP ĐỒNG ĐÓNG TRƯỚC THỜI HẠN"; } else { _title_report = "BÁO CÁO HỢP ĐỒNG"; } CommonFunction.SetValueExportByDataTable(ref flcReport, ds_all); CommonFunction.SetValueExportByString(ref flcReport, "title_report", _title_report); System.Windows.Forms.SaveFileDialog saveReport = new System.Windows.Forms.SaveFileDialog(); saveReport.Filter = "Excel files (*.xls)|*.xls"; if (saveReport.ShowDialog() == System.Windows.Forms.DialogResult.OK) { CommonFunction.ExportExcel(flcReport, _path, saveReport); } #endregion } catch (Exception ex) { ErrorLog.log.Error(ex.ToString()); } }
public ActionResult ExportToExcel(DTFiltros Dtos) { //DTResultadoOperacionModel<DTConsolidadoExcel> resultado = new DTResultadoOperacionModel<DTConsolidadoExcel>(); DTResultadoOperacionModel <string> respuesta = new DTResultadoOperacionModel <string>(); List <DTConsolidadoExcel> list = new List <DTConsolidadoExcel>(); BMConsolidado bMConsolidado = new BMConsolidado(); list = bMConsolidado.ConsultarConsolidadoExcel(Dtos); if (list.Count > 0) { DataTable dataTable = ConvertData.ConvertToDataTable <DTConsolidadoExcel>(list); DataSet dataSet = new DataSet(); dataSet.Tables.Add(dataTable); string numbreArchivo = ConfigurationManager.AppSettings.Get("ReporteExcelConsolidado"); string rutaArchivo = string.Empty; try { string RutaServidor = (string)new AppSettingsReader().GetValue("RutaServidor", typeof(string)); string SubRutaActual = Request.RawUrl; string RutaPlantilla = Request.Url.OriginalString.ToString(); var RutaFinal = RutaPlantilla.Replace(SubRutaActual, ""); rutaArchivo = RutaFinal + @"/" + RutaServidor + numbreArchivo + ".xlsx"; string rutaVirtual = Server.MapPath("~/Excel/"); string rutaCompleta = rutaVirtual + numbreArchivo + ".xlsx"; WindowsImpersonationContext logon = null; Boolean Suplantacion = (Boolean) new AppSettingsReader().GetValue("Impersonate", typeof(Boolean)); if (Suplantacion) { string DominioSuplantacion = (string)new AppSettingsReader().GetValue("DominioSuplantacion", typeof(string)); string UsuarioSuplantacion = (string)new AppSettingsReader().GetValue("UsuarioSuplantacion", typeof(string)); string ClaveSuplantacion = (string)new AppSettingsReader().GetValue("ClaveSuplantacion", typeof(string)); using (new Impersonation(DominioSuplantacion, UsuarioSuplantacion, ClaveSuplantacion)) { ConvertData.ToExcelFile(dataTable, rutaCompleta); } } else { ConvertData.ToExcelFile(dataTable, rutaCompleta); } respuesta.Respuesta = true; respuesta.Resultado = rutaArchivo; } catch (Exception ex) { respuesta.Mensaje = DTMensaje.ObtenerObjetoMensaje(DTCodigoMensajes.MENSAJE023); respuesta.Resultado = null; respuesta.Respuesta = false; GestorLog.RegistrarLogExcepcion(ex); } } else { respuesta.Mensaje = DTMensaje.ObtenerObjetoMensaje(DTCodigoMensajes.MENSAJE024); respuesta.Resultado = null; respuesta.Respuesta = false; } return(Json(respuesta, JsonRequestBehavior.AllowGet)); }
public override object calculate() { int num = base.paramList.Count; if (num < 2) { throw new ReportError("scope函数参数至少有2个"); } object obj3 = ConvertTool.getValue(((ExpParse)base.paramList[0]).calculate()); object obj6 = ConvertTool.getValue(((ExpParse)base.paramList[1]).calculate()); if (!(obj6 is ArrayList)) { throw new ReportError("scope函数第2个参数应为一个数组"); } ArrayList list = (ArrayList)obj6; bool flag = false; if (num >= 3) { object obj5 = ConvertTool.getValue(((ExpParse)base.paramList[2]).calculate()); if (!(obj5 is bool)) { throw new ReportError("scope函数第3个参数应为布尔表达式"); } flag = (bool)obj5; } bool flag2 = true; if (num >= 4) { object obj4 = ConvertTool.getValue(((ExpParse)base.paramList[3]).calculate()); if (!(obj4 is bool)) { throw new ReportError("scope函数第4个参数应为布尔表达式"); } flag2 = (bool)obj4; } if (!flag2) { for (int i = 0; i < list.Count; i--) { int num3 = ConvertTool.compare(obj3, list[i]); if ((flag && (num3 >= 0)) || (!flag && (num3 > 0))) { return(ConvertData.getInteger(i)); } } } else { for (int j = 0; j < list.Count; j++) { int num5 = ConvertTool.compare(obj3, list[j]); if ((!flag && (num5 < 0)) || (flag && (num5 <= 0))) { return(ConvertData.getInteger(j)); } } } return(ConvertData.getInteger(list.Count)); }
public ActionResult ExportData_View(decimal pAppHeaderId, string p_appCode, decimal p_View_Translate) { try { string language = AppsCommon.GetCurrentLang(); ApplicationHeaderInfo applicationHeaderInfo = new ApplicationHeaderInfo(); App_Detail_PLC05_KN_Info app_Detail = new App_Detail_PLC05_KN_Info(); List <AppFeeFixInfo> appFeeFixInfos = new List <AppFeeFixInfo>(); List <AppDocumentInfo> appDocumentInfos = new List <AppDocumentInfo>(); App_Detail_PLC05_KN_BL objBL = new App_Detail_PLC05_KN_BL(); app_Detail = objBL.GetByID(pAppHeaderId, language, ref applicationHeaderInfo, ref appDocumentInfos, ref appFeeFixInfos); string _fileTemp = System.Web.HttpContext.Current.Server.MapPath("/Content/AppForms/C05_VI.docx"); DocumentModel document = DocumentModel.Load(_fileTemp); // Fill export_header AppsCommon.Prepare_Data_Export_C05(ref app_Detail, applicationHeaderInfo, appDocumentInfos, appFeeFixInfos); List <App_Detail_PLC05_KN_Info> _lst = new List <App_Detail_PLC05_KN_Info>(); _lst.Add(app_Detail); DataSet _ds_all = ConvertData.ConvertToDataSet <App_Detail_PLC05_KN_Info>(_lst, false); CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); string _tempfile = "TM_PLC05_KN.rpt"; string _datetimenow = DateTime.Now.ToString("ddMMyyyyHHmm"); string fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "C05_VN_" + _datetimenow + ".pdf"); if (p_View_Translate == 1) { // nếu là tiếng việt thì xem bản tiếng anh và ngược lại if (applicationHeaderInfo.Languague_Code == Language.LangVI) { _tempfile = "TM_PLC05_KN_EN.rpt"; // tiếng anh fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "C05_EN_" + _datetimenow + ".pdf"); SessionData.CurrentUser.FilePreview = "/Content/Export/" + "C05_EN_" + _datetimenow + ".pdf"; } else { fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "C05_VN_" + _datetimenow + ".pdf"); SessionData.CurrentUser.FilePreview = "/Content/Export/" + "C05_VN_" + _datetimenow + ".pdf"; } } else { if (applicationHeaderInfo.Languague_Code == Language.LangVI) { fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "C05_VN_" + _datetimenow + ".pdf"); SessionData.CurrentUser.FilePreview = "/Content/Export/" + "C05_VN_" + _datetimenow + ".pdf"; } else { _tempfile = "TM_PLC05_KN_EN.rpt"; // tiếng anh fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "C05_EN_" + _datetimenow + ".pdf"); SessionData.CurrentUser.FilePreview = "/Content/Export/" + "C05_EN_" + _datetimenow + ".pdf"; } } oRpt.Load(Path.Combine(Server.MapPath("~/Report/"), _tempfile)); if (_ds_all != null) { _ds_all.Tables[0].TableName = "Table"; // đè các bản dịch lên if (p_View_Translate == 1) { // nếu là bản xem của thằng dịch App_Translate_BL _App_Translate_BL = new App_Translate_BL(); List <App_Translate_Info> _lst_translate = _App_Translate_BL.App_Translate_GetBy_AppId(pAppHeaderId); AppsCommon.Overwrite_DataSouce_Export(ref _ds_all, _lst_translate); } oRpt.Database.Tables["Table"].SetDataSource(_ds_all.Tables[0]); //oRpt.SetDataSource(_ds_all); } oRpt.Refresh(); Response.Buffer = false; Response.ClearContent(); Response.ClearHeaders(); System.IO.Stream oStream = oRpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); byte[] byteArray = new byte[oStream.Length]; oStream.Read(byteArray, 0, Convert.ToInt32(oStream.Length - 1)); System.IO.File.WriteAllBytes(fileName_pdf, byteArray.ToArray()); // Requires System.Linq return(Json(new { success = 0 })); } catch (Exception ex) { Logger.LogException(ex); return(Json(new { success = 0 })); } }
public FixConstruct(BinaryReader reader) : base(reader) { Rotation = ConvertData.ToMatrix3x3(reader); fixtransform = Rotation * Matrix4x4.CreateTranslation(Origin); }
/// <summary> /// 时间校准 /// </summary> /// <param name="b"></param> /// <param name="bCount"></param> /// <returns></returns> private static byte[] OnResolveTime(byte[] b, int bCount) { if (BitConverter.ToUInt16(b, 22) != ConvertData.CRC16(b, 8, 14))//检验和 { return(null); } string tStr = ConvertData.ToHexString(b, 0, 2);//获取帧头 if (tStr != "7A7A") { return(null); } tStr = ConvertData.ToHexString(b, 16, 6);//获取时间 DateTime getdate = DateTime.ParseExact(tStr, "yyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture); DateTime now = System.DateTime.Now; double compare = (now - getdate).TotalMinutes; byte[] bytes = new byte[19]; if (compare > 1 || compare < 0) //需要 { bytes = new byte[19]; //数据长度 bytes[6] = 0x07; bytes[7] = 0x00; //////////时间校准标示//// bytes[8] = 0x01; //时间 bytes[9] = byte.Parse(now.Year.ToString().Substring(2, 2), System.Globalization.NumberStyles.HexNumber); bytes[10] = byte.Parse(now.Month.ToString(), System.Globalization.NumberStyles.HexNumber); bytes[11] = byte.Parse(now.Day.ToString(), System.Globalization.NumberStyles.HexNumber); bytes[12] = byte.Parse(now.Hour.ToString(), System.Globalization.NumberStyles.HexNumber); bytes[13] = byte.Parse(now.Minute.ToString(), System.Globalization.NumberStyles.HexNumber); bytes[14] = byte.Parse(now.Second.ToString(), System.Globalization.NumberStyles.HexNumber); //校验和 byte[] crc16 = BitConverter.GetBytes(ConvertData.CRC16(bytes, 8, 7)); bytes[15] = crc16[0];//0x00;//算校验和 bytes[16] = crc16[1]; //结束 bytes[17] = 0x7B; bytes[18] = 0x7B; } else //不需要 { bytes = new byte[13]; //长度 bytes[6] = 0x01; bytes[7] = 0x00; //数据区 bytes[8] = 0x00; //校验和 byte[] crc16 = BitConverter.GetBytes(ConvertData.CRC16(bytes, 8, 1)); bytes[9] = crc16[0];//0x00;//算校验和 bytes[10] = crc16[1]; //结束 bytes[11] = 0x7B; bytes[12] = 0x7B; } bytes[0] = 0x7A; bytes[1] = 0x7A; //协议版本 bytes[2] = 0x01; bytes[3] = 0x00; bytes[4] = 0x04; //命令字 bytes[5] = 0x08; return(bytes); }
bool Renter_CheckValidate() { try { #region Renter if (txtChose_Estate_Object.Text == "") { NoteBox.Show("Tên đối tượng BĐS không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtChose_Estate_Object.Focus(); return(false); } if (_Contract_Controller.CheckEstateByContract(c_Estate_Object_Info_Search.Estate_Id, (decimal)Enum_Contract_Type.Renter) == false) { NoteBox.Show("Đối tượng BĐS được cho thuê", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtChose_Estate_Object.Focus(); return(false); } if (txtRenter_Name.Text == "") { NoteBox.Show("Tên công ty yêu cầu môi giới không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtRenter_Name.Focus(); return(false); } if (txtAddress.Text == "") { NoteBox.Show("Địa chỉ công ty yêu cầu môi giới không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtAddress.Focus(); return(false); } if (txtUsers.Text == "") { NoteBox.Show("Tên người sử dụng không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtUsers.Focus(); return(false); } if (txtRepresentive.Text == "") { NoteBox.Show("Tên người đại diện không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtRepresentive.Focus(); return(false); } if (txtPhone.Text == "") { NoteBox.Show("Số điện thoại không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtPhone.Focus(); return(false); } #endregion #region Contract if (txtContract_Code.Text == "") { NoteBox.Show("Mã hợp đồng không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtContract_Code.Focus(); return(false); } //if (txtContract_Name.Text == "") //{ // NoteBox.Show("Tên hợp đồng không được để trống", "", NoteBoxLevel.Error); // tabContract.Focus(); // UpdateLayout(); // txtContract_Name.Focus(); // return false; //} if (!_Contract_Controller.Check_ExistContractCode(txtContract_Code.Text)) { NoteBox.Show("Mã hợp đồng đã tồn tại, tạo lại mã", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtContract_Code.Focus(); return(false); } if (dpFromDate.Text == "") { NoteBox.Show("Thời gian thuê từ ngày không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpFromDate.Focus(); return(false); } if (CheckValidate.CheckValidDate(dpFromDate.Text) == false) { NoteBox.Show("Thời gian thuê từ ngày không đúng định dạng", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpFromDate.Focus(); return(false); } if (dpToDate.Text == "") { NoteBox.Show("Thời gian thuê đến ngày không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpToDate.Focus(); return(false); } if (CheckValidate.CheckValidDate(dpToDate.Text) == false) { NoteBox.Show("Thời gian thuê đến ngày không đúng định dạng", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpToDate.Focus(); return(false); } if (dpContractDate.Text == "") { NoteBox.Show("Ngày ký hợp đồng không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpContractDate.Focus(); return(false); } if (CheckValidate.CheckValidDate(dpContractDate.Text) == false) { NoteBox.Show("Ngày ký hợp đồng không đúng định dạng", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpContractDate.Focus(); return(false); } if (ConvertData.ConvertString2Date(dpFromDate.Text).Date > ConvertData.ConvertString2Date(dpToDate.Text).Date) { NoteBox.Show("Thời gian thuê từ ngày phải nhỏ hơn đến ngày", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpFromDate.Focus(); return(false); } #endregion #region Fee if (txtFee.Text == "") { NoteBox.Show("Phí môi giới không được để trống", "", NoteBoxLevel.Error); tabFee.Focus(); UpdateLayout(); txtFee.Focus(); return(false); } if (!Check_validate_Fee()) { UpdateLayout(); txtFee.Focus(); return(false); } decimal _currecy = Convert.ToDecimal(cboCurrency.SelectedValue); if ((_currecy == (decimal)Enum_Contract_Currency.USD) && txtFee_Vnd.Text == "") { NoteBox.Show("Phí môi giới (VND) không được để trống", "", NoteBoxLevel.Error); tabFee.Focus(); UpdateLayout(); txtFee_Vnd.Focus(); return(false); } #endregion return(true); } catch (Exception ex) { ErrorLog.log.Error(ex.ToString()); return(false); } }
/// <summary> /// 心跳 /// </summary> /// <param name="b"></param> /// <param name="bCount"></param> /// <param name="client"></param> /// <param name="df"></param> /// <returns></returns> public static byte[] OnResolveHeabert(byte[] b, int bCount, TcpSocketClient client) { if (bCount != 0x1A) { return(null); } gdust_Heartbeat data = new gdust_Heartbeat(); string tStr = ConvertData.ToHexString(b, 0, 2);//获取帧头 if (tStr != "7A7A") { return(null); } byte[] t = new byte[8]; for (int i = 8, j = 0; i < 16; i++, j++) { t[j] = b[i]; } data.sn = Encoding.ASCII.GetString(t); tStr = ConvertData.ToHexString(b, 16, 6);//获取时间 DateTime getdate = DateTime.ParseExact(tStr, "yyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture); DateTime now = System.DateTime.Now; double compare = (now - getdate).TotalMinutes; byte[] bytes = new byte[19]; if (compare > 1 || compare < 0) //需要 { bytes = new byte[19]; //数据长度 bytes[6] = 0x07; bytes[7] = 0x00; //////////时间校准标示//// bytes[8] = 0x01; //时间 bytes[9] = byte.Parse(now.Year.ToString().Substring(2, 2), System.Globalization.NumberStyles.HexNumber); bytes[10] = byte.Parse(now.Month.ToString(), System.Globalization.NumberStyles.HexNumber); bytes[11] = byte.Parse(now.Day.ToString(), System.Globalization.NumberStyles.HexNumber); bytes[12] = byte.Parse(now.Hour.ToString(), System.Globalization.NumberStyles.HexNumber); bytes[13] = byte.Parse(now.Minute.ToString(), System.Globalization.NumberStyles.HexNumber); bytes[14] = byte.Parse(now.Second.ToString(), System.Globalization.NumberStyles.HexNumber); //校验和 byte[] crc16 = BitConverter.GetBytes(ConvertData.CRC16(bytes, 8, 7)); bytes[15] = crc16[0];//0x00;//算校验和 bytes[16] = crc16[1]; //结束 bytes[17] = 0x7B; bytes[18] = 0x7B; data.Rtc = now.ToString("yyyy-MM-dd HH:mm:ss"); } else //不需要 { bytes = new byte[13]; //长度 //7A7A0100000001000000007B7B bytes[6] = 0x01; bytes[7] = 0x00; //数据区 bytes[8] = 0x00; //校验和 byte[] crc16 = BitConverter.GetBytes(ConvertData.CRC16(bytes, 8, 1)); bytes[9] = crc16[0];//0x00;//算校验和 bytes[10] = crc16[1]; //结束 bytes[11] = 0x7B; bytes[12] = 0x7B; data.Rtc = DateTime.ParseExact(tStr, "yyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture).ToString("yyyy-MM-dd HH:mm:ss"); } bytes[0] = 0x7A; bytes[1] = 0x7A; //协议版本 bytes[2] = 0x01; bytes[3] = 0x00; bytes[4] = 0x04; //命令字 bytes[5] = 0x00; //包装 //更新在线时间 Dust_noise_operation.Update_equminet_last_online_time(data.sn, DPC.DPC_Tool.GetTimeStamp(DateTime.Now)); return(bytes); }
public void EndInfo() { DataTable dt2 = ConvertData.JsonToDataTable2(CheckData.Value.ToString()); SetControlValue(dt2.Rows.Count - 1); }
void ParseRsp(ProtocolStruct Data) { switch (Data.Code) { case PassiveRcp.RCP_CMD_INFO: if (Data.Length > 0 && Data.Type == 0) { #region ---Parameter--- string strInfo = Encoding.ASCII.GetString(Data.Payload, 0, Data.Length); /* * if (Data.Payload[17] == 'W') * { * if (!this.tabPassive.TabPages.Contains(this.tabWifiSettings)) * { * this.tabPassive.TabPages.Add(this.tabWifiSettings); * this.tabPassive.Refresh(); * } * } * else * { * if (this.tabPassive.TabPages.Contains(this.tabWifiSettings)) * { * this.tabPassive.TabPages.Remove(this.tabWifiSettings); * this.tabPassive.Refresh(); * } * } */ SystemPub.ADRcp.Mode = strInfo.Substring(18, 1); SystemPub.ADRcp.Version = strInfo.Substring(19, 5); SystemPub.ADRcp.Address = Convert.ToInt32(strInfo.Substring(29, 5)); //ucWifiSettings1.mADRcp = SystemPub.ADRcp; #endregion ResetOperation(); } break; case PassiveRcp.RCP_CMD_EPC_IDEN: if (Data.Length > 0 && Data.Type == 0) { //utxtCard.InputMask = GetUserTextBoxMask(Convert.ToInt32(Data.Length - 1)); CardID.Text = ConvertData.ByteArrayToHexString(Data.Payload, 1, Data.Length - 1); } break; /* * case PassiveRcp.RCP_CMD_EPC_MULT: * case PassiveRcp.RCP_CMD_ISO6B_IDEN: * if (Data.Length > 0 && (Data.Type == 0 || Data.Type == 0x32)) * { * CardID.Text = ConvertData.ByteArrayToHexString(Data.Payload, 1, Data.Length - 1); * } * break; * case 0x22: * Data.Code = 0x10; * Data.Type = 0x32; * List<CardParameters> tempArray2 = new List<CardParameters>(); * List<byte> bytTempArray2 = new List<byte>(Data.ToArray()); * if (PDataManage.InputManage(ref bytTempArray2, ref tempArray2)) * { * //cdgvShow.Add(tempArray2); * MessageBox.Show("Not Handled"); * * } * break; */ } }
public ActionResult ExportData_View(decimal pAppHeaderId, string p_appCode, decimal p_View_Translate) { try { string _datetimenow = DateTime.Now.ToString("ddMMyyyyHHmm"); string language = AppsCommon.GetCurrentLang(); var objBL = new A02_BL(); List <A02_Info_Export> _lst = new List <A02_Info_Export>(); List <AppDocumentInfo> appDocumentInfos = new List <AppDocumentInfo>(); List <AppFeeFixInfo> _lst_appFeeFixInfos = new List <AppFeeFixInfo>(); ApplicationHeaderInfo applicationHeaderInfo = new ApplicationHeaderInfo(); List <AuthorsInfo> _lst_authorsInfos = new List <AuthorsInfo>(); List <Other_MasterInfo> _lst_Other_MasterInfo = new List <Other_MasterInfo>(); List <AppDocumentOthersInfo> _LstDocumentOthersInfo = new List <AppDocumentOthersInfo>(); List <AppDocumentOthersInfo> pLstImageDesign = new List <AppDocumentOthersInfo>(); A02_Info_Export app_Detail = objBL.GetByID_Exp(pAppHeaderId, language, ref applicationHeaderInfo, ref appDocumentInfos, ref _lst_appFeeFixInfos, ref _lst_authorsInfos, ref _lst_Other_MasterInfo, ref _LstDocumentOthersInfo, ref pLstImageDesign); Prepare_Data_Export_A02(ref app_Detail, applicationHeaderInfo, appDocumentInfos, _lst_appFeeFixInfos, _lst_authorsInfos, _lst_Other_MasterInfo, _LstDocumentOthersInfo, pLstImageDesign); _lst.Add(app_Detail); DataSet _ds_all = ConvertData.ConvertToDataSet <A02_Info_Export>(_lst, false); _ds_all.WriteXml(@"C:\inetpub\A02.xml", XmlWriteMode.WriteSchema); CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); string fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A02_VN_" + _datetimenow + ".pdf"); string _tempfile = "A02.rpt"; if (p_View_Translate == 1) { // nếu là tiếng việt thì xem bản tiếng anh và ngược lại if (app_Detail.Languague_Code == Language.LangVI) { _tempfile = "A02_EN.rpt"; // tiếng anh fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A02_EN_" + _datetimenow + ".pdf"); SessionData.CurrentUser.FilePreview = "/Content/Export/" + "A02_EN_" + _datetimenow + ".pdf"; } else { fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A02_VN_" + _datetimenow + ".pdf"); SessionData.CurrentUser.FilePreview = "/Content/Export/" + "A02_VN_" + _datetimenow + ".pdf"; } } else { if (app_Detail.Languague_Code == Language.LangVI) { fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A02_VN_" + _datetimenow + ".pdf"); SessionData.CurrentUser.FilePreview = "/Content/Export/" + "A02_VN_" + _datetimenow + ".pdf"; } else { _tempfile = "A02_EN.rpt"; // tiếng anh fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A02_EN_" + _datetimenow + ".pdf"); SessionData.CurrentUser.FilePreview = "/Content/Export/" + "A02_EN_" + _datetimenow + ".pdf"; } } oRpt.Load(Path.Combine(Server.MapPath("~/Report/"), _tempfile)); if (_ds_all != null) { _ds_all.Tables[0].TableName = "Table1"; oRpt.SetDataSource(_ds_all); } oRpt.Refresh(); Response.Buffer = false; Response.ClearContent(); Response.ClearHeaders(); //oRpt.ExportToDisk(ExportFormatType.PortableDocFormat, fileName_pdf); System.IO.Stream oStream = oRpt.ExportToStream(ExportFormatType.PortableDocFormat); byte[] byteArray = new byte[oStream.Length]; oStream.Read(byteArray, 0, Convert.ToInt32(oStream.Length - 1)); System.IO.File.WriteAllBytes(fileName_pdf, byteArray.ToArray()); // Requires System.Linq return(Json(new { success = 0 })); } catch (Exception ex) { Logger.LogException(ex); return(Json(new { success = 0 })); } }
public ActionResult ExportData_View_IU(ApplicationHeaderInfo pInfo, A05_Info pDetail, List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo, List <Other_MasterInfo> pOther_MasterInfo, List <AppClassDetailInfo> pAppClassInfo, List <AppDocumentOthersInfo> pAppDocOtherInfo ) { try { string _datetimenow = DateTime.Now.ToString("ddMMyyyyHHmm"); string language = AppsCommon.GetCurrentLang(); var objBL = new A05_BL(); List <A05_Info_Export> _lst = new List <A05_Info_Export>(); string p_appCode = "A05_Preview"; string fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A05_VN_" + _datetimenow + ".pdf"); if (language == Language.LangVI) { fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A05_VN_" + _datetimenow + ".pdf"); SessionData.CurrentUser.FilePreview = "/Content/Export/" + "A05_VN_" + _datetimenow + ".pdf"; } else { fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A05_EN_" + _datetimenow + ".pdf"); SessionData.CurrentUser.FilePreview = "/Content/Export/" + "A05_EN_" + _datetimenow + ".pdf"; } A05_Info_Export _A05_Info_Export = new A05_Info_Export(); if (string.IsNullOrEmpty(pDetail.IMG_URL)) { pDetail.IMG_URL = pDetail.IMG_URLOrg; } if (pDetail.pfileLogo != null) { pDetail.IMG_URL = AppLoadHelpers.PushFileToServer(pDetail.pfileLogo, AppUpload.Logo); } A05_Info_Export.CopyA05_Info(ref _A05_Info_Export, pDetail); _A05_Info_Export.IMG_URL = Server.MapPath(_A05_Info_Export.IMG_URL); // Phí cố định List <AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_A05(pDetail, pAppDocumentInfo); Prepare_Data_Export_A05(ref _A05_Info_Export, pInfo, pAppDocumentInfo, _lstFeeFix, pOther_MasterInfo, pAppDocOtherInfo); _lst.Add(_A05_Info_Export); DataSet _ds_all = ConvertData.ConvertToDataSet <A05_Info_Export>(_lst, false); //_ds_all.WriteXml(@"C:\inetpub\A05.xml", XmlWriteMode.WriteSchema); CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); string _tempfile = "A05.rpt"; if (pInfo.View_Language_Report == Language.LangEN) { _tempfile = "A05_EN.rpt"; } oRpt.Load(Path.Combine(Server.MapPath("~/Report/"), _tempfile)); #region Set vị trí ảnh CrystalDecisions.CrystalReports.Engine.PictureObject _pic01; _pic01 = (CrystalDecisions.CrystalReports.Engine.PictureObject)oRpt.ReportDefinition.Sections[0].ReportObjects["Picture1"]; _pic01.Width = 200; _pic01.Height = 200; try { pDetail.IMG_URL = Server.MapPath(pDetail.IMG_URL); Bitmap img = new Bitmap(pDetail.IMG_URL); try { double _Const = 6.666666666666 / 2; int _left = 0, _top = 0, _marginleft = 225, _margintop = 3540; int _h = 600; double _d1 = (_h - img.Width) / 2; _d1 = _Const * _d1; _left = _marginleft + Convert.ToInt32(_d1); if (_left < 0) { _left = _marginleft; } _pic01.Left = _left; // top _d1 = (_h - img.Height) / 2; _d1 = _Const * _d1; _top = _margintop + Convert.ToInt32(_d1); if (_top < 0) { _top = _margintop; } _pic01.Top = _top; } catch (Exception ex) { Logger.LogException(ex); } finally { img.Dispose(); } } catch (Exception) { } System.IO.FileInfo file = new System.IO.FileInfo(pDetail.IMG_URL); #endregion if (_ds_all != null) { _ds_all.Tables[0].TableName = "Table1"; oRpt.SetDataSource(_ds_all); } oRpt.Refresh(); Response.Buffer = false; Response.ClearContent(); Response.ClearHeaders(); System.IO.Stream oStream = oRpt.ExportToStream(ExportFormatType.PortableDocFormat); byte[] byteArray = new byte[oStream.Length]; oStream.Read(byteArray, 0, Convert.ToInt32(oStream.Length - 1)); System.IO.File.WriteAllBytes(fileName_pdf, byteArray.ToArray()); // Requires System.Linq return(Json(new { success = 0 })); } catch (Exception ex) { Logger.LogException(ex); return(Json(new { success = 0 })); } }
bool Renter_CheckValidate() { try { #region Renter if (txtRenter_Name.Text == "") { NoteBox.Show("Tên công ty yêu cầu môi giới không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtRenter_Name.Focus(); return(false); } if (txtAddress.Text == "") { NoteBox.Show("Địa chỉ công ty yêu cầu môi giới không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtAddress.Focus(); return(false); } if (txtUsers.Text == "") { NoteBox.Show("Tên người sử dụng không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtUsers.Focus(); return(false); } if (txtRepresentive.Text == "") { NoteBox.Show("Tên người đại diện không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtRepresentive.Focus(); return(false); } if (txtPhone.Text == "") { NoteBox.Show("Số điện thoại không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtPhone.Focus(); return(false); } #endregion #region Contract if (txtContract_Code.Text == "") { NoteBox.Show("Mã hợp đồng không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtContract_Code.Focus(); return(false); } if (!_Contract_Controller.Check_ExistContractCode(txtContract_Code.Text) && txtContract_Code.Text != c_Contract_Info.Contract_Code) { NoteBox.Show("Mã hợp đồng đã tồn tại, tạo lại mã", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtContract_Code.Focus(); return(false); } if (txtPrice.Text == "") { NoteBox.Show("Tiền thuê nhà không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtPrice.Focus(); return(false); } if (dpFromDate.Text == "") { NoteBox.Show("Thời gian thuê từ ngày không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpFromDate.Focus(); return(false); } if (CheckValidate.CheckValidDate(dpFromDate.Text) == false) { NoteBox.Show("Thời gian thuê từ ngày không đúng định dạng", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpFromDate.Focus(); return(false); } if (dpToDate.Text == "") { NoteBox.Show("Thời gian thuê đến ngày không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpToDate.Focus(); return(false); } if (CheckValidate.CheckValidDate(dpToDate.Text) == false) { NoteBox.Show("Thời gian thuê đến ngày không đúng định dạng", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpToDate.Focus(); return(false); } if (dpContractDate.Text == "") { NoteBox.Show("Ngày ký hợp đồng không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpContractDate.Focus(); return(false); } if (CheckValidate.CheckValidDate(dpContractDate.Text) == false) { NoteBox.Show("Ngày ký hợp đồng không đúng định dạng", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpContractDate.Focus(); return(false); } if (ConvertData.ConvertString2Date(dpFromDate.Text).Date > ConvertData.ConvertString2Date(dpToDate.Text).Date) { NoteBox.Show("Thời gian thuê từ ngày phải nhỏ hơn đến ngày", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpFromDate.Focus(); return(false); } #endregion #region Fee if (txtFee.Text == "") { NoteBox.Show("Phí môi giới không được để trống", "", NoteBoxLevel.Error); tabFee.Focus(); UpdateLayout(); txtFee.Focus(); return(false); } if (Check_validate_Fee() == false) { tabFee.Focus(); UpdateLayout(); txtFee.Focus(); return(false); } decimal _currecy = Convert.ToDecimal(cboCurrency.SelectedValue); if ((_currecy == (decimal)Enum_Contract_Currency.USD) && txtFee_Vnd.Text == "") { NoteBox.Show("Phí môi giới (VND) không được để trống", "", NoteBoxLevel.Error); tabFee.Focus(); UpdateLayout(); txtFee_Vnd.Focus(); return(false); } #endregion #region Extend if (Convert.ToDecimal(cboStatusContract.SelectedValue) == (decimal)Enum_Contract_Status.Gia_Han) { if (dpFromDate_Extend.Text == "") { NoteBox.Show("Thời gian thuê từ ngày không được để trống", "", NoteBoxLevel.Error); tabExtend.Focus(); UpdateLayout(); dpFromDate_Extend.Focus(); return(false); } if (CheckValidate.CheckValidDate(dpFromDate_Extend.Text) == false) { NoteBox.Show("Thời gian thuê từ ngày không đúng định dạng", "", NoteBoxLevel.Error); tabExtend.Focus(); UpdateLayout(); dpFromDate_Extend.Focus(); return(false); } if (dpToDate_Extend.Text == "") { NoteBox.Show("Thời gian thuê đến ngày không được để trống", "", NoteBoxLevel.Error); tabExtend.Focus(); UpdateLayout(); dpToDate_Extend.Focus(); return(false); } if (CheckValidate.CheckValidDate(dpToDate_Extend.Text) == false) { NoteBox.Show("Thời gian thuê đến ngày không đúng định dạng", "", NoteBoxLevel.Error); tabExtend.Focus(); UpdateLayout(); dpToDate_Extend.Focus(); return(false); } if (ConvertData.ConvertString2Date(dpFromDate_Extend.Text).Date > ConvertData.ConvertString2Date(dpToDate_Extend.Text).Date) { NoteBox.Show("Thời gian thuê từ ngày phải nhỏ hơn đến ngày", "", NoteBoxLevel.Error); tabExtend.Focus(); UpdateLayout(); dpFromDate_Extend.Focus(); return(false); } if (txtFee_Extend.Text == "") { NoteBox.Show("Phí môi giới không được để trống", "", NoteBoxLevel.Error); tabExtend.Focus(); UpdateLayout(); txtFee_Extend.Focus(); return(false); } if (Check_validate_Fee_Extend() == false) { tabExtend.Focus(); UpdateLayout(); txtFee_Extend.Focus(); return(false); } if ((_currecy == (decimal)Enum_Contract_Currency.USD) && txtFee_Vnd_Extend.Text == "") { NoteBox.Show("Phí môi giới (VND) không được để trống", "", NoteBoxLevel.Error); tabExtend.Focus(); UpdateLayout(); txtFee_Vnd_Extend.Focus(); return(false); } } #endregion if ((Convert.ToDecimal(cboStatusContract.SelectedValue) == (decimal)Enum_Contract_Status.Close || Convert.ToDecimal(cboStatusContract.SelectedValue) == (decimal)Enum_Contract_Status.Het_Han || Convert.ToDecimal(cboStatusContract.SelectedValue) == (decimal)Enum_Contract_Status.Dong_Trc_Thoi_Han) && Check_Is_DongHopDong() == false) { NoteBox.Show("Chưa thanh toán hết phí không thể đóng hoặc sửa trạng thái hợp đồng", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); cboStatusContract.Focus(); return(false); } return(true); } catch (Exception ex) { ErrorLog.log.Error(ex.ToString()); return(false); } }
public LooseConstruct(BinaryReader reader, ConstructCollection constructs) : base(reader, constructs) { Rotation = ConvertData.ToMatrix3x3(reader); }