public string CreateMessageHistory(Conn ObjConn, SqlCommand ObjSqlCommmand, int MessageID, string InquiryID, int FromUserID, string ExecutiveIP, int ToUserID,int MessageSequence,
                                    Int16 MessageRead)
 {
     return ObjConn.executescalarstringquery(ObjSqlCommmand, "INSERT INTO [MessageHistory]([MessageID],[ExecutiveIP],[CustomerID],[MessageSequence],[MessageRead])"
                                            + " VALUES (" + MessageID.ToString() + ",'" + InquiryID + "'," + FromUserID.ToString() + ",'" + ExecutiveIP + "'," + MessageSequence.ToString() + "','"
                                            + MessageRead.ToString() + ")" + " Select @@IDENTITY");
 }
Example #2
0
 void Data_Bind()
 {
     string sql="select top 1 * from onlinepay where onlinepay_type='alipay'";
        Conn Myconn=new Conn();
        OleDbConnection conn=new OleDbConnection(Myconn.Constr());
        conn.Open();
        OleDbCommand Comm=new OleDbCommand(sql,conn);
        OleDbDataReader dr=Comm.ExecuteReader();
        if(dr.Read())
     {
       T_total_fee.Attributes.Add("onkeyup","if(isNaN(value))execCommand('undo')");
       T_partner.Text=dr["onlinepay_partnerid"].ToString();
       T_seller_email.Text=dr["onlinepay_mid"].ToString();
       T_key.Text=dr["onlinepay_key"].ToString();
       T_return_url.Text="http://"+Request.ServerVariables["SERVER_NAME"]+"/member/onlinepay/alipay/Alipay_Return.aspx";
       T_notify_url.Text="http://"+Request.ServerVariables["SERVER_NAME"]+"/member/onlinepay/alipay/Alipay_Notify.aspx";
       if(T_show_url.Text=="")
        {
      T_show_url.Text=Request.ServerVariables["SERVER_NAME"];
        }
       Button1.Attributes.Add("onclick","return C_Tb()");
     }
        else
     {
       Response.End();
     }
        conn.Close();
 }
 /// <summary>
 /// Insert Group Settings
 /// </summary>
 /// <param name="ObjConn">SqlConnection</param>
 /// <param name="ObjSqlCommmand">SqlCommand</param>
 /// <param name="GroupID">GroupID</param>
 /// <param name="ExpiryTime">ExpiryTime</param>
 /// <param name="RoutingType">RoutingType</param>
 /// <param name="RoutingTime">RoutingTime</param>
 /// <param name="LastModifiedBy">LastModifiedBy</param>
 /// <returns></returns>
 public string InsertGroupSettings(Conn ObjConn, SqlCommand ObjSqlCommmand, int GroupID, int ExpiryTime, string RoutingType, int RoutingTime, string LastModifiedBy)
 {
     return ObjConn.executescalarstringquery(ObjSqlCommmand, " INSERT INTO [GroupSettings]([GroupID],[ExpiryTime],[RoutingType],[RoutingTime],[Created],[LastModifiedBy])"
                                            + " VALUES (" + GroupID + "," + ExpiryTime + ",'" + RoutingType + "'," + RoutingTime + ",GETDATE(),'"
                                            + LastModifiedBy + "')"
                                            + " Select @@IDENTITY");
 }
 /// <summary>
 /// Is User Group Exists
 /// </summary>
 /// <param name="ObjConn">SqlConnection</param>
 /// <param name="ObjSqlCommmand">SqlCommand</param>
 /// <param name="GroupID">GroupID</param>
 /// <param name="UserID">UserID</param>
 /// <returns></returns>
 public bool IsUserGroupExists(Conn ObjConn, SqlCommand ObjSqlCommmand, int GroupID, int UserID)
 {
     int i = ObjConn.executeselectcountquery(ObjSqlCommmand, "select count(1) from [GroupsToUsers] where [GroupID] = " + GroupID.ToString() + " and [UserID] = " + UserID.ToString());
     if (i > 0)
         return true;
     else
         return false;
 }
Example #5
0
 void Page_Load(Object sender,EventArgs e)
 {
     //公共部分==============================================
      Member_Valicate MCheck=new Member_Valicate();
      MCheck.Member_Check("cn");
      Conn Myconn=new Conn();
      Constr=Myconn.Constr();//获取连接字符串
     //公共部分==============================================
      Data_Bind();
 }
Example #6
0
 static void ConnectInternal(Conn c, Node node, Func<IConnection> create, bool isOutBound)
 {
     try
     {
         if (c == null) return; // User disposed connection so stop trying.
         c.Connection = node.Connect(create(), isOutBound);
     }
     catch
     {
         TaskEx.Delay(1000 * 60 * 5).ContinueWith(n => ConnectInternal(c, node, create, isOutBound));
     }
 }
Example #7
0
 public static IDisposable Connect(Node node, Func<IConnection> create,bool isOutBound)
 {
     var c = new Conn();
     var dispose = Disposable.New(() =>
     {
         if (c.Connection != null)
             c.Connection.Dispose();
         c = null;
     });
     ConnectInternal(c, node, create, isOutBound);
     return dispose;
 }
Example #8
0
    /// <summary>
    /// Create User
    /// </summary>
    /// <param name="ObjConn"></param>
    /// <param name="ObjSqlCommmand"></param>
    /// <param name="Login"></param>
    /// <param name="Password"></param>
    /// <param name="Status"></param>
    /// <param name="OnlineStatus"></param>
    /// <param name="RoleID"></param>
    /// <param name="Email"></param>
    /// <param name="Name"></param>
    /// <param name="Address"></param>
    /// <param name="Photo"></param>
    /// <param name="SessionID"></param>
    /// <param name="LastModifiedBy"></param>
    /// <returns></returns>
    public string CreateUser(Conn ObjConn,SqlCommand ObjSqlCommmand, string Login, string Password, string Status, string OnlineStatus, int RoleID, string Email,string Name,
                           string Address,string Photo,string SessionID,string LastModifiedBy)
    {
        try
        {

        }
        catch (SqlException ex)
        {

        }

        return ObjConn.executescalarstringquery(ObjSqlCommmand, " INSERT INTO [User]([Login],[Password],[Status],[OnlineStatus],[RoleID],[Email],[Name],[Address],[Photo],[SessionID],[Created],[LastModifiedBy])"
                                               +" VALUES ('" + Login + "','" + Password +"','" + Status + "','" + OnlineStatus + "'," +RoleID+ ",'" + Email + "','" + Name + "','"
                                               + Address + "','" + Photo + "','" + SessionID + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + LastModifiedBy + "')"
                                               + " Select @@IDENTITY");
    }
 public DataTable SelectMessageHistory(Conn ObjConn, SqlCommand ObjSqlCommmand, int MessageID)
 {
     return ObjConn.executeSelectQuery(ObjSqlCommmand, "SELECT * from [Message] where [MessageID] = " + MessageID.ToString());
 }
Example #10
0
        public void SingleChar([Values(true, false)] bool prepareCommand)
        {
            using (var cmd = Conn.CreateCommand())
            {
                var testArr  = new byte[] { prepareCommand ? (byte)200 : (byte)'}', prepareCommand ? (byte)0 : (byte)'"', 3 };
                var testArr2 = new char[] { prepareCommand ? (char)200 : '}', prepareCommand ? (char)0 : '"', (char)3 };

                cmd.CommandText = "Select 'a'::\"char\", (-3)::\"char\", :p1, :p2, :p3, :p4, :p5, :p6, :p7, :p8";
                cmd.Parameters.Add(new NpgsqlParameter("p1", NpgsqlDbType.SingleChar)
                {
                    Value = 'b'
                });
                cmd.Parameters.Add(new NpgsqlParameter("p2", NpgsqlDbType.SingleChar)
                {
                    Value = 66
                });
                cmd.Parameters.Add(new NpgsqlParameter("p3", NpgsqlDbType.SingleChar)
                {
                    Value = ""
                });
                cmd.Parameters.Add(new NpgsqlParameter("p4", NpgsqlDbType.SingleChar)
                {
                    Value = "\0"
                });
                cmd.Parameters.Add(new NpgsqlParameter("p5", NpgsqlDbType.SingleChar)
                {
                    Value = "a"
                });
                cmd.Parameters.Add(new NpgsqlParameter("p6", NpgsqlDbType.SingleChar)
                {
                    Value = (byte)231
                });
                cmd.Parameters.Add(new NpgsqlParameter("p7", NpgsqlDbType.SingleChar | NpgsqlDbType.Array)
                {
                    Value = testArr
                });
                cmd.Parameters.Add(new NpgsqlParameter("p8", NpgsqlDbType.SingleChar | NpgsqlDbType.Array)
                {
                    Value = testArr2
                });
                if (prepareCommand)
                {
                    cmd.Prepare();
                }
                using (var reader = cmd.ExecuteReader())
                {
                    reader.Read();
                    var expected = new char[] { 'a', (char)(256 - 3), 'b', (char)66, '\0', '\0', 'a', (char)231 };
                    for (int i = 0; i < expected.Length; i++)
                    {
                        Assert.AreEqual(expected[i], reader.GetChar(i));
                    }
                    var arr  = (char[])reader.GetValue(8);
                    var arr2 = (char[])reader.GetValue(9);
                    Assert.AreEqual(testArr.Length, arr.Length);
                    for (int i = 0; i < arr.Length; i++)
                    {
                        Assert.AreEqual(testArr[i], arr[i]);
                        Assert.AreEqual(testArr2[i], arr2[i]);
                    }
                }
            }
        }
Example #11
0
 /// <summary>
 /// Select Reply based on GroupID and UserID
 /// </summary>
 /// <param name="ObjConn">SqlConnection</param>
 /// <param name="ObjSqlCommmand">SqlCommand</param>
 /// <param name="GroupID">GroupID</param>
 /// <param name="UserID">UserID</param>
 /// <returns></returns>
 public DataTable SelectReply(Conn ObjConn, SqlCommand ObjSqlCommmand, int GroupID, int UserID)
 {
     return ObjConn.executeSelectQuery(ObjSqlCommmand, "SELECT * from [Reply] where [GroupID] = " + GroupID.ToString() + " and [UserID] = " + UserID.ToString());
 }
Example #12
0
 /// <summary>
 /// Delete Gorup Settings
 /// </summary>
 /// <param name="ObjConn">SqlConnection</param>
 /// <param name="ObjSqlCommmand">SqlCommand</param>
 /// <param name="GroupID">GroupID</param>
 /// <returns></returns>
 public string DeleteGorupSettings(Conn ObjConn, SqlCommand ObjSqlCommmand, int GroupID)
 {
     return ObjConn.executescalarstringquery(ObjSqlCommmand, "Delete from [GroupSettings] output deleted.GroupID where [GroupID] = " + GroupID);
 }
Example #13
0
 /// <summary>
 /// Select all Group 
 /// </summary>
 /// <param name="ObjConn">SqlConnection</param>
 /// <param name="ObjSqlCommmand">SqlCommand</param>
 /// <returns></returns>
 public DataTable SelectGroup(Conn ObjConn, SqlCommand ObjSqlCommmand)
 {
     return ObjConn.executeSelectQuery(ObjSqlCommmand, "SELECT * from [Group]");
 }
Example #14
0
        /// <summary>
        /// Inserta, Actualiza o borra de la base de datos seg�n el estado del objeto.
        /// </summary>
        public void Save()
        {
            try
            {
                using (GetData gd = Conn.GetConn("sql"))
                {
                    switch (this._objStat)
                    {
                    case Stat.New:
                        gd.SentenciaSQL = "INSERT INTO Eventos(IdEvento,Nombre,Direccion,CantPersonas,Categoria,Costo,Status,FechaRegistro,FechaEvento) "
                                          + "VALUES(@IdEvento,@Nombre,@Direccion,@CantPersonas,@Categoria,@Costo,@Status,getdate(),@FechaEvento); ";
                        gd.AddParameter(_idevento, "IdEvento");
                        gd.AddParameter(_nombre, "Nombre");
                        gd.AddParameter(_direccion, "Direccion");
                        gd.AddParameter(_cantpersonas, "CantPersonas");
                        gd.AddParameter(_categoria, "Categoria");
                        gd.AddParameter(_costo, "Costo");
                        gd.AddParameter(_status, "Status");
                        gd.AddParameter(_fechaevento, "FechaEvento");
                        if (gd.SaveData() > 0)
                        {
                            this._objStat = Stat.Saved;
                        }
                        break;

                    case Stat.Changed:
                        gd.SentenciaSQL = "UPDATE Eventos SET "
                                          + "Nombre=@Nombre, "
                                          + "Direccion=@Direccion, "
                                          + "CantPersonas=@CantPersonas, "
                                          + "Categoria=@Categoria, "
                                          + "Costo=@Costo, "
                                          + "Status=@Status, "
                                          + "FechaEvento=FechaEvento() "
                                          + "WHERE IdEvento=@IdEvento";
                        gd.AddParameter(_idevento, "IdEvento");
                        gd.AddParameter(_nombre, "Nombre");
                        gd.AddParameter(_direccion, "Direccion");
                        gd.AddParameter(_cantpersonas, "CantPersonas");
                        gd.AddParameter(_categoria, "Categoria");
                        gd.AddParameter(_costo, "Costo");
                        gd.AddParameter(_status, "Status");
                        gd.AddParameter(_fechaevento, "FechaEvento");
                        if (gd.SaveData() > 0)
                        {
                            this._objStat = Stat.Saved;
                        }
                        break;

                    case Stat.Deleted:
                        gd.SentenciaSQL = "DELETE FROM Eventos WHERE IdEvento=@IdEvento";
                        gd.AddParameter(_idevento, "IdEvento");
                        if (gd.SaveData() > 0)
                        {
                            this._objStat = Stat.Saved;
                        }
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Example #15
0
 public void NestedTransaction()
 {
     Conn.BeginTransaction();
     Assert.That(() => Conn.BeginTransaction(), Throws.TypeOf <NotSupportedException>());
 }
Example #16
0
    public static string AgregarBitacora(int IdReporte, string BitacoraDescripcion, bool EnviaCorreoIntegrante, bool EnviaCorreoProveedor)
    {
        CObjeto Respuesta = new CObjeto();

        CUnit.Firmado(delegate(CDB Conn)
        {
            string Error      = "";
            CSecurity permiso = new CSecurity();
            if (permiso.tienePermiso("puedeAgregarBitacoraReporteMantenimiento"))
            {
                if (Conn.Conectado)
                {
                    int IdUsuarioSesion = CUsuario.ObtieneUsuarioSesion(Conn);

                    CObjeto Datos           = new CObjeto();
                    CBitacora cBitacora     = new CBitacora();
                    cBitacora.IdReporte     = IdReporte;
                    cBitacora.Bitacora      = BitacoraDescripcion;
                    cBitacora.IdUsuarioAlta = IdUsuarioSesion;
                    cBitacora.Fecha         = DateTime.Now;
                    Error = ValidarAgregarBitacora(cBitacora);
                    if (Error == "")
                    {
                        //cBitacora.Agregar(Conn);

                        //EnviarCorreo
                        if (EnviaCorreoProveedor == true || EnviaCorreoIntegrante == true)
                        {
                            string To    = "";
                            string Cc    = "";
                            string Bcc   = "";
                            string id    = "";
                            string folio = "";
                            string fechalevantamiento = "";
                            string pais                = "";
                            string estado              = "";
                            string municipio           = "";
                            string sucursal            = "";
                            string medidor             = "";
                            string tablero             = "";
                            string circuito            = "";
                            string descripcionCircuito = "";
                            string tipoConsumo         = "";
                            string responsable         = "";
                            string lugar               = "";
                            string correoproveedor     = "";
                            string correoresponsable   = "";
                            string correos             = "";

                            string spReporte = "EXEC sp_Reporte_Consultar @Opcion";
                            Conn.DefinirQuery(spReporte);
                            Conn.AgregarParametros("@Opcion", 1);
                            CObjeto oMeta       = Conn.ObtenerRegistro();
                            id                  = oMeta.Get("IdReporte").ToString();
                            folio               = oMeta.Get("Folio").ToString();
                            fechalevantamiento  = oMeta.Get("FechaLevantamiento").ToString();
                            pais                = oMeta.Get("Pais").ToString();
                            estado              = oMeta.Get("Estado").ToString();
                            municipio           = oMeta.Get("Municipio").ToString();
                            sucursal            = oMeta.Get("Sucursal").ToString();
                            medidor             = oMeta.Get("Medidor").ToString();
                            tablero             = oMeta.Get("Tablero").ToString();
                            circuito            = oMeta.Get("Circuito").ToString();
                            descripcionCircuito = oMeta.Get("DescripcionCircuito").ToString();
                            tipoConsumo         = oMeta.Get("TipoConsumo").ToString();
                            responsable         = oMeta.Get("Responsable").ToString();
                            correoproveedor     = oMeta.Get("CorreoProveedor").ToString();
                            correoresponsable   = oMeta.Get("CorreoResponsable").ToString();


                            string spCorreos = "EXEC sp_Usuario_ConsultarCorreos @Opcion, @IdReporte";
                            Conn.DefinirQuery(spCorreos);
                            Conn.AgregarParametros("@Opcion", 1);
                            Conn.AgregarParametros("@IdReporte", IdReporte);
                            SqlDataReader Obten = Conn.Ejecutar();

                            if (Obten.HasRows)
                            {
                                while (Obten.Read())
                                {
                                    correos = correos + Obten["Correo"].ToString() + ";";
                                }
                            }
                            Obten.Close();

                            if (correos != "")
                            {
                                correos = correos.Substring(0, correos.Length - 1);
                            }



                            if (EnviaCorreoProveedor == true && EnviaCorreoIntegrante == true)
                            {
                                To = correoproveedor;
                                Cc = correos;
                            }
                            else
                            {
                                if (EnviaCorreoProveedor == true && EnviaCorreoIntegrante == false)
                                {
                                    To = correoproveedor;
                                    Cc = correoresponsable;
                                }
                                else
                                {
                                    if (EnviaCorreoProveedor == false && EnviaCorreoIntegrante == true)
                                    {
                                        To = correos;
                                    }
                                }
                            }
                            Bcc = "";


                            lugar = municipio + ' ' + estado + ' ' + pais;

                            string html      = "";
                            string thisEnter = "\r\n";

                            string separador = HttpContext.Current.Request.UrlReferrer.ToString();
                            string pagina    = separador.Substring(0, separador.LastIndexOf("/") + 1);
                            string URLCorreo = pagina;

                            html = html + thisEnter + "<html>";
                            html = html + thisEnter + "<head></head>";
                            html = html + thisEnter + "<body>";
                            html = html + thisEnter + "<table>";
                            html = html + thisEnter + "<tr>";
                            html = html + thisEnter + "<td style='text-align: center; background-color: #f5f5f5;' colspan='4'><strong>Detalle</strong></td>";
                            html = html + thisEnter + "</tr>";
                            html = html + thisEnter + "<tr>";
                            html = html + thisEnter + "<td><strong>Fecha levantamiento</strong></td>";
                            html = html + thisEnter + "<td>" + fechalevantamiento + "</td>";
                            html = html + thisEnter + "<td><strong>Responsable</strong></td>";
                            html = html + thisEnter + "<td>" + responsable + "</td>";
                            html = html + thisEnter + " </tr>";
                            html = html + thisEnter + "<tr>";
                            html = html + thisEnter + "<td><strong>Lugar</strong></td>";
                            html = html + thisEnter + "<td>" + lugar + "</td>";
                            html = html + thisEnter + "<td><strong>Sucursal</strong></td>";
                            html = html + thisEnter + "<td>" + sucursal + "</td>";
                            html = html + thisEnter + "</tr>";
                            html = html + thisEnter + "<tr>";
                            html = html + thisEnter + "<td><strong>Medidor</strong></td>";
                            html = html + thisEnter + "<td>" + medidor + "</td>";
                            html = html + thisEnter + "<td><strong>Tablero</strong></td>";
                            html = html + thisEnter + "<td>" + tablero + "</td>";
                            html = html + thisEnter + "</tr>";
                            html = html + thisEnter + "<tr>";
                            html = html + thisEnter + "<td><strong>Circuito</strong></td>";
                            html = html + thisEnter + "<td>" + circuito + "</td>";
                            html = html + thisEnter + "<td><strong>Descripcion</strong></td>";
                            html = html + thisEnter + "<td>" + descripcionCircuito + "</td>";
                            html = html + thisEnter + "</tr>";
                            html = html + thisEnter + "<tr>";
                            html = html + thisEnter + "<td><strong>Tipo Consumo</strong></td>";
                            html = html + thisEnter + "<td>" + tipoConsumo + "</td>";
                            html = html + thisEnter + "<td><strong>Consumo por día</strong></td>";
                            html = html + thisEnter + "<td></td>";
                            html = html + thisEnter + "</tr>";
                            html = html + thisEnter + "<tr>";
                            html = html + thisEnter + "<td style='text-align: center; background-color: #f5f5f5;' colspan='4'><strong>Comentario</strong></td>";
                            html = html + thisEnter + "</tr>";
                            html = html + thisEnter + "<tr>";
                            html = html + thisEnter + "<td colspan='4'>" + BitacoraDescripcion + "</td>";
                            html = html + thisEnter + "</tr>";
                            html = html + thisEnter + "</table>";

                            html = html + thisEnter + "<br/><br/>Favor de iniciar sesión para dar seguimiento <a name='aceptar' href='" + URLCorreo + "'  class='enlaceboton' style='text-decoration: none'  title=' Ir a sitio web '>Visitar sitio</a> ";

                            html = html + thisEnter + "</body>";
                            html = html + thisEnter + "</html>";

                            CMail.EnviarCorreo("*****@*****.**", To, Cc, Bcc, "Asunto", html);
                        }
                    }
                    Respuesta.Add("Datos", Datos);
                }
                else
                {
                    Error = Error + "<li>" + Conn.Mensaje + "</li>";
                }
            }
            else
            {
                Error = Error + "<li>No tienes los permisos necesarios</li>";
            }

            Respuesta.Add("Error", Error);
        });

        return(Respuesta.ToString());
    }
Example #17
0
        public async Task WhereObjQueryOptionTest()
        {
            var xx1 = "";

            // where object
            var res1 = await Conn.OpenDebug()
                       .Selecter <Agent>()
                       .Where(new
            {
                Id   = Guid.Parse("000c1569-a6f7-4140-89a7-0165443b5a4b"),
                Name = "樊士芹",
                xxx  = "xxx"
            })
                       .QueryListAsync();

            var tuple1 = (XDebug.SQL, XDebug.Parameters);

            var xx2 = "";


            var option = new AgentQueryOption();

            option.Id   = Guid.Parse("000c1569-a6f7-4140-89a7-0165443b5a4b");
            option.Name = "樊士芹";
            // where method
            var res2 = await Conn.OpenDebug()
                       .Selecter <Agent>()
                       .Where(option.GetCondition())
                       .QueryPagingListAsync(option);

            var tuple2 = (XDebug.SQL, XDebug.Parameters);

            var xx3 = "";

            option.OrderBys = new List <OrderBy>
            {
                new OrderBy
                {
                    Field = "Name",
                    Desc  = true
                }
            };
            // where method -- option orderby
            var res3 = await Conn.OpenDebug()
                       .Selecter <Agent>()
                       .Where(option.GetCondition())
                       .QueryPagingListAsync <AgentVM>(option);

            var tuple3 = (XDebug.SQL, XDebug.Parameters);

            var xx4 = "";

            // where object --> no where
            var res4 = await Conn.OpenDebug()
                       .Selecter <Agent>()
                       .Where(new
            {
                //Id = Guid.Parse("000c1569-a6f7-4140-89a7-0165443b5a4b"),
                //Name = "樊士芹",
                xxx = "xxx"
            })
                       .QueryListAsync();

            var tuple4 = (XDebug.SQL, XDebug.Parameters);

            // no where --> and or
            var res41 = await Conn.OpenDebug()
                        .Selecter <Agent>()
                        .Where(new
            {
                //Id = Guid.Parse("000c1569-a6f7-4140-89a7-0165443b5a4b"),
                //Name = "樊士芹",
                xxx = "xxx"
            })
                        .And(it => it.Id == Guid.Parse("000c1569-a6f7-4140-89a7-0165443b5a4b"))
                        .Or(it => it.AgentLevel == AgentLevel.DistiAgent)
                        .QueryListAsync();

            var tuple41 = (XDebug.SQL, XDebug.Parameters);

            // no where --> or and
            var res42 = await Conn.OpenDebug()
                        .Selecter <Agent>()
                        .Where(new
            {
                //Id = Guid.Parse("000c1569-a6f7-4140-89a7-0165443b5a4b"),
                //Name = "樊士芹",
                xxx = "xxx"
            })
                        .Or(it => it.AgentLevel == AgentLevel.Customer)
                        .And(it => it.Name == "金月琴")
                        .QueryListAsync();

            var tuple42 = (XDebug.SQL, XDebug.Parameters);

            var xx5 = "";

            var option2 = new ProductQueryOption
            {
                VipProduct = null     // true fals null
            };
            // where method -- option orderby
            var res5 = await Conn.OpenDebug()
                       .Selecter <Product>()
                       .Where(option2.GetCondition())
                       .QueryPagingListAsync(option2);

            var tuple5 = (XDebug.SQL, XDebug.Parameters);


            var xx = "";
        }
Example #18
0
    public static string GenerarReporteMantenimientos()
    {
        string  Redaccion = "";
        CObjeto Respuesta = new CObjeto();

        CUnit.Anonimo(delegate(CDB Conn)
        {
            string Error = Conn.Mensaje;
            if (Conn.Conectado)
            {
                CObjeto Datos         = new CObjeto();
                CDB ConexionBaseDatos = new CDB();
                SqlConnection con     = ConexionBaseDatos.conStr();
                //SqlCommand Stored = new SqlCommand("spr_Reporte_MedicionXDía_Mike", con);
                //Stored.CommandType = CommandType.StoredProcedure;
                //SqlDataAdapter dataAdapterRegistros = new SqlDataAdapter(Stored);
                //DataSet ds = new DataSet();
                //dataAdapterRegistros.Fill(ds);

                string spCorreos = "EXEC spr_Reporte_MedicionXDía_Mike";
                Conn.DefinirQuery(spCorreos);
                SqlDataReader Obten = Conn.Ejecutar();

                if (Obten.HasRows)
                {
                    while (Obten.Read())
                    {
                        Redaccion             = "El circuito " + Obten["Circuito"].ToString() + " del medidor " + Obten["Medidor"].ToString() + " del tablero " + Obten["Tablero"].ToString() + " en la sucursal " + Obten["Sucursal"].ToString() + " ha excedido la meta estimada. Meta KwH: " + Obten["MetaKwH"].ToString() + ". Consumo real KwH: " + Obten["RealKwH"].ToString();
                        string thisEnter      = "\r\n";
                        string emailQuoteBody = "";

                        emailQuoteBody = emailQuoteBody + thisEnter + "<html>";
                        emailQuoteBody = emailQuoteBody + thisEnter + "<head>";
                        emailQuoteBody = emailQuoteBody + thisEnter + "<style>";

                        emailQuoteBody = emailQuoteBody + thisEnter + "</style>";
                        emailQuoteBody = emailQuoteBody + thisEnter + "</head>";
                        emailQuoteBody = emailQuoteBody + thisEnter + "<body>";

                        emailQuoteBody = emailQuoteBody + thisEnter + "<table align='center'>";
                        emailQuoteBody = emailQuoteBody + thisEnter + "<tr>";
                        emailQuoteBody = emailQuoteBody + thisEnter + "<td align='center'>";
                        emailQuoteBody = emailQuoteBody + thisEnter + "<table>";
                        emailQuoteBody = emailQuoteBody + thisEnter + "<tr>";
                        emailQuoteBody = emailQuoteBody + thisEnter + "<td style='text-align:left;width:450px;'>";
                        emailQuoteBody = emailQuoteBody + thisEnter + Redaccion;
                        emailQuoteBody = emailQuoteBody + thisEnter + "</td>";
                        emailQuoteBody = emailQuoteBody + thisEnter + "</tr>";
                        emailQuoteBody = emailQuoteBody + thisEnter + "</table>";
                        emailQuoteBody = emailQuoteBody + thisEnter + "</body>";
                        emailQuoteBody = emailQuoteBody + thisEnter + "</head>";
                        emailQuoteBody = emailQuoteBody + thisEnter + "</html>";

                        MailMessage msg = new MailMessage();
                        msg.To.Add("*****@*****.**");
                        msg.CC.Add(new MailAddress("*****@*****.**"));
                        msg.From = new MailAddress("*****@*****.**");
                        //msg.Bcc.Add(new MailAddress("*****@*****.**"));
                        msg.Subject    = "Generación de alertas, sistema medición Yolk";
                        msg.Body       = "Se generaron nuevas alertas del día anterior, éstas mismas las podrá consultar en el sistema en la sección de reportes de mantenimiento.";
                        msg.IsBodyHtml = true;
                        msg.Priority   = MailPriority.Normal;

                        AlternateView htmlView = AlternateView.CreateAlternateViewFromString(emailQuoteBody, null, "text/html");

                        msg.AlternateViews.Add(htmlView);

                        SmtpClient clienteSmtp = new SmtpClient();

                        try
                        {
                            clienteSmtp.Send(msg);
                        }
                        catch (Exception ex)
                        {
                            Console.Write(ex.Message);
                            Console.ReadLine();
                        }
                    }
                }
                Obten.Close();
            }
            Respuesta.Add("Error", Error);
        });
        return(Respuesta.ToString());
    }
Example #19
0
 public void Dispose()
 {
     Conn.Dispose();
 }
Example #20
0
        public override bool IsValid(DataRow R, out string errmess, out string errfield)
        {
            if (!base.IsValid(R, out errmess, out errfield))
            {
                return(false);
            }
            //profservice§2006§34

            if (CfgFn.GetNoNullInt32(R["idser"]) <= 0)
            {
                errmess  = "Bisogna specificare la prestazione";
                errfield = "idser";
                return(false);
            }

            string    filterRitEnpals = QHS.AppAnd(QHS.CmpEq("idser", R["idser"]), QHS.CmpEq("taxkind", 3), QHS.Like("taxref", "%enpals%"));
            DataTable TRitEnpals      = Conn.RUN_SELECT("servicetaxview", "*", null, filterRitEnpals, null, false);

            if (TRitEnpals.Rows.Count > 0)
            {
                errmess = "La denuncia UNIEMENS per il compenso assoggettato ad ENPALS \n\r " +
                          "non sarà prodotta con il flusso UNIEMENS di Easy ma \n\r " +
                          "dovrà essere eventualmente effettuata direttamente dal sito \n\r " +
                          "http://www.inps.it/ . Si raccomanda di informare tempestivamente \n\r " +
                          "l'ufficio competente alla trasmissione della denuncia UNIEMENS.";
                errfield = "idser";
                MessageBox.Show(errmess, "Avviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            bool IsAdmin = (GetSys("manage_prestazioni") != null)
                            ? GetSys("manage_prestazioni").ToString() == "S"
                            : false;

            string filter_idrelated = QHC.CmpEq("idrelated", "profservice§" + R["ycon"] + "§" + R["ncon"]);
            //filter_idrelated = "(idrelated="+QueryCreator.quotedstrvalue(filter_idrelated,true)+")";

            DataTable Tserviceregistry = Conn.RUN_SELECT("serviceregistry", "*", null, filter_idrelated, null, null, true);

            if ((Tserviceregistry.Rows.Count > 0) && (R.RowState == DataRowState.Modified))
            {
                bool   error   = false;
                string message = "";
                if (R["idreg", DataRowVersion.Current].ToString() != R["idreg", DataRowVersion.Original].ToString())
                {
                    message = "Percipiente \n\r ";
                    error   = true;
                }
                if (R["description", DataRowVersion.Current].ToString() != R["description", DataRowVersion.Original].ToString())
                {
                    message = message + "Descrizione \n\r ";
                    error   = true;
                }
                if (R["start", DataRowVersion.Current].ToString() != R["start", DataRowVersion.Original].ToString())
                {
                    message = message + "Data Inizio \n\r ";
                    error   = true;
                }
                if (R["stop", DataRowVersion.Current].ToString() != R["stop", DataRowVersion.Original].ToString())
                {
                    message = message + "Data Fine \n\r ";
                    error   = true;
                }
                if (CfgFn.RoundValuta(CfgFn.GetNoNullDecimal(R["totalcost", DataRowVersion.Current])) != CfgFn.RoundValuta(CfgFn.GetNoNullDecimal(R["totalcost", DataRowVersion.Original])))
                {
                    message = message + "Lordo al beneficiario \n\r ";
                    error   = true;
                }

                if (error)
                {
                    if (IsAdmin)
                    {
                        errmess = "L'Anagrafe delle Prestazioni è stata già generata, e risultano modificati i seguenti dati: \n\r"
                                  + message + "Adeguare anche i dati dell'Incarico.";
                        MessageBox.Show(errmess, "Avviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else
                    {
                        errmess = "Risultano modificati i seguenti dati: \n\r"
                                  + message + "La modifica non è consentita perché l'Anagrafe delle Prestazioni è stata già generata.\r\n" +
                                  "Contattare il servizio assistenza o un utente con ruolo 'manage_prestazioni' ";
                        return(false);
                    }
                }
            }

            //

            if (CfgFn.GetNoNullInt32(R["idreg"]) == 0)
            {
                errmess  = "Inserire il percipiente";
                errfield = "idreg";
                return(false);
            }
            if (R["description"].ToString() == "")
            {
                errmess  = "Il campo descrizione è obbligatorio.";
                errfield = "description";
                return(false);
            }
            if (R["doc"].ToString() == "")
            {
                errmess  = "Il campo documento è obbligatorio e dovrebbe contenere il rif. alla fattura.";
                errfield = "doc";
            }

            if (R["docdate"].ToString() == "")
            {
                errmess  = "Il campo data documento è obbligatorio e dovrebbe contenere la data della fattura.";
                errfield = "docdate";
            }
            //A questo controllo è stato tolto l' uguale,perchè ci sono dei casi in cui i professionisti fatturano solo spese non imponibili
            //anticipate per conto del committente quindi è possibile che l'importo della prestazione sia uguale a zero. Task 3750
            if (CfgFn.GetNoNullDecimal(R["feegross"]) < 0)
            {
                errmess  = "L'importo lordo del contratto deve essere maggiore di zero";
                errfield = "feegross";
                return(false);
            }

            DateTime dataInizio = (DateTime)R["start"];
            DateTime dataFine   = (DateTime)R["stop"];

            if (dataInizio > dataFine)
            {
                errmess  = "La data di fine deve essere identica o successiva a quella di inizio";
                errfield = "stop";
                return(false);
            }

            //Se il percipiente ha un indirizzo AP, nel form del compenso si deve scegliere o S o N
            String    codeaddress   = "07_SW_ANP";
            DateTime  DataInizio    = (DateTime)R["start"];
            object    idaddresskind = Conn.DO_READ_VALUE("address", QHS.CmpEq("codeaddress", codeaddress), "idaddress");
            DataTable Address       = DataAccess.RUN_SELECT(Conn, "registryaddress", "*", null,
                                                            QHS.AppAnd(QHS.CmpEq("idaddresskind", idaddresskind), QHS.CmpEq("idreg", R["idreg"]),
                                                                       QHS.CmpLe("start", DataInizio), QHS.NullOrGe("stop", DataInizio)), false);

            if (Address.Rows.Count > 0)
            {
                if ((R["authneeded"].ToString() != "S") && (R["authneeded"].ToString() != "N"))
                {
                    errfield = "authneeded";
                    errmess  = "Il percipiente ha un indirizzo Anagrafe delle Prestazioni, pertanto va indicato se necessita o meno dell'autorizzazione.";
                    return(false);
                }
            }
            if (R["authneeded"].ToString() == "S" && R["authdoc"].ToString() == "")
            {
                errmess  = "Il campo 'Documento' è obbligatorio";
                errfield = "authdoc";
                return(false);
            }

            if (R["authneeded"].ToString() == "S" && R["authdocdate"] == DBNull.Value)
            {
                errmess  = "Il campo 'data' è obbligatorio";
                errfield = "authdocdate";
                return(false);
            }

            if (R["authneeded"].ToString() == "N" && R["noauthreason"].ToString() == "")
            {
                errmess  = "Il campo 'Motivo' è obbligatorio";
                errfield = "authdoc";
                return(false);
            }


            if ((R.RowState == DataRowState.Added) && (!RowChange.IsAutoIncrement(R.Table.Columns["ncon"])))
            {
                string filterProfService = QHS.AppAnd(QHS.CmpEq("ycon", R["ycon"]),
                                                      QHS.CmpEq("ncon", R["ncon"]));
                int NPRESENT = Conn.RUN_SELECT_COUNT("profservice", filterProfService, true);
                if (NPRESENT > 0)
                {
                    errmess  = "Esiste già un contratto con lo stesso numero.";
                    errfield = "ncon";
                    return(false);
                }
            }
            //Se il DS contiene la tabella registry, controlla che l'idreg abbia il CF,se SI chiama il metodo.
            if (R.Table.DataSet.Tables.Contains("registry") && (R.Table.DataSet.Tables["registry"].Rows.Count > 0))
            {
                DataRow Registry = R.Table.DataSet.Tables["registry"].Rows[0];
                if (Registry["cf"] != DBNull.Value)
                {
                    string errori;
                    if (!CalcolaCodiceFiscale.CodiceFiscaleValido(this.Conn, Registry, out errori))
                    {
                        errmess = "Il Codice Fiscale non è valido!\n" + errori;
                        return(false);
                    }
                }
            }
            else
            {
                //Se il DS non contiene la tabella registry,controlla che l'idreg abbia il CF se SI legge la riga dal DB
                // e chiama il metodo.
                object CF = Conn.DO_READ_VALUE("registry", QHS.CmpEq("idreg", R["idreg"]), "cf");
                if (CF != DBNull.Value)
                {
                    DataTable TRegistry = Conn.RUN_SELECT("registry", "*", null, QHS.CmpEq("idreg", R["idreg"]), null, null, true);
                    if (TRegistry.Rows.Count > 0)
                    {
                        DataRow Registry = TRegistry.Rows[0];
                        string  errori;
                        if (!CalcolaCodiceFiscale.CodiceFiscaleValido(this.Conn, Registry, out errori))
                        {
                            errmess = "Il Codice Fiscale non è valido!\n" + errori;
                            return(false);
                        }
                    }
                }
            }
            return(true);
        }
Example #21
0
 /// <summary>
 /// Select all Users
 /// </summary>
 /// <param name="ObjConn">SqlConnection</param>
 /// <param name="ObjSqlCommmand">SqlCommand</param>
 /// <returns>User Table</returns>
 public DataTable SelectUser(Conn ObjConn, SqlCommand ObjSqlCommmand)
 {
     return ObjConn.executeSelectQuery(ObjSqlCommmand, "select * from [User]");
 }
Example #22
0
 public void SequencialTransaction()
 {
     Conn.BeginTransaction().Rollback();
     Conn.BeginTransaction();
 }
Example #23
0
 /// <summary>
 /// Update User
 /// </summary>
 /// <param name="ObjConn"></param>
 /// <param name="ObjSqlCommmand"></param>
 /// <param name="Password"></param>
 /// <param name="Status"></param>
 /// <param name="OnlineStatus"></param>
 /// <param name="RoleID"></param>
 /// <param name="Email"></param>
 /// <param name="Name"></param>
 /// <param name="Address"></param>
 /// <param name="Photo"></param>
 /// <param name="SessionID"></param>
 /// <param name="LastModifiedBy"></param>
 /// <returns></returns>
 public string UpdateUser(Conn ObjConn, SqlCommand ObjSqlCommmand,int UserID, string Password, string Status, string OnlineStatus, int RoleID, string Email, string Name,
                        string Address, string Photo, string SessionID, string LastModifiedBy)
 {
     return ObjConn.executescalarstringquery(ObjSqlCommmand, " UPDATE [User]  SET [Password] = '" + Password + "',[Status] = '" + Status + "',[OnlineStatus] = '" + OnlineStatus + "',[RoleID] = " + RoleID
                                            + ",[Email] = '" + Email + "',[Name] = '" + Name + "',[Address] = '" + Address + "',[Photo] = '" + Photo + "',[SessionID] = '" + SessionID + "',"
                                            + "[Modified] = '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',[LastModifiedBy] = '" + LastModifiedBy
                                            + "' output inserted.UserID where [UserID] = " + UserID.ToString());
 }
 public error Write(slice <byte> b) => s_WriteByRef?.Invoke(ref this, b) ?? s_WriteByVal?.Invoke(this, b) ?? Conn?.Write(b) ?? throw new PanicException(RuntimeErrorPanic.NilPointerDereference);
Example #25
0
 /// <summary>
 /// Insert User Settings
 /// </summary>
 /// <param name="ObjConn">SqlConnection</param>
 /// <param name="ObjSqlCommmand">SqlCommand</param>
 /// <param name="UserID">UserID</param>
 /// <param name="AttentionSound">AttentionSound</param>
 /// <param name="NewMessageSound">NewMessageSound</param>
 /// <param name="ThemeID">ThemeID</param>
 /// <param name="LastModifiedBy">LastModifiedBy</param>
 /// <returns></returns>
 public string InsertUserSettings(Conn ObjConn, SqlCommand ObjSqlCommmand, int UserID, string AttentionSound, string NewMessageSound, int ThemeID,string LastModifiedBy)
 {
     return ObjConn.executescalarstringquery(ObjSqlCommmand, " INSERT INTO [UserSettings]([UserID],[AttentionSound],[NewMessageSound],[ThemeID],[Created],[LastModifiedBy])"
                                            + " VALUES (" + UserID + ",'" + AttentionSound + "','" + NewMessageSound + "'," + ThemeID + ","
                                            + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + LastModifiedBy + "')"
                                            + " Select @@IDENTITY");
 }
 public error RemoteAddr() => s_RemoteAddrByRef?.Invoke(ref this) ?? s_RemoteAddrByVal?.Invoke(this) ?? Conn?.RemoteAddr() ?? throw new PanicException(RuntimeErrorPanic.NilPointerDereference);
Example #27
0
 /// <summary>
 /// Update Group Settings
 /// </summary>
 /// <param name="ObjConn">SqlConnection</param>
 /// <param name="ObjSqlCommmand">SqlCommand</param>
 /// <param name="GroupID">GroupID</param>
 /// <param name="ExpiryTime">ExpiryTime</param>
 /// <param name="RoutingType">RoutingType</param>
 /// <param name="RoutingTime">RoutingTime</param>
 /// <param name="LastModifiedBy">LastModifiedBy</param>
 /// <returns></returns>
 public string UpdateGroupSettings(Conn ObjConn, SqlCommand ObjSqlCommmand, int GroupID, int ExpiryTime, string RoutingType, int RoutingTime, string LastModifiedBy)
 {
     return ObjConn.executescalarstringquery(ObjSqlCommmand, " UPDATE [GroupSettings] SET [ExpiryTime] = '" + ExpiryTime + "',[RoutingType]='" + RoutingType + "',"
                                            + "[RoutingTime]=" + RoutingTime + ",[Modified]=GETDATE(),[LastModifiedBy]='" + LastModifiedBy + "'"
                                            + " output inserted.GroupID  where [GroupID] =" + GroupID);
 }
 public override void Init()
 {
     Conn  = CreateAutorecoveringConnection();
     Model = Conn.CreateModel();
 }
 public string DeleteMessage(Conn ObjConn, SqlCommand ObjSqlCommmand, int MessageID)
 {
     return ObjConn.executescalarstringquery(ObjSqlCommmand, "DELETE from [Message] output deleted.MessageID where MessageID = " + MessageID);
 }
Example #30
0
 public object ExecuteScalar(string sql, object param)
 {
     return(Conn.ExecuteScalar(ChangePrefix(sql), param
                               , Trans, null, null));
 }
Example #31
0
        public void GetSchemaForeignKeys()
        {
            var dt = Conn.GetSchema("ForeignKeys");

            Assert.IsNotNull(dt);
        }
 public string UpdateMessageHistory(Conn ObjConn, SqlCommand ObjSqlCommmand, int MessageID, int ExecutiveID, string ExecutiveIP, int CustomerID, int MessageSequence, Int16 MessageRead)
 {
     return ObjConn.executescalarstringquery(ObjSqlCommmand, "UPDATE [Message] SET [ExecutiveID] = " + ExecutiveID.ToString() + ",[ExecutiveIP] = '" + ExecutiveIP
                                            + "',[CustomerID] = " + CustomerID.ToString() + ",[MessageSequence] = " + MessageSequence.ToString() + ",[MessageRead] =" + MessageRead.ToString() + " VALUES (" + ExecutiveID.ToString() + ",'" + ExecutiveIP + "'," + CustomerID.ToString() + "," + MessageSequence.ToString() + "','"
                                            + " output inserted.MessageID where MessageID = " + MessageID);
 }
 public error Close() => s_CloseByRef?.Invoke(ref this) ?? s_CloseByVal?.Invoke(this) ?? Conn?.Close() ?? throw new PanicException(RuntimeErrorPanic.NilPointerDereference);
Example #34
0
        public void GetSchemaWithReservedWords()
        {
            DataTable metaDataCollections = Conn.GetSchema(System.Data.Common.DbMetaDataCollectionNames.ReservedWords);

            Assert.IsTrue(metaDataCollections.Rows.Count > 0, "There should be one or more ReservedWords returned.");
        }
 public error SetDeadline(time.Time t) => s_SetDeadlineByRef?.Invoke(ref this, t) ?? s_SetDeadlineByVal?.Invoke(this, t) ?? Conn?.SetDeadline(t) ?? throw new PanicException(RuntimeErrorPanic.NilPointerDereference);
Example #36
0
        public void Execute(DBOperation radnja)
        {
            try
            {
                if (radnja == DBOperation.Save)
                {
                    try
                    {
                        Conn.Open();
                        int result = Cmd.ExecuteNonQuery();
                        Cmd.Parameters.Clear();
                    }
                    catch (Exception ex)
                    {
                        throw;
                    }
                    finally
                    {
                        Conn.Close();
                    }
                }

                if (radnja == DBOperation.SaveWithOutput)
                {
                    try
                    {
                        Conn.Open();
                        int result = Cmd.ExecuteNonQuery();
                    }
                    catch (Exception ex)
                    {
                        Conn.Close();
                        throw;
                    }
                }

                if (radnja == DBOperation.GetDataSet)
                {
                    try
                    {
                        SqlDataAdapter adapter = new SqlDataAdapter(Cmd);
                        DS = new DataSet();
                        adapter.Fill(DS);
                    }
                    catch (Exception ex)
                    {
                        throw;
                    }
                    finally
                    {
                        Conn.Close();
                    }
                }
                if (radnja == DBOperation.GetReader)
                {
                    Conn.Open();
                    Rdr = Cmd.ExecuteReader(CommandBehavior.CloseConnection);
                    if (Rdr.HasRows)
                    {
                        Rdr.Read();
                    }
                }
                if (radnja == DBOperation.GetWhileReader)
                {
                    Conn.Open();
                    Rdr = Cmd.ExecuteReader(CommandBehavior.CloseConnection);
                }
            }
            catch
            {
                throw;
            }
        }
Example #37
0
 public void HandleProtocol(Conn conn, Protocol proto)
 {
     dispatch.Dispatch(conn, proto);
 }
Example #38
0
 public configChart(Chart Grafica)
 {
     this.grafica = Grafica;
     db           = new Conn <_cMascota>();
 }
Example #39
0
 public string strConn()
 {
     Conn cn = new Conn();
     return cn.conexao;
 }
Example #40
0
        public IEnumerable <Customer> Get()
        {
            Conn mysqlGet = new Conn();

            return(mysqlGet.CustomerList());
        }
Example #41
0
 public override void SetDefaults(DataTable PrimaryTable)
 {
     base.SetDefaults(PrimaryTable);
     SetDefault(PrimaryTable, "ayear", Conn.GetSys("esercizio"));
 }
        private void SaveUser()
        {
            try
            {
                if (txtPassword.Text == "")
                {
                    MessageBox.Show("Blank password is not allowed!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                if (txtPassword.Text != txtRepeatPassword.Text)
                {
                    MessageBox.Show("Password dosen't matched!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                if (txtLoginName.Text == "")
                {
                    MessageBox.Show("Please enter your login name!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                Conn          obCon = new Conn();
                SqlConnection ob    = new SqlConnection(obCon.strCon);
                SqlCommand    cmd   = new SqlCommand("SP_SAVE_tblUserAccount", ob);

                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add("@LoginName", SqlDbType.VarChar, 50);
                cmd.Parameters.Add("@FullName", SqlDbType.VarChar, 255);
                cmd.Parameters.Add("@Password", SqlDbType.VarChar, 255);
                cmd.Parameters.Add("@Designation", SqlDbType.VarChar, 50);
                cmd.Parameters.Add("@UserRoll", SqlDbType.VarChar, 50);
                cmd.Parameters.Add("@UserEmail", SqlDbType.VarChar, 50);
                cmd.Parameters.Add("@Telephone", SqlDbType.VarChar, 50);
                cmd.Parameters.Add("@Status", SqlDbType.VarChar, 50);

                cmd.Parameters[0].Value = txtLoginName.Text;
                cmd.Parameters[1].Value = txtFullName.Text;
                cmd.Parameters[2].Value = txtPassword.Text;
                cmd.Parameters[3].Value = cmbDesignation.Text;
                cmd.Parameters[4].Value = cmbRoll.Text;
                cmd.Parameters[5].Value = txtEmail.Text;
                cmd.Parameters[6].Value = txtTelephone.Text;

                if (optActive.Checked == true)
                {
                    cmd.Parameters[7].Value = "Active";
                }
                else if (optInactive.Checked == true)
                {
                    cmd.Parameters[7].Value = "Inactive";
                }

                ob.Open();
                cmd.ExecuteNonQuery();
                ob.Close();

                UpdatePhoto();

                MessageBox.Show("User profile update successfully!", "Successfull", MessageBoxButtons.OK, MessageBoxIcon.Information);
                LoadData();

                txtEmail.Text          = "";
                txtFullName.Text       = "";
                txtLoginName.Text      = "";
                txtPassword.Text       = "";
                txtRepeatPassword.Text = "";
                txtTelephone.Text      = "";
                cmbRoll.SelectedIndex  = 0;

                txtLoginName.Enabled = true;
            }
            catch (Exception error)
            {
                MessageBox.Show("Failed to save User information! " + error.Message.ToString(), "Failed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Example #43
0
 /// <summary>
 /// Is User Exists
 /// </summary>
 /// <param name="ObjConn">SqlConnection</param>
 /// <param name="ObjSqlCommmand">SqlCommand</param>
 /// <param name="Login">Login</param>
 /// <returns>True/False</returns>
 public bool IsUserExists(Conn ObjConn, SqlCommand ObjSqlCommmand,string Login)
 {
     int i = ObjConn.executeselectcountquery(ObjSqlCommmand, "select COUNT(1) from [User] where [Login] = '" + Login + "'");
        if (i > 0)
        return true;
        else
        return false;
 }
Example #44
0
 public virtual IList <T> FindAll()
 {
     var(query, @params) = QueryBuilder.FindAll(EntityDefinition);
     return(Conn.Query <T>(query, @params).ToList());
 }
Example #45
0
 public DataTable SelectUserSettings(Conn ObjConn, SqlCommand ObjSqlCommmand, int UserID)
 {
     return ObjConn.executeSelectQuery(ObjSqlCommmand, "select * from [UserSettings] where [UserID] = " + UserID);
 }
Example #46
0
 /// <summary>
 /// 关闭数据库
 /// </summary>
 public void Close()
 {
     Conn.Close();
 }
Example #47
0
 public string UpdateUserSettings(Conn ObjConn, SqlCommand ObjSqlCommmand, int UserID, string AttentionSound, string NewMessageSound, int ThemeID, string LastModifiedBy)
 {
     return ObjConn.executescalarstringquery(ObjSqlCommmand, " UPDATE [UserSettings] SET [AttentionSound] = '" + AttentionSound + "',[NewMessageSound]='" + NewMessageSound + "',"
                                            + "[ThemeID]=" + ThemeID + ",[Modified]='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',[LastModifiedBy]='" + LastModifiedBy + "'"
                                            + " output inserted.UserID where [UserID] =" + UserID);
 }
Example #48
0
 public Task Connect(Conn message)
 {
     return(orchestrator.Connect(Context.ConnectionId, message));
 }
Example #49
0
 /// <summary>
 /// Delete User Settings
 /// </summary>
 /// <param name="ObjConn">SqlConnection</param>
 /// <param name="ObjSqlCommmand">SqlCommand</param>
 /// <param name="UserID">UserID</param>
 /// <returns>UserID</returns>
 public string DeleteUserSettings(Conn ObjConn, SqlCommand ObjSqlCommmand, int UserID)
 {
     return ObjConn.executescalarstringquery(ObjSqlCommmand, "Delete from [UserSettings] output deleted.UserID where [UserID] = " + UserID);
 }
Example #50
0
 //心跳
 public void MsgHeatBeat(Conn conn, ProtocolBase protoBase)
 {
     conn.lastTickTime = Sys.GetTimeStamp();
     Console.WriteLine("[更新心跳时间]" + conn.GetAddress());
 }
Example #51
0
 /// <summary>
 /// Select Group based on GroupID
 /// </summary>
 /// <param name="ObjConn">SqlConnection</param>
 /// <param name="ObjSqlCommmand">SqlCommand</param>
 /// <param name="GroupID">GroupID</param>
 /// <returns></returns>
 public DataTable SelectGroup(Conn ObjConn, SqlCommand ObjSqlCommmand, int GroupID)
 {
     return ObjConn.executeSelectQuery(ObjSqlCommmand, "SELECT * from [Group] where [GroupID] = " + GroupID.ToString());
 }
Example #52
0
 public ShoppingController(Conn context)
 {
     this._context = context;
 }
Example #53
0
 /// <summary>
 /// Update Group
 /// </summary>
 /// <param name="ObjConn">SqlConnection</param>
 /// <param name="ObjSqlCommmand">SqlCommand</param>
 /// <param name="GroupName">GroupName</param>
 /// <param name="GroupEmail">GroupEmail</param>
 /// <param name="Status">Status</param>
 /// <param name="LastModifiedBy">LastModifiedBy</param>
 /// <returns></returns>
 public string UpdateGroup(Conn ObjConn, SqlCommand ObjSqlCommmand,int GroupID, string GroupName, string GroupEmail, string Status, string LastModifiedBy)
 {
     return ObjConn.executescalarstringquery(ObjSqlCommmand, "UPDATE [Group] SET [GroupName] = '" + GroupName + "',[GroupEmail]='" + GroupEmail + "',[Status]='" + Status
                                            + "',[Modified]=GETDATE(),[LastModifiedBy]='"
                                            + LastModifiedBy + "' output inserted.GroupID where GroupID = " + GroupID.ToString());
 }
Example #54
0
 public ActionResult <IEnumerable <Shopping> > GetShopping(string id)
 {
     _context = HttpContext.RequestServices.GetService(typeof(Conn)) as Conn;
     return(_context.GetShopping(id));
 }
Example #55
0
 /// <summary>
 /// Create Group
 /// </summary>
 /// <param name="ObjConn">SqlConnection</param>
 /// <param name="ObjSqlCommmand">SqlCommand</param>
 /// <param name="GroupName">GroupName</param>
 /// <param name="GroupEmail">GroupEmail</param>
 /// <param name="Status">Status</param>
 /// <param name="LastModifiedBy">LastModifiedBy</param>
 /// <returns></returns>
 public string CreateGroup(Conn ObjConn, SqlCommand ObjSqlCommmand, string GroupName, string GroupEmail, string Status,string LastModifiedBy)
 {
     return ObjConn.executescalarstringquery(ObjSqlCommmand, "INSERT INTO [Group]([GroupName],[GroupEmail],[Status],[Created],[LastModifiedBy])"
                                            + " VALUES ('" + GroupName + "','" + GroupEmail + "','" + Status + "',GETDATE(),'"
                                            + LastModifiedBy + "')"+ " Select @@IDENTITY");
 }
Example #56
0
 protected virtual void TearDown()
 {
     try { Conn.Close(); }
     finally { Conn = null; }
 }
Example #57
0
 /// <summary>
 /// Delete Group
 /// </summary>
 /// <param name="ObjConn">SqlConnection</param>
 /// <param name="ObjSqlCommmand">SqlCommand</param>
 /// <param name="GroupID">GroupID</param>
 /// <returns></returns>
 public string DeleteGroup(Conn ObjConn, SqlCommand ObjSqlCommmand, int GroupID)
 {
     return ObjConn.executescalarstringquery(ObjSqlCommmand, "DELETE from [Group] output deleted.GroupID where [GroupID] = " + GroupID.ToString());
 }
 /// <summary>
 /// Create User Group
 /// </summary>
 /// <param name="ObjConn">SqlConnection</param>
 /// <param name="ObjSqlCommmand">SqlCommand</param>
 /// <param name="GroupID">GroupID</param>
 /// <param name="UserID">UserID</param>
 /// <param name="LastModifiedBy">LastModifiedBy</param>
 /// <returns></returns>
 public string CreateUserGroup(Conn ObjConn, SqlCommand ObjSqlCommmand, int GroupID,int UserID, string LastModifiedBy)
 {
     return ObjConn.executescalarstringquery(ObjSqlCommmand, "INSERT INTO [GroupsToUsers]([GroupID],[UserID],[Created],[LastModifiedBy])"
                                            + " VALUES (" + GroupID + "," + UserID + ",'" +  DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','"
                                            + LastModifiedBy + "')" + " Select @@IDENTITY");
 }
Example #59
0
 /// <summary>
 /// Is Group Exists
 /// </summary>
 /// <param name="ObjConn">SqlConnection</param>
 /// <param name="ObjSqlCommmand">SqlCommand</param>
 /// <param name="GroupName">GroupName</param>
 /// <returns></returns>
 public bool IsGroupExists(Conn ObjConn, SqlCommand ObjSqlCommmand, string GroupName)
 {
     int i = ObjConn.executeselectcountquery(ObjSqlCommmand, "select count(1) from [User] where GroupName = '" + GroupName + "'");
     if (i > 0)
         return true;
     else
         return false;
 }
Example #60
0
 /// <summary>
 /// Select Reply based on ReplyID
 /// </summary>
 /// <param name="ObjConn">SqlConnection</param>
 /// <param name="ObjSqlCommmand">SqlCommand</param>
 /// <param name="ReplyID">ReplyID</param>
 /// <returns></returns>
 public DataTable SelectReply(Conn ObjConn, SqlCommand ObjSqlCommmand, int ReplyID)
 {
     return ObjConn.executeSelectQuery(ObjSqlCommmand, "SELECT * from [Reply] where [ReplyID] = " + ReplyID.ToString());
 }