private void DeleteDoubleoptTransaction(int transactionID) { using (CDB cdb = new CDB("Delete double OPT transaction")) { cdb.Execute(string.Format("Delete_SubscriptionDoubleOptTransaction {0}", transactionID), CDB.exmReturnTypes.RETURN_NON_QUERY); } }
private void Button_moCard_Click(object sender, EventArgs e) { string sql1, sql2; int id; ListView.SelectedIndexCollection c = listView_Cards.SelectedIndices; if (c.Count > 0) { if (int.TryParse(listView_Cards.Items[c[0]].SubItems[0].Text, out id)) { sql1 = CDB.GetUpdataSQL(CDB.cards[id]); SQL.Append(sql1); sql2 = CDB.GetUpdataSQL(GetCard()); //MessageBox.Show(sql[0]+"\n"+sql[1]); if (CDB.Command(CDBfile, sql2) < 2) { MessageBox.Show("修改失败!\n如果修改密码,请先添加再删除。", "错误"); } else { ReadData(); } } } }
public static JObject ObtenerJsonClienteObtieneDatosUsuarioSesion(JObject esteObjeto) { CDB conn = new CDB(); string sp = "EXEC SP_Cliente_ObtenerDatosUsuarioSesion @Opcion, @pIdUsuario"; conn.DefinirQuery(sp); conn.AgregarParametros("@Opcion", 1); conn.AgregarParametros("@pIdUsuario", Convert.ToInt32(esteObjeto.Property("IdUsuario").Value.ToString())); CObjeto Registro = conn.ObtenerRegistro(); string Logo = ""; int IdPerfil = 0; if (Registro.Exist("IdCliente")) { Logo = (string)Registro.Get("Logo"); IdPerfil = (Int32)Registro.Get("IdPerfil"); } if (Logo == "") { Logo = "NoImage.png"; } esteObjeto.Add(new JProperty("Logo", Logo)); esteObjeto.Add(new JProperty("IdPerfil", IdPerfil)); return(esteObjeto); }
// Editar registro public void Editar(CDB Conn) { if (idusuario != 0) { string Query = "UPDATE Usuario SET Usuario=@Usuario,Password=@Password,Nombre=@Nombre,ApellidoPaterno=@ApellidoPaterno,ApellidoMaterno=@ApellidoMaterno,Correo=@Correo,Cookie=@Cookie,IP=@IP,FechaUltimoAcceso=@FechaUltimoAcceso, IdPerfil=@IdPerfil, IdUsuarioJefe=@IdUsuarioJefe, EsResponsableSucursal=@EsResponsableSucursal, Baja=@Baja WHERE IdUsuario=@IdUsuario;" + "SELECT * FROM Usuario WHERE IdUsuario = SCOPE_IDENTITY()"; Conn.DefinirQuery(Query); Conn.AgregarParametros("@IdUsuario", idusuario); Conn.AgregarParametros("@Usuario", usuario); Conn.AgregarParametros("@Password", password); Conn.AgregarParametros("@Nombre", nombre); Conn.AgregarParametros("@ApellidoPaterno", apellidopaterno); Conn.AgregarParametros("@ApellidoMaterno", apellidomaterno); Conn.AgregarParametros("@Correo", correo); Conn.AgregarParametros("@Cookie", cookie); Conn.AgregarParametros("@IP", ip); Conn.AgregarParametros("@FechaUltimoAcceso", fechaultimoacceso); Conn.AgregarParametros("@IdPerfil", idperfil); Conn.AgregarParametros("@IdUsuarioJefe", idusuariojefe); Conn.AgregarParametros("@EsResponsableSucursal", esresponsablesucursal); Conn.AgregarParametros("@Baja", baja); SqlDataReader Datos = Conn.Ejecutar(); DefinirPropiedades(Datos); Datos.Close(); } }
// Agregar registro public void Agregar(CDB Conn) { string Query = "INSERT INTO Usuario (Usuario,Password,Nombre,ApellidoPaterno,ApellidoMaterno,Correo,Cookie,IP,FechaUltimoAcceso,idPerfil,IdSucursalPredeterminada,Baja,IdUsuarioJefe,EsResponsableSucursal) VALUES (@Usuario,@Password,@Nombre,@ApellidoPaterno,@ApellidoMaterno,@Correo,@Cookie,@IP,@FechaUltimoAcceso, @IdPerfil,@IdSucursalPredeterminada,@Baja,@IdUsuarioJefe,@EsResponsableSucursal)" + "SELECT * FROM Usuario WHERE IdUsuario = SCOPE_IDENTITY()"; Conn.DefinirQuery(Query); Conn.AgregarParametros("@Usuario", usuario); Conn.AgregarParametros("@Password", password); Conn.AgregarParametros("@Nombre", nombre); Conn.AgregarParametros("@ApellidoPaterno", apellidopaterno); Conn.AgregarParametros("@ApellidoMaterno", apellidomaterno); Conn.AgregarParametros("@Correo", correo); Conn.AgregarParametros("@Cookie", cookie); Conn.AgregarParametros("@IP", ip); Conn.AgregarParametros("@FechaUltimoAcceso", fechaultimoacceso); Conn.AgregarParametros("@IdPerfil", idperfil); Conn.AgregarParametros("@Idsucursalpredeterminada", IdSucursalPredeterminada); Conn.AgregarParametros("@IdUsuarioJefe", idusuariojefe); Conn.AgregarParametros("@EsResponsableSucursal", esresponsablesucursal); Conn.AgregarParametros("@Baja", baja); SqlDataReader Datos = Conn.Ejecutar(); DefinirPropiedades(Datos); Datos.Close(); }
private void btn_Click(object sender, EventArgs e) { btnClearBrowser.PerformClick(); CWorker.BasePath = _BasePath; txtbxStatus.Text = "Read Flickr Data"; txtbxStatus.Refresh(); CReadFlickr reader = new CReadFlickr(); CDB cDB = reader.Exec(); txtbxStatus.Text += System.Environment.NewLine + "Update DB Store"; txtbxStatus.Refresh(); reader.Commit(); txtbxStatus.Text += System.Environment.NewLine + "Calculate Statistics"; txtbxStatus.Refresh(); CStatistics xStatistics = new CStatistics(cDB); CXDB xDB = xStatistics.Exec(); txtbxStatus.Text += System.Environment.NewLine + "Max Statistics Collected per Photo: " + xDB.MaxCount; CHTML html = new CHTML(xDB, 25); txtbxStatus.Text += System.Environment.NewLine + "Create HTML"; txtbxStatus.Refresh(); html.Exec(); //MessageBox.Show("Ready.", "Read Flickr plus Statistics plus HTML", MessageBoxButtons.OK); btnDaily.PerformClick(); }
public bool ResetPassword(string ID, string OldPassword, string NewPassword) { OldPassword = CDB.SHA512(OldPassword); NewPassword = CDB.SHA512(NewPassword); NewCmd(); Cmd.CommandText = "update TblUsers set Password = @NewPassword where ID = @ID and Password = @OldPassword"; Cmd.Parameters.AddWithValue("@NewPassword", NewPassword); Cmd.Parameters.AddWithValue("@ID", ID); Cmd.Parameters.AddWithValue("@OldPassword", OldPassword); int Update; try { Con.Open(); Update = Cmd.ExecuteNonQuery(); } catch (Exception ex) { XtraMessageBox.Show(ex.Message); return(false); } finally { Con.Close(); } return(Update == 1); }
static List <KeyValuePair <string, string> > getComunas(int idp) { List <KeyValuePair <string, string> > lkv = new List <KeyValuePair <string, string> >(); try { SqlCommand cmd = new SqlCommand("select * from tbl_comuna where id_provincia =@idp "); cmd.Connection = CDB.GetConnection(); cmd.CommandType = System.Data.CommandType.Text; cmd.Parameters.AddWithValue("@idp", idp); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { string key = dr["id_comuna"].ToString(); string value = dr["nombre_comuna"].ToString(); lkv.Add(new KeyValuePair <string, string>(key, value)); } } catch (Exception ex) { Console.WriteLine("ERROR INSIDE checkSessionKey:" + ex.ToString()); } return(lkv); }
public static void Accion(Action <CDB> fn) { CDB conn = new CDB(); fn(conn); conn.Cerrar(); }
static List <KeyValuePair <string, string> > getRegiones() { List <KeyValuePair <string, string> > lkv = new List <KeyValuePair <string, string> >(); try { SqlCommand cmd = new SqlCommand("select * from tbl_region"); cmd.Connection = CDB.GetConnection(); cmd.CommandType = System.Data.CommandType.Text; SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { string key = dr["id_region"].ToString(); string value = dr["nombre_region"].ToString(); lkv.Add(new KeyValuePair <string, string>(key, value)); } } catch (Exception ex) { Console.WriteLine("ERROR INSIDE checkSessionKey:" + ex.ToString()); } return(lkv); }
public void Editar(CDB conn) { string query = "EXEC sp_Reporte_Editar @IdReporte, @Folio, @IdEstatus, @IdCircuito, @IdTipoConsumo, @FechaLevantamiento, " + " @FechaAtencion, @FechaEnvioProveedor, @FechaCierre,@IdTipoProblema, @Reporte, @IdUsuarioAlta, @IdUsuarioRequiere, " + " @IdUsuarioResponsable, @ComentariosCierre, @IdProveedor, @IdUsuarioProveedor "; conn.DefinirQuery(query); conn.AgregarParametros("@IdReporte", idreporte); conn.AgregarParametros("@Folio", folio); conn.AgregarParametros("@IdEstatus", idestatus); conn.AgregarParametros("@IdCircuito", idcircuito); conn.AgregarParametros("@IdTipoConsumo", idtipoconsumo); conn.AgregarParametros("@FechaLevantamiento", fechalevantamiento); conn.AgregarParametros("@FechaAtencion", fechaatencion); conn.AgregarParametros("@FechaEnvioProveedor", fechaenvioproveedor); conn.AgregarParametros("@FechaCierre", fechacierre); conn.AgregarParametros("@IdTipoProblema", idtipoproblema); conn.AgregarParametros("@Reporte", reporte); conn.AgregarParametros("@IdUsuarioAlta", idusuarioalta); conn.AgregarParametros("@IdUsuarioRequiere", idusuariorequiere); conn.AgregarParametros("@IdUsuarioResponsable", idusuarioresponsable); conn.AgregarParametros("@ComentariosCierre", comentarioscierre); conn.AgregarParametros("@IdProveedor", idproveedor); conn.AgregarParametros("@IdUsuarioProveedor", idusuarioproveedor); SqlDataReader Datos = conn.Ejecutar(); DefinirPropiedades(Datos); Datos.Close(); }
public bool SaveUser(string Name, string UserName, string Password, string GroupID) { Password = CDB.SHA512(Password); NewCmd(); Cmd.CommandText = @"insert into TblUsers (Name, UserName, Password, UserGroupID, InsertedDate, InsertedUser) values (@Name, @UserName, @Password, @UserGroupID, @InsertedDate, @InsertedUser)"; Cmd.Parameters.AddWithValue("@Name", Name); Cmd.Parameters.AddWithValue("@UserName", UserName); Cmd.Parameters.AddWithValue("@Password", Password); Cmd.Parameters.AddWithValue("@UserGroupID", GroupID); Cmd.Parameters.AddWithValue("@InsertedDate", DateTime.Now); Cmd.Parameters.AddWithValue("@InsertedUser", Program.UserID); try { Con.Open(); Cmd.ExecuteNonQuery(); } catch (Exception ex) { XtraMessageBox.Show(ex.Message); return(false); } finally { Con.Close(); } CLog.AddLog("TblUsers", "Add New User " + Name + " Username " + UserName + " Group ID " + GroupID); return(true); }
private void ReadData() { CDB.Read(CDBfile, select_str); Count = CDB.ids.Count; SetNum(); Add_cardslist(); }
public SubscriptionService(int id) { CDB DB = new CDB("GetActiveServices"); SqlDataReader reader = (SqlDataReader)DB.Execute("SUB_GetActiveSubscriptionService " + id, CDB.exmReturnTypes.RETURN_READER); if (reader.Read()) { var service = new SubscriptionService(reader.GetInt32(0), reader.GetString(1), reader.GetInt32(2), (BillingFrequencies)reader.GetInt32(3), (BillingTimes)reader.GetInt32(4), reader.GetDecimal(5), reader.GetInt32(6), reader.GetInt32(7), reader.GetString(8), (Statuses)reader.GetInt32(9)); _ID = service.ID; _Description = service.Description; _GroupID = service.GroupID; _BillingFrequency = service.BillingFrequency; _BillingTime = service.BillingTime; _BillingAmount = service.BillingAmount; _BillingDayOfMonth = service.BillingDayOfMonth; _PaymentSystemClientID = service.PaymentSystemClientID; _ResponseQueue = new CQueueWrapper(service.ResponseQueue.QueueName); _Status = service.Status; } reader.Close(); reader = null; DB.Close(); DB = null; }
static public int GetNews(GETNEWS getnews, out NEWS[] result) { result = null; if (getnews.ext.nNeedLine == 0) { getnews.ext.nNeedLine = 10; } DataTable dt = CDB.GetSQLData("select top " + getnews.ext.nNeedLine + " * from tblNews where dwDate >= " + getnews.dwStartDate + " and dwDate <= " + getnews.dwEndDate + " and dwClsID=" + getnews.dwClsID); if (dt == null) { return(1); } result = new NEWS[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { result[i] = new NEWS(); result[i].dwNewsID = (int)dt.Rows[i]["dwNewsID"]; result[i].dwDate = (int)dt.Rows[i]["dwDate"]; result[i].dwTime = (int)dt.Rows[i]["dwTime"]; result[i].dwClsID = (int)dt.Rows[i]["dwClsID"]; result[i].dwType = (int)dt.Rows[i]["dwType"]; result[i].szTitle = (string)dt.Rows[i]["szTitle"]; result[i].szContent = (string)dt.Rows[i]["szContent"]; } return(0); }
static public int UserCheck(CHECKUSER check, out USER result) { result = null; DataTable dt = CDB.GetSQLData("select top 1 * from tblUser where szLogonName = '" + check.szLogonName + "'"); if (dt == null) { return(1); } if (dt.Rows.Count == 0) { return(1); } if ((string)dt.Rows[0]["szPassword"] != check.szPassword) { return(1); } result = new USER(); result.dwUserID = (int)dt.Rows[0]["dwUserID"]; result.szLogonName = (string)dt.Rows[0]["szLogonName"]; result.szTrueName = (string)dt.Rows[0]["szTrueName"]; result.dwType = (int)dt.Rows[0]["dwType"]; return(0); }
public override void Read(Stream stream) { using (BinaryReader br = new BinaryReader(stream)) { if (toningTableDataBlockLength != 0) { byte[] ToningTableDataBlockBytes = br.ReadBytes(toningTableDataBlockLength); TTDB = new ToningTableDataBlock(); TTDB.Read(new MemoryStream(ToningTableDataBlockBytes)); } if (calibrationDataBlockLength != 0) { byte[] CalibrationDataBlockBytes = br.ReadBytes(calibrationDataBlockLength); CDB.Read(new MemoryStream(CalibrationDataBlockBytes)); } if (locationDataBlockLength != 0) { byte[] LocationDataBlockBytes = br.ReadBytes(locationDataBlockLength); LDB = new LocationDataBlock(); LDB.Read(new MemoryStream(LocationDataBlockBytes)); } } }
private void UpdateSubscriptionStatus(int subscriptionID, int statusID) { CDB DB = new CDB("UpdateSubscriptionStatus"); DB.Execute("SUB_UpdateSubscriptionStatus " + subscriptionID.ToString() + "," + statusID.ToString(), CDB.exmReturnTypes.RETURN_NON_QUERY); DB.Close(); DB = null; }
private void AddSubscriptionInteraction(int subscriptionID, int requestInputMechanismID, InteractionTypes interactionType) { CDB DB = new CDB("AddSubscriptionInteraction"); DB.Execute("SUB_AddSubscriptionInteraction " + subscriptionID.ToString() + "," + requestInputMechanismID.ToString() + "," + ((int)interactionType).ToString(), CDB.exmReturnTypes.RETURN_NON_QUERY); DB.Close(); DB = null; }
private void UpdateSubscriptionDateTimes(int subscriptionID, DateTime expiryDateTime, DateTime nextBillingDateTime, int trackingId) { CDB DB = new CDB(this.ToString()); DB.Execute("SUB_UpdateSubscriptionDateTimes " + subscriptionID.ToString() + ",'" + expiryDateTime.ToString("yyyy-MM-dd HH:mm:ss:fff") + "','" + nextBillingDateTime.ToString("yyyy-MM-dd HH:mm:ss:fff") + "'," + trackingId, CDB.exmReturnTypes.RETURN_NON_QUERY); DB.Close(); DB = null; }
private void UpdateRebillingStatus(int billingRetryID, int retryCount, int statusID) { CDB cdb = new CDB("Update Subscription REbilling Status"); cdb.Execute("sub_UpdateBillingContinuesStatus " + billingRetryID + "," + statusID + "," + retryCount, CDB.exmReturnTypes.RETURN_NON_QUERY); cdb.Close(); }
private void AddBillingRequest(int subscriptionID, int paymentSystemTransactionID, bool initialBilling, int exactPaymentTransactionId, int exactPaymentStatusID, decimal exactPaymentAmount) { CDB DB = new CDB("Add Subscription rebilling Request"); DB.Execute("SUB_AddBillingRequest " + subscriptionID.ToString() + "," + paymentSystemTransactionID.ToString() + "," + (initialBilling ? "1" : "0") + "," + exactPaymentTransactionId + "," + exactPaymentStatusID + "," + exactPaymentAmount, CDB.exmReturnTypes.RETURN_NON_QUERY); DB.Close(); DB = null; }
private void AddBillingRetry(int subscriptionID, bool initialBilling, decimal amount) { CDB DB = new CDB("AddBillingRetry"); DB.Execute("SUB_AddBillingRetry " + subscriptionID.ToString() + "," + (initialBilling ? "1" : "0") + "," + amount.ToString(), CDB.exmReturnTypes.RETURN_NON_QUERY); DB.Close(); DB = null; }
public CArticleCommit() { cdb = new CDB(); CDBInstalln cdbi = new CDBInstalln(); tempArtCommitDir = cdbi.tempArtCommitDir; localArtCommitReadyFolder = cdbi.localArtCommitReadyFolder; }
public static string TestaConexaoBase() { CDB conexaoCdb = new CDB(); var statusConexao = conexaoCdb.OpenDB(); conexaoCdb.CloseDB(); return(statusConexao.ToString()); }
private void Button_cancelCard_Click(object sender, EventArgs e) { if (SQL.Length > 0) { CDB.Command(CDBfile, SQL.ToString()); ReadData(); SQL.Remove(0, SQL.Length); } }
public static string ObtenerDetalle(int Pagina, string Columna, string Orden, int IdCliente, int IdPais, int IdEstado, int IdMunicipio, int IdSucursal, int IdTablero, int IdCircuito, string FechaInicio, string FechaFin) { //var serializer = new JavaScriptSerializer(); //serializer.MaxJsonLength = 500000000; CObjeto Respuesta = new CObjeto(); CUnit.Firmado(delegate(CDB conn) { string Error = conn.Mensaje; if (conn.Conectado) { CObjeto Datos = new CObjeto(); int Paginado = 10; CDB ConexionBaseDatos = new CDB(); SqlConnection conexion = ConexionBaseDatos.conStr(); SqlCommand Stored = new SqlCommand("spr_Reporte_Medicion4", conexion); Stored.CommandType = CommandType.StoredProcedure; Stored.CommandType = CommandType.StoredProcedure; Stored.Parameters.Add("TamanoPaginacion", SqlDbType.Int).Value = Paginado; Stored.Parameters.Add("PaginaActual", SqlDbType.Int).Value = Pagina; Stored.Parameters.Add("ColumnaOrden", SqlDbType.VarChar, 20).Value = Columna; Stored.Parameters.Add("TipoOrden", SqlDbType.Text).Value = Orden; Stored.Parameters.Add("IdCliente", SqlDbType.Int).Value = IdCliente; Stored.Parameters.Add("IdPais", SqlDbType.Int).Value = IdPais; Stored.Parameters.Add("IdEstado", SqlDbType.Int).Value = IdEstado; Stored.Parameters.Add("IdMunicipio", SqlDbType.Int).Value = IdMunicipio; Stored.Parameters.Add("IdSucursal", SqlDbType.Int).Value = IdSucursal; Stored.Parameters.Add("IdTablero", SqlDbType.Int).Value = IdTablero; Stored.Parameters.Add("IdCircuito", SqlDbType.Int).Value = IdCircuito; Stored.Parameters.Add("FechaInicio", SqlDbType.Text).Value = FechaInicio; Stored.Parameters.Add("FechaFin", SqlDbType.Text).Value = FechaFin; SqlDataAdapter dataAdapterRegistros = new SqlDataAdapter(Stored); dataAdapterRegistros.SelectCommand.CommandTimeout = 1800; DataSet ds = new DataSet(); dataAdapterRegistros.Fill(ds); DataTable DataTablePaginador = ds.Tables[0]; DataTable DataTableConsumos = ds.Tables[1]; DataTable DataTableMetas = ds.Tables[2]; DataTable DataTableReal = ds.Tables[3]; Datos.Add("Paginador", conn.ObtenerRegistrosDataTable(DataTablePaginador)); Datos.Add("Detalle", conn.ObtenerRegistrosDataTable(DataTableConsumos)); Datos.Add("Consumo", conn.ObtenerRegistrosDataTable(DataTableMetas)); Datos.Add("Real", conn.ObtenerRegistrosDataTable(DataTableReal)); Respuesta.Add("Datos", Datos); } Respuesta.Add("Error", Error); }); return(Respuesta.ToString()); }
private bool CanUnsubScribeLockedUser(int subscriptionID) { CDB cdb = new CDB("subscriptions"); bool unsubscribe = (bool)cdb.Execute("exm_CanUnsubLocked " + subscriptionID, CDB.exmReturnTypes.RETURN_SCALAR); cdb.Close(); return(unsubscribe); }
public bool IsSubscribed(string mobileNumber, int serviceID) { CDB cdb = new CDB("subscription"); bool isSub = (bool)cdb.Execute("SUB_IsSubscribed '" + mobileNumber + "'," + serviceID, CDB.exmReturnTypes.RETURN_SCALAR); cdb.Close(); return(isSub); }
private void ToolStrip_copycards_Click(object sender, EventArgs e) { string cdb = "diy.cdb"; if (CCFile.SelectOpenFile(out cdb, "数据将要复制到->选择的数据库", "cdb", SET.GamePath)) { CDB.Updata(cdb); MessageBox.Show("复制完成!", "提示"); } }
public void Read (TProtocol iprot) { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.String) { Name = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.String) { CronTime = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.String) { UserName = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.List) { { Dbs = new List<CDB>(); TList _list0 = iprot.ReadListBegin(); for( int _i1 = 0; _i1 < _list0.Count; ++_i1) { CDB _elem2 = new CDB(); _elem2 = new CDB(); _elem2.Read(iprot); Dbs.Add(_elem2); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 5: if (field.Type == TType.I32) { BatchSaveNum = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }