private void SendEmail() { string context = ""; int ReportID = 18; //Luu thong tin UpdateSoDonNhan(); string inputValue = "<RequestParams RefType=\"{6}\" Context=\"{3}\" RefNo=\"{0}\" ViewID=\"38\" ViewerID=\"{5}\" ID=\"{4}\" IncludeSign=\"1\" Email=\"{7}\" SoNhanDon=\"{8}\" FileNumber=\"{9}\"/>"; inputValue = string.Format(inputValue, CXML.HtmlEnCode(this.CurrentTransaction.RefNo), CSession.UserID, CSession.CLIENT_KEY, context, this.CurrentTransaction.ID, ReportID, this.CurrentTransaction.RefType, EmailKH, txtNumber.Text, this.CurrentTransaction.FileNumber); inputValue = CXML.AddAuthenticate(inputValue); string result = CServiceReference.AssetService.SendGCN(CSession.CLIENT_KEY, inputValue); //FWS.TTDKGDTS.ImportTool.ServiceReference.Soap.CApplicationMessage message = CServiceReference.AssetService.UpdateAndSendReport(CSession.CLIENT_KEY, inputValue); BusinessObject.CApplicationMessage message = CObjectMapper.FromCSV <BusinessObject.CApplicationMessage>(result)[0]; if (message.IsSuccessfull) { ShowInfo(message.Description); } else { ShowError(message.Description); } }
private void SendEmail() { string context = "HANOI_TBHUY"; //int ReportID = 18; //Luu thong tin //UpdateInfo(); if (UpdateTransaction()) { string inputValue = "<RequestParams Context=\"{0}\" RegisTransRefNo=\"{1}\" ViewID=\"35\" ViewerID=\"25\" RefNo=\"{2}\" ObjectID=\"{3}\" Email=\"{4}\" IncludeSign=\"1\"/>"; inputValue = string.Format(inputValue, context, CXML.HtmlEnCode(this.CurrentTransaction.RegisTransRefNo), CXML.HtmlEnCode(this.RefNo), this.ObjectID, txtEmail.Text); inputValue = CXML.AddAuthenticate(inputValue); string result = CServiceReference.AssetService.SendReport(CSession.CLIENT_KEY, inputValue); //FWS.TTDKGDTS.ImportTool.ServiceReference.Soap.CApplicationMessage message = CServiceReference.AssetService.UpdateAndSendReport(CSession.CLIENT_KEY, inputValue); BusinessObject.CApplicationMessage message = CObjectMapper.FromCSV <BusinessObject.CApplicationMessage>(result)[0]; if (message.IsSuccessfull) { ShowInfo(message.Description); } else { ShowError(message.Description); } } else { ShowError(Message); } }
private BusinessObject.CApplicationMessage InsertTransaction(CTransaction trans) { try { string requestParams = trans.GetRequestParams(" Function=\"Transaction_Asset\" Action=\"IMPORTTOOL\" "); //XmlDocument doc = new XmlDocument(); //doc.LoadXml(requestParams); //CCoreService service = new CCoreService(); requestParams = CXML.AddAuthenticate(requestParams); string result = CServiceReference.CoreService.ExecuteAction(CLIENT_KEY, FWS.VnAccounting.Service.Data.Utils.CXML.HtmlEnCode(requestParams)); List <BusinessObject.CApplicationMessage> message = CObjectMapper.FromCSV <BusinessObject.CApplicationMessage>(result, 1); if (message[0].IsSuccessfull) { //trans.ID = int.Parse(message[0].Result.ToString()); return(message[0]); } //MessageBox.Show(message[0].Description); return(message[0]); } catch (Exception ex) { return(new BusinessObject.CApplicationMessage() { Description = ex.Message }); } }
private void txtNumber_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Tab) { string inputValue = "<RequestParams Function=\"::R|DOC|Items_NhanDon\" Number=\"{0}\" FromDate=\"{1}\" />"; inputValue = string.Format(inputValue, txtNumber.Text, string.Format("{0}-{1}-{2}", txtReceiveYear.Text, txtReceiveMonth.Text, txtReceiveDay.Text)); inputValue = CXML.AddAuthenticate(inputValue); string data = CServiceReference.CoreService.GetContextData(CSession.CLIENT_KEY, inputValue); List <CNhanDon> list = CObjectMapper.FromCSV <CNhanDon>(data, 1); if (list != null && list.Count > 0) { txtEmail.Text = list[0].Email; } else { txtEmail.Text = ""; } txtEmail.Focus(); HandleKeyDown = true; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private static bool GetUpdate() { string input = CXML.AddAuthenticate("<RequestParams Function=\"VersionInfo\" />"); string data = CServiceReference.CoreService.GetContextData(CSession.CLIENT_KEY, input); List <CVersionInfo> versions = CObjectMapper.FromCSV <CVersionInfo>(data, 1); if (versions != null && versions.Count > 0) { //Neu co version moi IniFile mIni = new IniFile(Application.StartupPath + "\\Version.ini"); string currentVersion = Application.ProductVersion;// mIni.IniReadValue("Version", "iProfile_TradingOnline"); //Neu co Version moi if (!currentVersion.Equals(versions[0].Version)) { //Luu version va link download vao file Ini de chuong trinh update cap nhat mIni.IniWriteValue("Version", "iProfile_TradingOnline", versions[0].Version); mIni.IniWriteValue("Link", "iProfile_TradingOnline", versions[0].LinkUpdate); //Goi chuong trinh update Process prLiveUpdate = new Process(); prLiveUpdate.StartInfo.FileName = Application.StartupPath + "\\LiveUpdate.exe"; prLiveUpdate.Start(); //GlobalDeleteAtom(Atom); return(false); } } return(true); }
private BusinessObject.CApplicationMessage UpdateInfo() { string inputValue = "<RequestParams RefType=\"28\" Context=\"TOOL\" Function=\"Transaction_Asset\" Action=\"UpdateSendEmail\" ID=\"{0}\" Email=\"{1}\" />"; inputValue = string.Format(inputValue, this.CurrentTransaction.ID, txtEmail.Text); inputValue = CXML.AddAuthenticate(inputValue); string result = CServiceReference.CoreService.ExecuteAction(CSession.CLIENT_KEY, inputValue); List <BusinessObject.CApplicationMessage> mess = CObjectMapper.FromCSV <BusinessObject.CApplicationMessage>(result); if (mess != null && mess.Count > 0) { return(mess[0]); } return(null); }
private CApplicationMessage UpdateSoDonNhan() { string inputValue = "<RequestParams RefType=\"21\" Context=\"TOOL\" Function=\"Transaction_Asset\" Action=\"UpdateGCNEmail\" RefNo=\"{0}\" ID=\"{1}\" SoDonNhan=\"{2}\" SendGCNEmail=\"{3}\"/>"; inputValue = string.Format(inputValue, CXML.HtmlEnCode(this.CurrentTransaction.RefNo), this.CurrentTransaction.ID, txtNumber.Text, txtEmail.Text); inputValue = CXML.AddAuthenticate(inputValue); string result = CServiceReference.CoreService.ExecuteAction(CSession.CLIENT_KEY, inputValue); List <CApplicationMessage> mess = CObjectMapper.FromCSV <CApplicationMessage>(result); if (mess != null && mess.Count > 0) { return(mess[0]); } return(null); }
public bool UpdateTransaction() { UpdateSoDonNhan(); CurrentTransaction.ReceiveDateTime = GetReceiveDateTime();// txtReceiveDateTime.Value; CurrentTransaction.NumPagesAttachment = (int)txtNumPagesAttachment.Value; //CurrentTransaction.AssetIDCardNo = txtIDNo.Text; CurrentTransaction.AssetPersonalCode = txtPersonalCode.Text; string requestparams = CurrentTransaction.GetRequestParams("Function='Transaction_Asset' Action='UPDATEGCN'"); CCoreService service = new CCoreService(); requestparams = CXML.AddAuthenticate(requestparams); string messageCSV = service.ExecuteAction(CSession.CLIENT_KEY, CXML.HtmlEnCode(requestparams)); IList <FWS.TTDKGDTS.ImportTool.BusinessObject.CApplicationMessage> message = CObjectMapper.FromCSV <FWS.TTDKGDTS.ImportTool.BusinessObject.CApplicationMessage>(messageCSV, 1); if (message[0].Result == null || message[0].Result.ToString() == "" || message[0].Result.ToString() == "0") { MessageBox.Show(message[0].Description); return(false); } return(true); }
public bool UpdateTransaction() { // == Kiem tra RefNo truoc neu refno moi if (isNew) { string inputValue = string.Format("<InputValue RefType='28' RefDate='{0}'/>", DateTime.Now.ToString("yyyy-MM-dd")); CRefNo objRefNo = CServiceReference.CoreService.GetNextRefNo(inputValue); int compareResult = string.Compare(objRefNo.RefNo, txtRefNo.Text, true); if (compareResult > 0) { DialogResult dr = ShowQuestion("Số công văn đã thay đổi, số mới là:" + objRefNo.RefNo + ". Bạn có muốn in với số mới không?"); if (dr == DialogResult.Yes) { txtRefNo.Text = objRefNo.RefNo; } else { return(false); } } } // CurrentTransaction.OldRefNo = txtOldRefNo.Text; //CurrentTransaction.AssetType = int.Parse(txtAssetType.SelectedValue.ToString()); CurrentTransaction.RefDate = GetRefDateTime(); //CurrentTransaction.RefNo = txtRefNo.Text;// CurrentTransaction.RegisTransRefNo; //CurrentTransaction.RefType = 21; //CurrentTransaction.Type = int.Parse(txtVoucherActionType.SelectedValue.ToString()); //CurrentTransaction.ObjectID = int.Parse(txtDirection.SelectedValue.ToString()); CurrentTransaction.Note = txtReason.Text; CurrentTransaction.SendGCNEmail = txtEmail.Text; if (txtKHTX.SelectedItem != null) { CurrentTransaction.WarranterID = (int)txtKHTX.SelectedItem.Value; CurrentTransaction.WarranterName = txtKHTX.Text; CurrentTransaction.WarranterAddress = txtAddress.Text; //CurrentTransaction.ObjectEmail = txtObjectEmail.Text; } else { CurrentTransaction.WarranterID = 0; CurrentTransaction.WarranterName = txtKHTX.Text; CurrentTransaction.WarranterAddress = txtAddress.Text; //CurrentTransaction.ObjectEmail = txtObjectEmail.Text; } //CurrentTransaction.IsSendMail = chkSendMail.Checked; //CurrentTransaction.IsSendMailKH = chkSendEmailKH.Checked; //CurrentTransaction.WarranterEmail = txtWarranterEmail.Text; string requestparams = CurrentTransaction.GetRequestParams("Function='Transaction_Asset' Action='UPDATE' Context='TOOL'"); CCoreService service = new CCoreService(); requestparams = CXML.AddAuthenticate(requestparams); string messageCSV = service.ExecuteAction(CSession.CLIENT_KEY, CXML.HtmlEnCode(requestparams)); IList <FWS.TTDKGDTS.ImportTool.BusinessObject.CApplicationMessage> message = CObjectMapper.FromCSV <FWS.TTDKGDTS.ImportTool.BusinessObject.CApplicationMessage>(messageCSV, 1); if (message[0].Result == null || message[0].Result.ToString().Equals("") || message[0].Result.ToString().Equals("0")) { Message = message[0].Description; //MessageBox.Show(message[0].Description); return(false); } return(true); }
public void InitControl(string RefNo, int refType) { InitGridColumn(); RefType = refType; if (RefType == 26) { return; } //Kiem tra don co bi Block khong string inputValue = string.Format("<RequestParams Function='Transaction_Asset' Action=\"CheckAssetBlock\" RefType=\"21\" RefNo='{0}'/>", RefNo); inputValue = CXML.AddAuthenticate(inputValue); string datacsv = CServiceReference.CoreService.ExecuteAction(CSession.CLIENT_KEY, CXML.HtmlEnCode(inputValue)); IList <CApplicationMessage> mess = CObjectMapper.FromCSV <CApplicationMessage>(datacsv, 1); if (mess != null && mess.Count > 0) { if (string.IsNullOrEmpty(mess[0].Result.ToString()) || mess[0].Result.Equals("0")) { MessageBox.Show(mess[0].Description); } } else { MessageBox.Show("Có lỗi khi kiểm tra phong tỏa tài sản."); } //Lay du lieu tu so don dang ky //CCoreService service = new CCoreService(); inputValue = string.Format("<RequestParams Function='GetTransaction_Asset' RefType='21' RefNo='{0}' Status='0,1' />", RefNo); inputValue = inputValue + string.Format("<RequestParams Function='GetTransaction_Asset' RefType='21' RefNo='{0}' Context='WarranterList'/>", RefNo); inputValue = inputValue + string.Format("<RequestParams Function='GetTransaction_Asset' RefType='21' RefNo='{0}' Context='AssetOwnerList'/>", RefNo); datacsv = CServiceReference.CoreService.GetContextData(CSession.CLIENT_KEY, CXML.HtmlEnCode(inputValue)); IList <CTransaction> trans = CObjectMapper.FromCSV <CTransaction>(datacsv, 1); List <Person> warranter = CObjectMapper.FromCSV <Person>(datacsv, 2); List <Person> assetownner = CObjectMapper.FromCSV <Person>(datacsv, 3); if (warranter == null) { warranter = new List <Person>(); } if (assetownner == null) { assetownner = new List <Person>(); } if (trans.Count > 0) { trans[0].ReceiveDateTime = trans[0].ReceiveDateTime <= new DateTime(1901, 01, 01) ? trans[0].RefDate : trans[0].ReceiveDateTime; txtRefNo.Text = trans[0].RefNo; txtReceiveHour.Text = trans[0].ReceiveDateTime.Hour.ToString(); txtReceiveMin.Text = trans[0].ReceiveDateTime.Minute.ToString(); txtReceiveDay.Text = trans[0].ReceiveDateTime.Day.ToString(); txtReceiveMonth.Text = trans[0].ReceiveDateTime.Month.ToString(); txtReceiveYear.Text = trans[0].ReceiveDateTime.Year.ToString(); //txtReceiveDateTime.Value = trans[0].ReceiveDateTime<new DateTime(1901,01,01)?DateTime.Now:trans[0].ReceiveDateTime; txtNumPagesAttachment.Value = trans[0].NumPagesAttachment <= 0 ? 2 : trans[0].NumPagesAttachment; //txtIDNo.Text = trans[0].AssetIDCardNo; txtPersonalCode.Text = trans[0].AssetPersonalCode; CurrentTransaction = trans[0]; CurrentTransaction.WarranterList = warranter; CurrentTransaction.AssetOwnnerList = assetownner; txtOrgRefNo.Text = trans[0].OldRefNo; txtNumber.Text = trans[0].SoDonNhan; txtEmail.Text = trans[0].SendGCNEmail; //gia lap //trans[0].FileNumber = "1024.pdf"; lbAttachName.Text = trans[0].RefNo + ".pdf"; CheckFileExists(); BindingSource source = new BindingSource(); source.DataSource = CurrentTransaction.WarranterList; grWarranter.DataSource = source; BindingSource ownnersource = new BindingSource(); ownnersource.DataSource = CurrentTransaction.AssetOwnnerList; grAssetOwnner.DataSource = ownnersource; //Neu la don Xoa thi khong hien thi Ma ca nhan if (trans[0].Type == 95) { pnPesonalCode.Visible = false; } else { pnPesonalCode.Visible = true; } } }