internal void RunTask(object task, callType taskType) { this.domainUnload.Type = fastCSharp.domainUnload.unloadType.None; this.onErrorType = errorType.None; this.task.Set(task, taskType); waitHandle.Set(); }
public static string SetType(string ErrorCode, errorType eType) { string sRet = ""; if (eType == errorType.ConnectionError) { sRet = ErrorCode + " (Connection Error)"; } if (eType == errorType.DataOperationError) { sRet = ErrorCode + " (Data Operation Error)"; } if (eType == errorType.SendMailError) { sRet = ErrorCode + " (Send Mail Error)"; } if (eType == errorType.ReportError) { sRet = ErrorCode + " (Report Error)"; } if (eType == errorType.LoginError) { sRet = ErrorCode + " (Login Error)"; } if (eType == errorType.PermissionError) { sRet = ErrorCode + " (Permission Error)"; } return(sRet); }
internal void RunTask(object task, object onError, object domainUnload, callType taskType, errorType onErrorType, domainUnload.unloadType domainUnloadType) { this.domainUnload.Set(domainUnload, domainUnloadType); this.onError = onError; this.onErrorType = onErrorType; this.task.Set(task, taskType); waitHandle.Set(); }
/// <summary> /// 线程池线程 /// </summary> /// <param name="threadPool">线程池</param> /// <param name="stackSize">堆栈大小</param> /// <param name="task">任务委托</param> /// <param name="taskType">任务委托调用类型</param> internal thread(threadPool threadPool, int stackSize, object task, callType taskType) { this.task.Set(task, taskType); this.domainUnload.Type = fastCSharp.domainUnload.unloadType.None; this.onErrorType = errorType.None; waitHandle = new autoWaitHandle(false); this.threadPool = threadPool; threadHandle = new Thread(run, stackSize); threadHandle.IsBackground = true; threadIndex = threads.Push(threadHandle); threadHandle.Start(); }
/// <summary> /// 线程池线程 /// </summary> /// <param name="threadPool">线程池</param> /// <param name="stackSize">堆栈大小</param> /// <param name="task">任务委托</param> /// <param name="domainUnload">应用程序退出处理</param> /// <param name="onError">应用程序退出处理</param> /// <param name="taskType">任务委托调用类型</param> /// <param name="domainUnloadType">应用程序退出处理调用类型</param> /// <param name="onErrorType">应用程序退出处理调用类型</param> internal thread(threadPool threadPool, int stackSize, object task, object onError, object domainUnload, callType taskType, errorType onErrorType, domainUnload.unloadType domainUnloadType) { this.task.Set(task, taskType); this.domainUnload.Set(domainUnload, domainUnloadType); this.onError = onError; this.onErrorType = onErrorType; waitHandle = new autoWaitHandle(false); this.threadPool = threadPool; threadHandle = new Thread(run, stackSize); threadHandle.IsBackground = true; threadIndex = threads.Push(threadHandle); threadHandle.Start(); }
/// <summary> /// Convenience method for creating an error record. /// </summary> /// <param name="statusCode">HTTP status code.</param> /// <param name="scope">The scope of the error.</param> /// <param name="message">Error message.</param> /// <returns>Error record.</returns> public static errorType CreateError(HttpStatusCode statusCode, string scope, string message = null) { var error = new errorType { id = Guid.NewGuid().ToString(), code = (uint)statusCode, scope = scope }; if (!string.IsNullOrWhiteSpace(message)) { error.message = message.Trim(); } return(error); }
public void NotifyAboutPaymentCancel(onlinePaymentCancelRequest OnlinePaymentCancelRequest) { //var soapRequest = TraceExtension.XmlRequest.OuterXml; //System.IO.File.AppendAllText(Settings.Default.LogFileDirectory + "log" + DateTime.Now.ToString() + ".txt", "Request : " + DateTime.Now + soapRequest + Environment.NewLine); SqlConnection sqlcon = new SqlConnection(); try { sqlcon.ConnectionString = SQLConnectionstring; sqlcon.Open(); } catch (Exception ex) { System.IO.File.AppendAllText(Settings.Default.LogFileDirectory + "log" + DateTime.Now.ToString("yyyyMMdd") + ".txt", DateTimeOffset.Now.ToString("yyyy-MM-ddTHH:mm:sszzz") + " - Error : " + ex.Message.ToString() + Environment.NewLine + SQLConnectionstring + Environment.NewLine); errorType ert = new errorType(); ert.errorCode = errorCode.SYSTEM_ERROR; ert.errorDateTime = DateTime.Now; ert.errorData = new object[1]; ert.errorData[0] = messageHeaderValue.receiverID; ert.errorObjectType = objectType.SYSTEM; CustomSOAPException myexp = new CustomSOAPException("NotifyAboutPaymentCancel", ert); throw myexp; } SqlCommand cmd = new SqlCommand("[dbo].[spCancelPayment]", sqlcon); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@receiptNumber", OnlinePaymentCancelRequest.canceledPayment.receiptNumber)); cmd.Parameters.Add(new SqlParameter("@cancelDateTime", OnlinePaymentCancelRequest.canceledPayment.cancelDateTime)); cmd.ExecuteNonQuery(); sqlcon.Close(); //var soapResponse = TraceExtension.XmlResponse.OuterXml; //System.IO.File.AppendAllText(Settings.Default.LogFileDirectory + "log" + DateTime.Now.ToString() + ".txt", // "INFO : " + DateTime.Now + soapResponse + Environment.NewLine); return; }
private static XmlNode toSOAPFaultDetail(errorType customError) { //create soap fault detail content XmlRootAttribute xmlRootAttribute = new XmlRootAttribute("WSException"); xmlRootAttribute.Namespace = "http://services.ws.gpp.sinam.net/"; XmlSerializer xmlSerializer = new XmlSerializer(typeof(errorType), xmlRootAttribute); XmlWriterSettings xws = new XmlWriterSettings(); xws.OmitXmlDeclaration = true; StringBuilder sw = new StringBuilder(); xmlSerializer.Serialize(XmlWriter.Create(sw, xws), customError, new XmlSerializerNamespaces(new XmlQualifiedName[] { new XmlQualifiedName("ns1", "http://services.ws.gpp.sinam.net/") })); //create soap fault detail root node XmlDocument xmlDoc = new XmlDocument(); XmlNode soapFaultDetailRootNode = xmlDoc.CreateNode(XmlNodeType.Element, SoapException.DetailElementName.Name, SoapException.DetailElementName.Namespace); //add soap fault detail content to fault root node soapFaultDetailRootNode.InnerXml = soapFaultDetailRootNode.InnerXml + sw.ToString(); return(soapFaultDetailRootNode); }
public static createType CreateCreate( HttpStatusCode statusCode, string id, string advisoryId = null, errorType error = null) { var create = new createType { statusCode = ((int)statusCode).ToString(), id = id }; if (StringUtils.NotEmpty(advisoryId)) { create.advisoryId = advisoryId; } if (error != null) { create.error = error; } return(create); }
public static deleteStatus CreateDelete(HttpStatusCode statusCode, string id, errorType error = null) { var status = new deleteStatus { statusCode = ((int)statusCode).ToString(), id = id }; if (error != null) { status.error = error; } return(status); }
public void CompletePaymentWithError(errorType error) { return; }
public ErrorModel(string message, errorType type) { this.message = message; this.type = type; }
public void CheckIfPaymentCancelAllowed(paymentCancelAllocationCheckRequest PaymentCancelAllocationCheckRequest) { //var soapRequest = TraceExtension.XmlRequest.OuterXml; //System.IO.File.AppendAllText(Settings.Default.LogFileDirectory + "log" + DateTime.Now.ToString() + ".txt", "Request : " + DateTime.Now + soapRequest + Environment.NewLine); SqlConnection sqlcon = new SqlConnection(); try { sqlcon.ConnectionString = SQLConnectionstring; sqlcon.Open(); } catch (Exception ex) { System.IO.File.AppendAllText(Settings.Default.LogFileDirectory + "log" + DateTime.Now.ToString("yyyyMMdd") + ".txt", DateTimeOffset.Now.ToString("yyyy-MM-ddTHH:mm:sszzz") + " - Error : " + ex.Message.ToString() + Environment.NewLine + SQLConnectionstring + Environment.NewLine); errorType ert = new errorType(); ert.errorCode = errorCode.SYSTEM_ERROR; ert.errorDateTime = DateTime.Now; ert.errorData = new object[1]; ert.errorData[0] = messageHeaderValue.receiverID; ert.errorObjectType = objectType.SYSTEM; CustomSOAPException myexp = new CustomSOAPException("CheckIfPaymentCancelAllowed", ert, "Verilənlər Bazasına qoşulmaq mümkün olmadı!"); throw myexp; } SqlCommand cmd = new SqlCommand("[dbo].[spCheckIfPaymentCancelAllowed]", sqlcon); //SqlDataReader reader; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@ReceiptNumber", PaymentCancelAllocationCheckRequest.receiptNumber)); SqlParameter returnParameter = cmd.Parameters.Add("RetVal", SqlDbType.Int); returnParameter.Direction = ParameterDirection.ReturnValue; cmd.ExecuteNonQuery(); int cacelallowed = (int)returnParameter.Value; sqlcon.Close(); if (cacelallowed == 0) { errorType ert = new errorType(); ert.errorCode = errorCode.NOT_ALLOWED; ert.errorDateTime = DateTime.Now; ert.errorData = new object[1]; ert.errorData[0] = PaymentCancelAllocationCheckRequest.receiptNumber; ert.errorObjectType = objectType.PAYMENT_CANCEL; CustomSOAPException myexp = new CustomSOAPException("CheckIfPaymentCancelAllowed", ert); throw myexp; } //var soapResponse = TraceExtension.XmlResponse.OuterXml; System.IO.File.AppendAllText(Settings.Default.LogFileDirectory + "log" + DateTimeOffset.Now.ToString("yyyyMMdd") + ".txt", DateTimeOffset.Now.ToString("yyyy-MM-ddTHH:mm:sszzz") + " - INFO : " + DateTimeOffset.Now.ToString("yyyy-MM-ddTHH:mm:sszzz") + PaymentCancelAllocationCheckRequest.receiptNumber + Environment.NewLine); return; }
public invoiceResponse GetInvoiceInfoByServiceCodeList(invoiceDefaultRequest InvoiceDefaultRequest, int[] ServiceCodeList) { // public invoiceResponse GetInvoiceInfoByServiceCodeList(int SCCode, string IdentificationSubtype, string AbonCode // , int[] ServiceCodeList) //{ // invoiceDefaultRequest InvoiceDefaultRequest = new invoiceDefaultRequest(); // InvoiceDefaultRequest.scCode = SCCode; // InvoiceDefaultRequest.identificationSubtype = IdentificationSubtype; // InvoiceDefaultRequest.abonCode = AbonCode; invoiceResponse invResp = new invoiceResponse(); //var soapRequest = TraceExtension.XmlRequest.OuterXml; //System.IO.File.AppendAllText(Settings.Default.LogFileDirectory + "log" + DateTime.Now.ToString() + ".txt", "Request : " + DateTime.Now + soapRequest + Environment.NewLine); invResp.serviceAccountPartial = new serviceAccountPartial(); invResp.serviceAccountPartial.abonCode = InvoiceDefaultRequest.abonCode; invResp.serviceAccountPartial.scCode = InvoiceDefaultRequest.scCode; invResp.serviceAccountPartial.identificationSubtype = InvoiceDefaultRequest.identificationSubtype; SqlConnection sqlcon = new SqlConnection(); try { sqlcon.ConnectionString = SQLConnectionstring; sqlcon.Open(); } catch (Exception ex) { System.IO.File.AppendAllText(Settings.Default.LogFileDirectory + "log" + DateTime.Now.ToString("yyyyMMdd") + ".txt", DateTimeOffset.Now.ToString("yyyy-MM-ddTHH:mm:sszzz") + " - Error : " + ex.Message.ToString() + Environment.NewLine + SQLConnectionstring + Environment.NewLine); errorType ert = new errorType(); ert.errorCode = errorCode.SYSTEM_ERROR; ert.errorDateTime = DateTime.Now; ert.errorData = new object[1]; ert.errorData[0] = InvoiceDefaultRequest.scCode; ert.errorObjectType = objectType.SYSTEM; CustomSOAPException myexp = new CustomSOAPException("GetInvoiceInfoByServiceCodeList", ert); throw myexp; } SqlCommand ckcmd = new SqlCommand("select * from Taxpayer where YVOK=@YVOK and Fordelete=1", sqlcon); ckcmd.Parameters.AddWithValue("@YVOK", InvoiceDefaultRequest.abonCode); SqlDataReader reader1 = ckcmd.ExecuteReader(); if (!(reader1.HasRows) || !(reader1.Read())) { errorType ert = new errorType(); ert.errorCode = errorCode.NOT_FOUND; ert.errorDateTime = DateTime.Now; ert.errorData = new object[1]; ert.errorData[0] = InvoiceDefaultRequest.abonCode; ert.errorObjectType = objectType.SERVICE_ACCOUNT; CustomSOAPException myexp = new CustomSOAPException("GetInvoiceInfoByServiceCodeList", ert); sqlcon.Close(); throw myexp; } reader1.Close(); string TaxpayerID = klas.getdatacell("select TaxpayerID from Taxpayer " + "where YVOK=N'" + InvoiceDefaultRequest.abonCode + "' and Fordelete=1"); DataTable dt = new DataTable(); if (TaxpayerID != null && ServiceCodeList.Length > 0) { //if (municipal.GetTaxesObjects(TaxpayerID,ServiceCodeList) != null) { dt = municipal.GetTaxesObjects(TaxpayerID, ServiceCodeList); } } DataTableReader reader; reader = dt.CreateDataReader(); int cnt = 0; List <invoice> invList = new List <invoice>(); while (reader.Read()) { int colIndex; invoice inv = new invoice(); colIndex = reader.GetOrdinal("InvoiceType"); //invoiceType invtype = new invoiceType(); //if (Enum.TryParse(reader[colIndex].ToString(), out invtype)) //{ inv.invoiceType = invoiceType.AVANS; //} //colIndex = reader.GetOrdinal("InvoiceDate"); //if (!reader.IsDBNull(colIndex)) //{ // inv.invoiceDate = reader.GetDateTime(colIndex); // inv.invoiceDateSpecified = true; //} colIndex = reader.GetOrdinal("AmountDue"); inv.amountDue = reader.IsDBNull(colIndex) ? 0 : reader.GetDecimal(colIndex); inv.amountDueSpecified = true; colIndex = reader.GetOrdinal("CurrentDebt"); inv.currentDebt = reader.IsDBNull(colIndex) ? 0 : reader.GetDecimal(colIndex); inv.currentDebtSpecified = true; colIndex = reader.GetOrdinal("PaymentReceiver"); int paymentReceiver = 0; if (Int32.TryParse(reader[colIndex].ToString(), out paymentReceiver)) { inv.paymentReceiverCode = paymentReceiver; inv.paymentReceiverCodeSpecified = true; } colIndex = reader.GetOrdinal("ServiceCode"); int serviceCode = 0; if (Int32.TryParse(reader[colIndex].ToString(), out serviceCode)) { inv.serviceCode = serviceCode; inv.serviceCodeSpecified = true; } //System.IO.File.AppendAllText(Settings.Default.LogFileDirectory + "log.txt", // "INFO:1:" + DateTime.Now + Environment.NewLine); //System.IO.File.AppendAllText(Settings.Default.LogFileDirectory + "log" + DateTime.Now.ToString() + ".txt", // "INFO:1:" + DateTime.Now + Environment.NewLine); invList.Add(inv); cnt++; } if (reader.HasRows) { invResp.invoiceList = invList.ToArray(); } else if (invList.Count != ServiceCodeList.Length) { errorType ert = new errorType(); ert.errorCode = errorCode.NOT_ALLOWED; ert.errorDateTime = DateTime.Now; ert.errorData = new object[1]; ert.errorData[0] = InvoiceDefaultRequest.abonCode; ert.errorObjectType = objectType.PRE_PAYMENT; CustomSOAPException myexp = new CustomSOAPException("GetInvoiceInfoByServiceCodeList", ert); throw myexp; } sqlcon.Close(); System.IO.File.AppendAllText(Settings.Default.LogFileDirectory + "log" + DateTimeOffset.Now.ToString("yyyyMMdd") + ".txt", DateTimeOffset.Now.ToString("yyyy-MM-ddTHH:mm:sszzz") + " - codelistinfo INFO : " + DateTimeOffset.Now.ToString("yyyy-MM-ddTHH:mm:sszzz") + InvoiceDefaultRequest.abonCode.ToString() + Environment.NewLine); //var soapResponse = TraceExtension.XmlResponse.OuterXml; //System.IO.File.AppendAllText(Settings.Default.LogFileDirectory + "log" + DateTime.Now.ToString() + ".txt", // "INFO : " + DateTime.Now + soapResponse + Environment.NewLine); return(invResp); }
public void NotifyAboutPayment(onlinePaymentResultRequest OnlinePaymentResultRequest) { //var soapRequest = TraceExtension.XmlRequest.OuterXml; //System.IO.File.AppendAllText(Settings.Default.LogFileDirectory + "log" + DateTime.Now.ToString() + ".txt", "Request : " + DateTime.Now + soapRequest + Environment.NewLine); //SqlConnection sqlcon = new SqlConnection(); string TaxpayerID; try { //sqlcon.ConnectionString = SQLConnectionstring; //sqlcon.Open(); TaxpayerID = klas.getdatacell(@"select TaxpayerID from Taxpayer where YVOK=N'" + OnlinePaymentResultRequest.serviceAccount.abonCode + "' and Fordelete=1"); } catch (Exception ex) { System.IO.File.AppendAllText(Settings.Default.LogFileDirectory + "log" + DateTime.Now.ToString("yyyyMMdd") + ".txt", DateTimeOffset.Now.ToString("yyyy-MM-ddTHH:mm:sszzz") + " - yvok=" + OnlinePaymentResultRequest.serviceAccount.abonCode + ",Error notify TaxpayerID tapilmadi : " + ex.Message.ToString() + Environment.NewLine); errorType ert = new errorType(); ert.errorCode = errorCode.SYSTEM_ERROR; ert.errorDateTime = DateTime.Now; ert.errorData = new object[1]; ert.errorData[0] = OnlinePaymentResultRequest.serviceAccount.scCode; ert.errorObjectType = objectType.SYSTEM; CustomSOAPException myexp = new CustomSOAPException("NotifyAboutPayment", ert); throw myexp; } try { for (int i = 0; i < OnlinePaymentResultRequest.paymentList.Length; i++) { municipal.InserTaxes(TaxpayerID, OnlinePaymentResultRequest.paymentList[i].serviceCode.ToString(), OnlinePaymentResultRequest.paymentList[i].amount.ToString(), OnlinePaymentResultRequest.paymentList[i].receiptNumber); } } catch (Exception ex) { System.IO.File.AppendAllText(Settings.Default.LogFileDirectory + "log" + DateTime.Now.ToString("yyyyMMdd") + ".txt", DateTimeOffset.Now.ToString("yyyy-MM-ddTHH:mm:sszzz") + " tapayerid=" + TaxpayerID + " yvok=" + OnlinePaymentResultRequest.serviceAccount.abonCode + " - NotifyAboutPayment Error : " + ex.Message.ToString() + Environment.NewLine); errorType ert = new errorType(); ert.errorCode = errorCode.SYSTEM_ERROR; ert.errorDateTime = DateTime.Now; ert.errorData = new object[1]; ert.errorData[0] = messageHeaderValue.receiverID; ert.errorObjectType = objectType.SYSTEM; CustomSOAPException myexp = new CustomSOAPException("NotifyAboutPayment", ert, "Ödəniş keçmədi!"); throw myexp; } //sqlcon.Close(); //var soapResponse = TraceExtension.XmlResponse.OuterXml; //System.IO.File.AppendAllText(Settings.Default.LogFileDirectory + "log" + DateTime.Now.ToString() + ".txt", // "INFO : " + DateTime.Now + soapResponse + Environment.NewLine); return; }
public serviceAccount GetAccountInfo(int SCCode, string IdentificationSubtype, string AbonCode) { SqlConnection sqlcon = new SqlConnection(); serviceAccount acc = new serviceAccount(); try { sqlcon.ConnectionString = SQLConnectionstring; sqlcon.Open(); } catch (Exception ex) { System.IO.File.AppendAllText(Settings.Default.LogFileDirectory + "log" + DateTime.Now.ToString("yyyyMMdd") + ".txt", DateTimeOffset.Now.ToString("yyyy-MM-ddTHH:mm:sszzz") + " - Error : " + ex.Message.ToString() + Environment.NewLine + SQLConnectionstring + Environment.NewLine); errorType ert = new errorType(); ert.errorCode = errorCode.SYSTEM_ERROR; ert.errorDateTime = DateTime.Now; ert.errorData = new object[1]; ert.errorData[0] = SCCode; ert.errorObjectType = objectType.SYSTEM; CustomSOAPException myexp = new CustomSOAPException("GetAccountInfo", ert, "Verilənlər Bazasına qoşulmaq mümkün olmadı!"); throw myexp; } SqlCommand cmd = new SqlCommand(@"select t.*,Name+' '+Sname+' '+Fname FullName,lcm.Municipal_code from Taxpayer t inner join List_classification_Municipal lcm on lcm.MunicipalID=t.MunicipalID where YVOK=@YVOK and t.Fordelete=1 ", sqlcon); SqlDataReader reader; cmd.Parameters.Add(new SqlParameter("@YVOK", AbonCode)); reader = cmd.ExecuteReader(); if (reader.HasRows && reader.Read())//1 sətir olmalıdır. əlavə yoxlama qoymaq lazımdır. { int colIndex; acc.scCode = SCCode; acc.identificationSubtype = IdentificationSubtype; colIndex = reader.GetOrdinal("Municipal_code"); string MunicipalCode = reader.IsDBNull(colIndex) ? string.Empty : reader.GetString(colIndex); acc.branchID = Int32.Parse("92" + MunicipalCode); colIndex = reader.GetOrdinal("YVOK"); acc.abonCode = reader.IsDBNull(colIndex) ? string.Empty : reader.GetString(colIndex); if (reader["Individual_Legal"].ToString() == "1") { acc.abonType = abonType.P; colIndex = reader.GetOrdinal("Pincode"); acc.pinCode = reader.IsDBNull(colIndex) ? string.Empty : reader.GetString(colIndex); colIndex = reader.GetOrdinal("FullName"); acc.description = reader.IsDBNull(colIndex) ? string.Empty : reader.GetString(colIndex); } else { acc.abonType = abonType.J; colIndex = reader.GetOrdinal("VOEN"); acc.taxNumber = reader.IsDBNull(colIndex) ? string.Empty : reader.GetString(colIndex); colIndex = reader.GetOrdinal("CompanyName"); acc.description = reader.IsDBNull(colIndex) ? string.Empty : reader.GetString(colIndex); } acc.smartMeter = false; if (reader["RegistrationAdress"] == null) { acc.address = "-"; } else if (reader["RegistrationAdress"].ToString() == "") { acc.address = "-"; } else { colIndex = reader.GetOrdinal("RegistrationAdress"); acc.address = reader.IsDBNull(colIndex) ? string.Empty : reader.GetString(colIndex); } System.IO.File.AppendAllText(Settings.Default.LogFileDirectory + "log" + DateTime.Now.ToString("yyyyMMdd") + ".txt", DateTimeOffset.Now.ToString("yyyy-MM-ddTHH:mm:sszzz") + " - INFO:1:" + acc.abonCode.ToString() + Environment.NewLine); } else { errorType ert = new errorType(); ert.errorCode = errorCode.NOT_FOUND; ert.errorDateTime = DateTime.Now; ert.errorData = new object[1]; ert.errorData[0] = AbonCode; ert.errorObjectType = objectType.SERVICE_ACCOUNT; CustomSOAPException myexp = new CustomSOAPException("GetAccountInfo", ert); throw myexp; } sqlcon.Close(); return(acc); }
public uniqueInvoiceResponse GetInvoiceInfoByDocumentNum(int SCCode, string IdentificationSubtype, string DocumentNum) { SqlConnection sqlcon = new SqlConnection(); SqlCommand cmd; try { sqlcon.ConnectionString = SQLConnectionstring; sqlcon.Open(); } catch (Exception ex) { System.IO.File.AppendAllText(Settings.Default.LogFileDirectory + "log" + DateTime.Now.ToString("yyyyMMdd") + ".txt", DateTimeOffset.Now.ToString("yyyy-MM-ddTHH:mm:sszzz") + " - Error : " + ex.Message.ToString() + Environment.NewLine + SQLConnectionstring + Environment.NewLine); errorType ert = new errorType(); ert.errorCode = errorCode.SYSTEM_ERROR; ert.errorDateTime = DateTime.Now; ert.errorData = new object[1]; ert.errorData[0] = SCCode; ert.errorObjectType = objectType.SYSTEM; CustomSOAPException myexp = new CustomSOAPException("GetInvoiceInfoByDocumentNum", ert); throw myexp; } uniqueInvoiceResponse invoiceByDocNumResponce = new uniqueInvoiceResponse(); cmd = new SqlCommand("[dbo].[spGetInvoiceByDocumentNum]", sqlcon); SqlDataReader reader; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@IdentificationSubtype", IdentificationSubtype)); cmd.Parameters.Add(new SqlParameter("@DocumentNum", DocumentNum)); reader = cmd.ExecuteReader(); if (reader.HasRows && reader.Read())//1 sətir olmalıdır. əlavə yoxlama qoymaq lazımdır. { serviceAccountPartial ServiceAccountPartial = new serviceAccountPartial(); invoice Invoice = new invoice(); int colIndex; ServiceAccountPartial.scCode = SCCode; colIndex = reader.GetOrdinal("IdentificationSubtypeACC"); ServiceAccountPartial.identificationSubtype = reader.IsDBNull(colIndex) ? string.Empty : reader.GetString(colIndex); if (ServiceAccountPartial.identificationSubtype == "ACC1") { colIndex = reader.GetOrdinal("AbonCode"); ServiceAccountPartial.abonCode = reader.IsDBNull(colIndex) ? string.Empty : reader.GetString(colIndex); } else if (ServiceAccountPartial.identificationSubtype == "IAMAS") { colIndex = reader.GetOrdinal("PIN"); ServiceAccountPartial.abonCode = reader.IsDBNull(colIndex) ? string.Empty : reader.GetString(colIndex); } Invoice.invoiceType = invoiceType.SIMPLE; //Group invoice-da ola bilər. colIndex = reader.GetOrdinal("InvoiceDate"); if (!reader.IsDBNull(colIndex)) { Invoice.invoiceDate = reader.GetDateTime(colIndex); Invoice.invoiceDateSpecified = true; } colIndex = reader.GetOrdinal("IdentificationSubtypeDOC"); Invoice.identificationSubtype = reader.IsDBNull(colIndex) ? string.Empty : reader.GetString(colIndex); colIndex = reader.GetOrdinal("AmountDue"); Invoice.amountDue = reader.IsDBNull(colIndex) ? 0 : reader.GetDecimal(colIndex); Invoice.amountDueSpecified = true; colIndex = reader.GetOrdinal("CurrentDebt"); Invoice.currentDebt = reader.IsDBNull(colIndex) ? 0 : reader.GetDecimal(colIndex); Invoice.currentDebtSpecified = true; Invoice.maxAllowedAmount = Invoice.currentDebt; Invoice.maxAllowedAmountSpecified = true; Invoice.invoiceCode = DocumentNum; colIndex = reader.GetOrdinal("PaymentReceiver"); int paymentReceiver = 0; if (Int32.TryParse(reader[colIndex].ToString(), out paymentReceiver)) { Invoice.paymentReceiverCode = paymentReceiver; } Invoice.paymentReceiverCodeSpecified = true; colIndex = reader.GetOrdinal("ServiceCode"); int serviceCode = 0; if (Int32.TryParse(reader[colIndex].ToString(), out serviceCode)) { Invoice.serviceCode = serviceCode; } Invoice.serviceCodeSpecified = true; invoiceByDocNumResponce.serviceAccountPartial = ServiceAccountPartial; invoiceByDocNumResponce.invoice = Invoice; System.IO.File.AppendAllText(Settings.Default.LogFileDirectory + "log.txt", "INFO:1:" + DateTime.Now + Environment.NewLine); } else { errorType ert = new errorType(); ert.errorCode = errorCode.NOT_FOUND; ert.errorDateTime = DateTime.Now; ert.errorData = new object[1]; ert.errorData[0] = DocumentNum; ert.errorObjectType = objectType.INVOICE; CustomSOAPException myexp = new CustomSOAPException("GetInvoiceInfoByDocumentNum", ert); throw myexp; } sqlcon.Close(); return(invoiceByDocNumResponce); }
public serviceAccount GetAccountInfoByDocumentNum(int SCCode, string IdentificationSubtype, string DocumentNum) { SqlConnection sqlcon = new SqlConnection(); SqlCommand cmd; serviceAccount acc = new serviceAccount(); try { sqlcon.ConnectionString = SQLConnectionstring; sqlcon.Open(); } catch (Exception ex) { System.IO.File.AppendAllText(Settings.Default.LogFileDirectory + "log" + DateTime.Now.ToString("yyyyMMdd") + ".txt", DateTimeOffset.Now.ToString("yyyy-MM-ddTHH:mm:sszzz") + " - Error : " + ex.Message.ToString() + Environment.NewLine + SQLConnectionstring + Environment.NewLine); errorType ert = new errorType(); ert.errorCode = errorCode.SYSTEM_ERROR; ert.errorDateTime = DateTime.Now; ert.errorData = new object[1]; ert.errorData[0] = SCCode; ert.errorObjectType = objectType.SYSTEM; CustomSOAPException myexp = new CustomSOAPException("GetAccountInfoByDocumentNum", ert); throw myexp; } cmd = new SqlCommand("[dbo].[spGetDocumentNum]", sqlcon); SqlDataReader reader; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@IdentificationSubtype", IdentificationSubtype)); cmd.Parameters.Add(new SqlParameter("@DocumentNum", DocumentNum)); reader = cmd.ExecuteReader(); if (reader.HasRows && reader.Read())//1 sətir olmalıdır. əlavə yoxlama qoymaq lazımdır. { int colIndex; acc.scCode = SCCode; acc.branchID = SCCode + 99; colIndex = reader.GetOrdinal("IdentificationSubtype"); acc.identificationSubtype = reader.IsDBNull(colIndex) ? string.Empty : reader.GetString(colIndex); if (acc.identificationSubtype == "ACC1") { colIndex = reader.GetOrdinal("AbonCode"); acc.abonCode = reader.IsDBNull(colIndex) ? string.Empty : reader.GetString(colIndex); } else if (acc.identificationSubtype == "IAMAS") { colIndex = reader.GetOrdinal("PIN"); acc.abonCode = reader.IsDBNull(colIndex) ? string.Empty : reader.GetString(colIndex); } acc.abonType = abonType.P; acc.smartMeter = false; colIndex = reader.GetOrdinal("FirstName"); acc.name = reader.IsDBNull(colIndex) ? string.Empty : reader.GetString(colIndex); colIndex = reader.GetOrdinal("Surname"); acc.surname = reader.IsDBNull(colIndex) ? string.Empty : reader.GetString(colIndex); colIndex = reader.GetOrdinal("Patronymic"); acc.secondName = reader.IsDBNull(colIndex) ? string.Empty : reader.GetString(colIndex); colIndex = reader.GetOrdinal("Address"); acc.address = reader.IsDBNull(colIndex) ? string.Empty : reader.GetString(colIndex); System.IO.File.AppendAllText(Settings.Default.LogFileDirectory + "log" + DateTime.Now.ToString("yyyyMMdd") + ".txt", DateTimeOffset.Now.ToString("yyyy-MM-ddTHH:mm:sszzz") + " - INFO:1:" + DateTime.Now + acc.abonCode.ToString() + Environment.NewLine); } else { errorType ert = new errorType(); ert.errorCode = errorCode.NOT_FOUND; ert.errorDateTime = DateTime.Now; ert.errorData = new object[1]; ert.errorData[0] = DocumentNum; ert.errorObjectType = objectType.INVOICE; CustomSOAPException myexp = new CustomSOAPException("GetAccountInfoByDocumentNum", ert, "Invoice not found for " + SCCode.ToString()); throw myexp; } sqlcon.Close(); return(acc); }
public invoiceResponse GetInvoiceInfo(invoiceDefaultRequest InvoiceDefaultRequest) { //serhe alinan hisse evvel // public invoiceResponse GetInvoiceInfo(int SCCode, string IdentificationSubtype, string AbonCode) //{ // invoiceDefaultRequest InvoiceDefaultRequest = new invoiceDefaultRequest(); // InvoiceDefaultRequest.abonCode = AbonCode; // InvoiceDefaultRequest.scCode = SCCode; // InvoiceDefaultRequest.identificationSubtype = IdentificationSubtype; //serhe alinan hisse son invoiceResponse invResp = new invoiceResponse(); invResp.serviceAccountPartial = new serviceAccountPartial(); invResp.serviceAccountPartial.abonCode = InvoiceDefaultRequest.abonCode; invResp.serviceAccountPartial.scCode = InvoiceDefaultRequest.scCode; invResp.serviceAccountPartial.identificationSubtype = InvoiceDefaultRequest.identificationSubtype; SqlConnection sqlcon = new SqlConnection(); try { sqlcon.ConnectionString = SQLConnectionstring; sqlcon.Open(); } catch (Exception ex) { System.IO.File.AppendAllText(Settings.Default.LogFileDirectory + "log" + DateTime.Now.ToString("yyyyMMdd") + ".txt", DateTimeOffset.Now.ToString("yyyy-MM-ddTHH:mm:sszzz") + " - Error : " + ex.Message.ToString() + Environment.NewLine + SQLConnectionstring + Environment.NewLine); errorType ert = new errorType(); ert.errorCode = errorCode.SYSTEM_ERROR; ert.errorDateTime = DateTime.Now; ert.errorData = new object[1]; ert.errorData[0] = messageHeaderValue.receiverID.ToString(); ert.errorObjectType = objectType.SYSTEM; CustomSOAPException myexp = new CustomSOAPException("GetInvoiceInfo", ert); throw myexp; } SqlCommand ckcmd = new SqlCommand(@"select TaxpayerID from Taxpayer where YVOK=@YVOK and Fordelete=1", sqlcon); ckcmd.Parameters.AddWithValue("@YVOK", InvoiceDefaultRequest.abonCode); SqlDataReader reader1 = ckcmd.ExecuteReader(); if (!(reader1.HasRows) || !(reader1.Read())) { errorType ert = new errorType(); ert.errorCode = errorCode.NOT_FOUND; ert.errorDateTime = DateTime.Now; ert.errorData = new object[1]; ert.errorData[0] = InvoiceDefaultRequest.abonCode; ert.errorObjectType = objectType.SERVICE_ACCOUNT; CustomSOAPException myexp = new CustomSOAPException("GetInvoiceInfo", ert); sqlcon.Close(); throw myexp; } reader1.Close(); int[] ServiceCodeList = { 20000200 /*emlak*/, 20000100 /*torpaq*/, 20000300 /*meden vergisi*/, 20001000 /*Bələdiyyə mülkiyyətinin icarə*/, 20000500 /*reklam*/, 20000800 /*neqliyyat vas day*/, 20000700 /*Mehmanxana*/, 20000600 /*Stasionar*/, 20000900 /*Bələdiyyə mülkiyyətinin özgə*/, 20000400 /*menfeet*/, 20001100 /*sanksiya*/, 20001200 /*iane*/ }; string TaxpayerID = klas.getdatacell(@"select TaxpayerID from Taxpayer where YVOK=N'" + InvoiceDefaultRequest.abonCode + "' and Fordelete=1"); DataTable dt = new DataTable(); if (TaxpayerID != null && ServiceCodeList.Length > 0) { dt = municipal.GetTaxesObjects(TaxpayerID, ServiceCodeList); } DataTableReader reader; reader = dt.CreateDataReader(); int cnt = 0; List <invoice> invList = new List <invoice>(); while (reader.Read()) { int colIndex; invoice inv = new invoice(); colIndex = reader.GetOrdinal("InvoiceType"); //invoiceType invtype = new invoiceType(); //if (Enum.TryParse(reader[colIndex].ToString(), out invtype)) //{ inv.invoiceType = invoiceType.AVANS; //} colIndex = reader.GetOrdinal("AmountDue"); inv.amountDue = reader.IsDBNull(colIndex) ? 0 : reader.GetDecimal(colIndex); inv.amountDueSpecified = true; colIndex = reader.GetOrdinal("CurrentDebt"); inv.currentDebt = reader.IsDBNull(colIndex) ? 0 : reader.GetDecimal(colIndex); inv.currentDebtSpecified = true; colIndex = reader.GetOrdinal("PaymentReceiver"); int paymentReceiver = 0; if (Int32.TryParse(reader[colIndex].ToString(), out paymentReceiver)) { inv.paymentReceiverCode = paymentReceiver; inv.paymentReceiverCodeSpecified = true; } colIndex = reader.GetOrdinal("ServiceCode"); int serviceCode = 0; if (Int32.TryParse(reader[colIndex].ToString(), out serviceCode)) { inv.serviceCode = serviceCode; inv.serviceCodeSpecified = true; } //if (inv.currentDebt > 0) //{ invList.Add(inv); cnt++; //} } sqlcon.Close(); if (cnt > 0) { invResp.invoiceList = invList.ToArray(); } System.IO.File.AppendAllText(Settings.Default.LogFileDirectory + "log" + DateTimeOffset.Now.ToString("yyyyMMdd") + ".txt", DateTimeOffset.Now.ToString("yyyy-MM-ddTHH:mm:sszzz") + " - INFO : " + DateTimeOffset.Now.ToString("yyyy-MM-ddTHH:mm:sszzz") + InvoiceDefaultRequest.abonCode.ToString() + Environment.NewLine); return(invResp); }
public static void Mensaje(AurumRest.ErrorBar msgBar, string v, errorType alert) { msgBar.Mensaje = v; msgBar.Status = alert; }
//private string p; public CustomSOAPException(string methodName, errorType customError, string faultString = "") : base(faultString, SoapException.ServerFaultCode, methodName, toSOAPFaultDetail(customError)) { }
public void ExplicitResponseMapperTest() { // Error. ResponseError srcError = new ResponseError { Code = 123, Description = "Err desc", Id = "42", Message = "Error occurred", Scope = "request" }; errorType destError = MapperFactory.CreateInstance <ResponseError, errorType>(srcError); // Create. CreateStatus srcCreateStatus = new CreateStatus { AdvisoryId = "src456", Error = srcError, Id = "cr8", StatusCode = "200" }; createType destCreateStatus = MapperFactory.CreateInstance <CreateStatus, createType>(srcCreateStatus); MultipleCreateResponse srcCreateResponse = new MultipleCreateResponse { StatusRecords = new List <CreateStatus> { srcCreateStatus } }; createResponseType destCreateResponse = MapperFactory.CreateInstance <MultipleCreateResponse, createResponseType>(srcCreateResponse); int index = 0; // Assert that the mapping was successful. foreach (CreateStatus record in srcCreateResponse.StatusRecords) { Assert.AreEqual(record.AdvisoryId, destCreateResponse.creates[index].advisoryId); Assert.AreEqual(record.Error.Code, destCreateResponse.creates[index].error.code); Assert.AreEqual(record.Error.Description, destCreateResponse.creates[index].error.description); Assert.AreEqual(record.Error.Id, destCreateResponse.creates[index].error.id); Assert.AreEqual(record.Error.Message, destCreateResponse.creates[index].error.message); Assert.AreEqual(record.Error.Scope, destCreateResponse.creates[index].error.scope); Assert.AreEqual(record.Id, destCreateResponse.creates[index].id); Assert.AreEqual(record.StatusCode, destCreateResponse.creates[index].statusCode); index++; } // Delete. DeleteStatus srcDeleteStatus = new DeleteStatus { Error = srcError, Id = "del8", StatusCode = "300" }; deleteStatus destDeleteStatus = MapperFactory.CreateInstance <DeleteStatus, deleteStatus>(srcDeleteStatus); MultipleDeleteResponse srcDeleteResponse = new MultipleDeleteResponse { StatusRecords = new List <DeleteStatus> { srcDeleteStatus } }; deleteResponseType destDeleteResponse = MapperFactory.CreateInstance <MultipleDeleteResponse, deleteResponseType>(srcDeleteResponse); index = 0; // Assert that the mapping was successful. foreach (DeleteStatus record in srcDeleteResponse.StatusRecords) { Assert.AreEqual(record.Error.Code, destDeleteResponse.deletes[index].error.code); Assert.AreEqual(record.Error.Description, destDeleteResponse.deletes[index].error.description); Assert.AreEqual(record.Error.Id, destDeleteResponse.deletes[index].error.id); Assert.AreEqual(record.Error.Message, destDeleteResponse.deletes[index].error.message); Assert.AreEqual(record.Error.Scope, destDeleteResponse.deletes[index].error.scope); Assert.AreEqual(record.Id, destDeleteResponse.deletes[index].id); Assert.AreEqual(record.StatusCode, destDeleteResponse.deletes[index].statusCode); index++; } // Update. UpdateStatus srcUpdateStatus = new UpdateStatus { Error = srcError, Id = "up8", StatusCode = "400" }; updateType destUpdateStatus = MapperFactory.CreateInstance <UpdateStatus, updateType>(srcUpdateStatus); MultipleUpdateResponse srcUpdateResponse = new MultipleUpdateResponse { StatusRecords = new List <UpdateStatus> { srcUpdateStatus } }; updateResponseType destUpdateResponse = MapperFactory.CreateInstance <MultipleUpdateResponse, updateResponseType>(srcUpdateResponse); index = 0; // Assert that the mapping was successful. foreach (UpdateStatus record in srcUpdateResponse.StatusRecords) { Assert.AreEqual(record.Error.Code, destUpdateResponse.updates[index].error.code); Assert.AreEqual(record.Error.Description, destUpdateResponse.updates[index].error.description); Assert.AreEqual(record.Error.Id, destUpdateResponse.updates[index].error.id); Assert.AreEqual(record.Error.Message, destUpdateResponse.updates[index].error.message); Assert.AreEqual(record.Error.Scope, destUpdateResponse.updates[index].error.scope); Assert.AreEqual(record.Id, destUpdateResponse.updates[index].id); Assert.AreEqual(record.StatusCode, destUpdateResponse.updates[index].statusCode); index++; } }
public static string SetType(string ErrorCode, errorType eType) { string sRet = ""; if (eType == errorType.ConnectionError) sRet = ErrorCode + " (Connection Error)"; if (eType == errorType.DataOperationError) sRet = ErrorCode + " (Data Operation Error)"; if (eType == errorType.SendMailError) sRet = ErrorCode + " (Send Mail Error)"; if (eType == errorType.ReportError) sRet = ErrorCode + " (Report Error)"; if (eType == errorType.LoginError) sRet = ErrorCode + " (Login Error)"; if (eType == errorType.PermissionError) sRet = ErrorCode + " (Permission Error)"; return sRet; }
public void SetResult(bool operationResult, string dataError, errorType dataErrorType, string message) { OperationResult = operationResult; ErrorCode = ErrorNumber.SetType(dataError, dataErrorType); Message = message; }