Beispiel #1
0
Datei: Psp.cs Projekt: ubs121/psp
		public string CheckTicket(Ticket t) {
			string msg = "";

			if (sqlCheckTicket == null) {
				sqlCheckTicket = new SqlCommand("sp_CheckTicket");
				sqlCheckTicket.CommandType = CommandType.StoredProcedure;
				sqlCheckTicket.Parameters.Add("@isdn", SqlDbType.VarChar, 8);
				sqlCheckTicket.Parameters.Add("@procmd", SqlDbType.VarChar, 10);
				sqlCheckTicket.Parameters.Add("@duration", SqlDbType.TinyInt, 1);
				sqlCheckTicket.Parameters.Add("@param", SqlDbType.VarChar, 100);
				sqlCheckTicket.Parameters.Add("@operator", SqlDbType.Int, 4);
				sqlCheckTicket.Parameters.Add("@msg", SqlDbType.NVarChar, 1000);
				sqlCheckTicket.Parameters["@msg"].Direction = ParameterDirection.Output;
			}

			SqlConnection con = new SqlConnection(strCon);
			sqlSaveTicket.Connection = con;

			try {
				con.Open();

				if (t.isdn.Length == 6) t.isdn = "99" + t.isdn;

				sqlCheckTicket.Parameters["@isdn"].Value = t.isdn;
				sqlCheckTicket.Parameters["@procmd"].Value = t.procmd;
				sqlCheckTicket.Parameters["@duration"].Value = t.duration;
				sqlCheckTicket.Parameters["@param"].Value = t.param;
				sqlCheckTicket.Parameters["@operator"].Value = (t.op < 0 ? Math.Abs(t.op) : op.opid);
				
				sqlCheckTicket.ExecuteNonQuery();

				msg = sqlCheckTicket.Parameters["@msg"].Value.ToString();
			}
			catch (Exception ex) {
				AsyncLogWriter("CheckTicket :" + ex);
				msg = ex.ToString();
			}
			finally {
				con.Close();
			}

			return msg;
		}
Beispiel #2
0
Datei: Psp.cs Projekt: ubs121/psp
		public string SaveTicket(Ticket t) {
			return SaveTicket(t, false);
		}
Beispiel #3
0
Datei: Psp.cs Projekt: ubs121/psp
		public void SetTicketResult(Ticket t) {
			if (sqlSetResult == null) {
				sqlSetResult = new SqlCommand("sp_SetTicketResult");
				sqlSetResult.CommandType = CommandType.StoredProcedure;
				sqlSetResult.Parameters.Add("@tno", SqlDbType.BigInt, 8);
				sqlSetResult.Parameters.Add("@state", SqlDbType.Int, 4);
				sqlSetResult.Parameters.Add("@trycount", SqlDbType.Int, 4);
				sqlSetResult.Parameters.Add("@result", SqlDbType.VarChar, 4000);
				sqlSetResult.Parameters.Add("@applydate", SqlDbType.DateTime, 8);
			}

			SqlConnection con = new SqlConnection(strCon);
			try {
				con.Open();
				sqlSetResult.Connection = con;
				sqlSetResult.Parameters["@tno"].Value = t.tno;
				sqlSetResult.Parameters["@state"].Value = t.state;
				sqlSetResult.Parameters["@trycount"].Value = t.tryCount;
				sqlSetResult.Parameters["@result"].Value = t.result;
				sqlSetResult.Parameters["@applydate"].Value = t.applyDate;

				sqlSetResult.ExecuteNonQuery();
			}
			catch (Exception ex) {
				AsyncLogWriter("SetTicketResult failed: " + ex);
			}
			finally {
				con.Close();
			}
		}
Beispiel #4
0
Datei: Psp.cs Projekt: ubs121/psp
		public string SaveTicket(Ticket t, bool forcedup) {
			ValidatePermission("Provision." + t.procmd);
			string msg = "";

			if (sqlSaveTicket == null) {
				sqlSaveTicket = new SqlCommand("sp_SaveTicket");
				sqlSaveTicket.CommandType = CommandType.StoredProcedure;
				sqlSaveTicket.Parameters.Add("@tno", SqlDbType.BigInt, 8);
				sqlSaveTicket.Parameters.Add("@isdn", SqlDbType.VarChar, 8);
				sqlSaveTicket.Parameters.Add("@imsi", SqlDbType.VarChar, 15);
				sqlSaveTicket.Parameters.Add("@procmd", SqlDbType.VarChar, 10);
				sqlSaveTicket.Parameters.Add("@duration", SqlDbType.TinyInt, 1);
				sqlSaveTicket.Parameters.Add("@param", SqlDbType.VarChar, 100);
				sqlSaveTicket.Parameters.Add("@operator", SqlDbType.Int, 4);
				sqlSaveTicket.Parameters.Add("@host", SqlDbType.VarChar, 30);
				sqlSaveTicket.Parameters.Add("@forcedup", SqlDbType.Bit, 1);
				sqlSaveTicket.Parameters.Add("@msg", SqlDbType.NVarChar, 1000);
				sqlSaveTicket.Parameters["@msg"].Direction = ParameterDirection.Output;
				sqlSaveTicket.Parameters.Add("@billitem", SqlDbType.Int, 4);
				sqlSaveTicket.Parameters.Add("@date", SqlDbType.DateTime, 8);
			}

			SqlConnection con = new SqlConnection(strCon);
			sqlSaveTicket.Connection = con;

			try {
				con.Open();

				if (t.isdn.Length == 6) t.isdn = "99" + t.isdn;

				if (t.imsi.Length == 6) t.imsi = "428990100" + t.imsi;
				else if (t.imsi.Length == 10) t.imsi = "42899" + t.imsi;

				sqlSaveTicket.Parameters["@tno"].Value = t.tno;
				sqlSaveTicket.Parameters["@isdn"].Value = t.isdn;
				sqlSaveTicket.Parameters["@imsi"].Value = t.imsi;
				sqlSaveTicket.Parameters["@procmd"].Value = t.procmd;
				sqlSaveTicket.Parameters["@duration"].Value = t.duration;
				sqlSaveTicket.Parameters["@param"].Value = t.param;
				sqlSaveTicket.Parameters["@operator"].Value = (t.op < 0 ? Math.Abs(t.op) : op.opid);
				sqlSaveTicket.Parameters["@host"].Value = t.host;
				sqlSaveTicket.Parameters["@forcedup"].Value = forcedup;
				sqlSaveTicket.Parameters["@billitem"].Value = t.billitem;
				sqlSaveTicket.Parameters["@date"].Value = (t.tno >= 0 ? t.date : DateTime.Now);
					
				sqlSaveTicket.ExecuteNonQuery();

				msg = sqlSaveTicket.Parameters["@msg"].Value.ToString();
			}
			catch (Exception ex) {
				AsyncLogWriter("SaveTicket :" + ex);
				msg = ex.ToString();
			}
			finally {
				con.Close();
			}

			return msg;
		}
Beispiel #5
0
Datei: Psp.cs Projekt: ubs121/psp
		private void WriteDBLog(Ticket t) {
			SqlConnection con = new SqlConnection(strCon);

			if (sqlSaveTicket == null) {
				sqlSaveTicket = new SqlCommand("sp_AddTicket");
				sqlSaveTicket.CommandType = CommandType.StoredProcedure;
				sqlSaveTicket.Parameters.Add("@isdn", SqlDbType.Char, 8);
				sqlSaveTicket.Parameters.Add("@procmd", SqlDbType.VarChar, 10);
				sqlSaveTicket.Parameters.Add("@duration", SqlDbType.TinyInt, 1);
				sqlSaveTicket.Parameters.Add("@param", SqlDbType.VarChar, 100);
				sqlSaveTicket.Parameters.Add("@operator", SqlDbType.Int, 4);
				sqlSaveTicket.Parameters.Add("@host", SqlDbType.VarChar, 30);
			}

			sqlSaveTicket.Connection = con;

			try {
				con.Open();

				sqlSaveTicket.Parameters["@isdn"].Value = t.isdn;
				sqlSaveTicket.Parameters["@procmd"].Value = t.procmd;
				sqlSaveTicket.Parameters["@duration"].Value = t.duration;
				sqlSaveTicket.Parameters["@param"].Value = t.param;
				sqlSaveTicket.Parameters["@operator"].Value = (t.op < 0 ? Math.Abs(t.op) : op.opid);
				sqlSaveTicket.Parameters["@host"].Value = t.host;

				sqlSaveTicket.ExecuteNonQuery();
			}
			catch (Exception ex) {
				AsyncLogWriter("Save ticket error: " + ex);
			}
			finally {
				con.Close();
			}
		}