Пример #1
0
        public int Set_UserUpdate(int pUserID, bool pLogedIn, string pSessionID, bool pDesktopApp)
        {
            int    lResponse = 0;
            string lResp     = lSql.ConnectSQL("s24WebPOS");

            if (lResp.Length > 0)
            {
                throw new Exception(lResp);
            }

            StringBuilder sSQL = new StringBuilder();

            if (pDesktopApp)
            {
                sSQL.AppendLine("UPDATE _mrt_Users SET anAppLogedIn = @anAppLogedIn, acSesionID = @acSesionID, adTimeMod = GETDATE()  ");
                sSQL.AppendLine("WHERE  anUserID = @anUserID ");

                SqlParameter[] sqlParams = new SqlParameter[] {
                    new SqlParameter("@anUserID", pUserID),
                    new SqlParameter("@anAppLogedIn", pLogedIn),
                    new SqlParameter("@acSesionID", pSessionID)
                };

                lResp = lSql.ExecuteQuery(sSQL, sqlParams);
                lSql.DisconnectSQL();
                if (lResp.Length == 0)
                {
                    lResponse = 1;
                }
            }
            else
            {
                sSQL.AppendLine("UPDATE _mrt_Users SET anLogedIn = @anLogedIn, acSesionID = @acSesionID, adTimeMod = GETDATE()  ");
                sSQL.AppendLine("WHERE  anUserID = @anUserID ");

                SqlParameter[] sqlParams = new SqlParameter[] {
                    new SqlParameter("@anUserID", pUserID),
                    new SqlParameter("@anLogedIn", pLogedIn),
                    new SqlParameter("@acSesionID", pSessionID)
                };

                lResp = lSql.ExecuteQuery(sSQL, sqlParams);
                lSql.DisconnectSQL();
                if (lResp.Length == 0)
                {
                    lResponse = 1;
                }
            }

            return(lResponse);
        }
Пример #2
0
        public static void Delete(DeviceData pData)
        {
            cSettings.GetSettings("");
            cSQL   lSql  = new cSQL();
            string lResp = lSql.ConnectSQL(Splosno.AppSQLName);

            if (lResp.Length > 0)
            {
                throw new Exception(lResp);
            }

            StringBuilder sSQL = new StringBuilder();

            sSQL.AppendLine("DELETE FROM DevicesData  ");
            sSQL.AppendLine("WHERE (ID = @ID) ");
            sSQL.AppendLine(" ");

            SqlParameter[] sqlParams = new SqlParameter[] {
                new SqlParameter("@ID", pData.Id)
            };

            string lErr = lSql.ExecuteQuery(sSQL, sqlParams);

            lSql.DisconnectSQL();

            if (lErr.Length > 0)
            {
                throw new Exception(lErr);
            }
        }
Пример #3
0
        public static void Add_UserRole(string pRoleID, string pUserName, int pModifUser)
        {
            cSettings.GetSettings("");
            cSQL   lSql  = new cSQL();
            string lResp = lSql.ConnectSQL(Splosno.AppSQLName);

            if (lResp.Length > 0)
            {
                throw new Exception(lResp);
            }

            StringBuilder sSQL = new StringBuilder();

            sSQL.AppendLine("INSERT INTO _mrt_UserRoles (acRoleID, acUserName, anUserMod, adTimeMod) ");
            sSQL.AppendLine("VALUES (@RoleID, @UserName, @ModifiedUser, GETDATE() ) ");
            sSQL.AppendLine(" ");

            SqlParameter[] sqlParams = new SqlParameter[] {
                new SqlParameter("@RoleID", pRoleID),
                new SqlParameter("@UserName", pUserName),
                new SqlParameter("@ModifiedUser", pModifUser)
            };

            string lErr = lSql.ExecuteQuery(sSQL, sqlParams);

            lSql.DisconnectSQL();
            if (lErr.Length > 0)
            {
                throw new Exception(lErr);
            }

            return;
        }
Пример #4
0
        public static void Delete(Customer pData)
        {
            cSettings.GetSettings("");
            cSQL   lSql  = new cSQL();
            string lResp = lSql.ConnectSQL(Splosno.AppSQLName);

            if (lResp.Length > 0)
            {
                throw new Exception(lResp);
            }

            StringBuilder sSQL = new StringBuilder();

            sSQL.AppendLine("DELETE FROM Customers  ");
            sSQL.AppendLine("WHERE (anCustomerID = @anCustomerID) ");
            sSQL.AppendLine(" ");

            SqlParameter[] sqlParams = new SqlParameter[] {
                new SqlParameter("@anCustomerID", pData.anCustomerID)
            };

            string lErr = lSql.ExecuteQuery(sSQL, sqlParams);

            lSql.DisconnectSQL();

            if (lErr.Length > 0)
            {
                throw new Exception(lErr);
            }
            if (Seznam.Any(l => l.anCustomerID == pData.anCustomerID))
            {
                Seznam.Remove(Seznam.First(l => l.anCustomerID == pData.anCustomerID));
            }
        }
Пример #5
0
        public static void Delete_UserRoles(string pUserName)
        {
            cSettings.GetSettings("");
            cSQL   lSql  = new cSQL();
            string lResp = lSql.ConnectSQL(Splosno.AppSQLName);

            if (lResp.Length > 0)
            {
                throw new Exception(lResp);
            }

            StringBuilder sSQL = new StringBuilder();

            sSQL.AppendLine("DELETE FROM _mrt_UserRoles ");
            sSQL.AppendLine("WHERE acUserName = @UserName ");
            sSQL.AppendLine(" ");

            SqlParameter[] sqlParams = new SqlParameter[] {
                new SqlParameter("@UserName", pUserName)
            };

            string lErr = lSql.ExecuteQuery(sSQL, sqlParams);

            lSql.DisconnectSQL();
            if (lErr.Length > 0)
            {
                throw new Exception(lErr);
            }

            return;
        }
Пример #6
0
        public static int Add(string pUserName, string pPassword, string pFirstName, string pLastName, bool pActive, string pPravice, string pEmail, string pGsm, bool pAdmin, int pModifUser)
        {
            foreach (DataRow r in Get().Rows)
            {
                string username_check = Convert.ToString(r["acUserName"]).ToLower();
                if (username_check == pUserName.ToLower())
                {
                    throw new Exception("Uporabnik s tem uporabniškim imenom že obstaja");
                }
            }
            cSettings.GetSettings("");
            cSQL   lSql  = new cSQL();
            string lResp = lSql.ConnectSQL(Splosno.AppSQLName);

            if (lResp.Length > 0)
            {
                throw new Exception(lResp);
            }

            int           id   = 0;
            StringBuilder sSQL = new StringBuilder();

            sSQL.AppendLine("declare @id int ");
            sSQL.AppendLine(" ");
            sSQL.AppendLine("INSERT INTO [_mrt_Users] ([acUserName], [acPassword], [acFirstName], [acLastName], [anActive], [adTimeMod], anUserMod, [anAdmin], acEmail, acGsm) ");
            sSQL.AppendLine(" VALUES (@UserName, @Password, @FirstName, @LastName, @Active, @ModifiedDate, @anUserMod, @anAdmin, @Email, @Gsm) ");
            sSQL.AppendLine("set @id=scope_identity() ");
            sSQL.AppendLine("select @id ");

            SqlParameter[] sqlParams = new SqlParameter[] {
                new SqlParameter("@UserName", pUserName),
                new SqlParameter("@Password", pPassword),
                new SqlParameter("@FirstName", pFirstName),
                new SqlParameter("@LastName", pLastName),
                new SqlParameter("@Active", pActive),
                new SqlParameter("@ModifiedDate", DateTime.Now),
                new SqlParameter("@anAdmin", pAdmin),
                new SqlParameter("@anUserMod", pModifUser),
                new SqlParameter("@Email", pEmail),
                new SqlParameter("@Gsm", pGsm)
            };

            string lErr = lSql.ExecuteQuery(sSQL, sqlParams, out id);

            lSql.DisconnectSQL();
            if (lErr.Length > 0)
            {
                throw new Exception(lErr);
            }

            //if (id > 0 && pPravice.Length > 0) // add user rolse
            //{
            //    Add_UserRoles(pPravice, pUserName, pModifUser);
            //}

            return(id);
        }
Пример #7
0
        public static int Insert(Customer pData)
        {
            cSettings.GetSettings("");
            cSQL   lSql  = new cSQL();
            string lResp = lSql.ConnectSQL(Splosno.AppSQLName);

            if (lResp.Length > 0)
            {
                throw new Exception(lResp);
            }

            int           id   = 0;
            StringBuilder sSQL = new StringBuilder();

            sSQL.AppendLine("declare @id int ");
            sSQL.AppendLine(" ");
            sSQL.AppendLine("INSERT INTO Customers (anCustomerID, acShortTitle, acTitle, acAddress, anPostID, acPostTitle, acVATPrefix, acVATNumber, acVATTypeID, anCountryID, acTelephone, anActive, acNote, aceMaile, acContactName, adModificationDate, anUserMod, anErpID) ");
            sSQL.AppendLine("VALUES (@anCustomerID, @acShortTitle, @acTitle, @acAddress, @anPostID, @acPostTitle, @acVATPrefix, @acVATNumber, @acVATTypeID, @anCountryID, @acTelephone, @anActive, @acNote, @aceMaile, @acContactName, @adModificationDate, @anUserMod, @anErpID) ");
            sSQL.AppendLine("set @id=scope_identity() ");
            sSQL.AppendLine("select @id ");

            SqlParameter[] sqlParams = new SqlParameter[] {
                new SqlParameter("@anCustomerID", pData.anCustomerID),
                new SqlParameter("@acShortTitle", pData.acShortTitle),
                new SqlParameter("@anActive", pData.anActive),
                new SqlParameter("@acTitle", pData.acTitle),
                new SqlParameter("@acAddress", pData.acAddress),
                new SqlParameter("@acPostTitle", pData.acPostTitle),
                new SqlParameter("@anPostID", pData.anPostID),
                new SqlParameter("@acVATPrefix", pData.acVATPrefix),
                new SqlParameter("@acVATNumber", pData.acVATNumber),
                new SqlParameter("@acVATTypeID", pData.acVATTypeID),
                new SqlParameter("@anCountryID", pData.anCountryID),
                new SqlParameter("@acTelephone", pData.acTelephone),
                new SqlParameter("@acNote", pData.acNote),
                new SqlParameter("@aceMaile", pData.aceMaile),
                new SqlParameter("@acContactName", pData.acContactName),
                new SqlParameter("@adModificationDate", pData.adModificationDate),
                new SqlParameter("@anUserMod", pData.anUserMod),
                new SqlParameter("@anErpID", pData.anErpID)
            };

            string lErr = lSql.ExecuteQuery(sSQL, sqlParams, out id);

            lSql.DisconnectSQL();

            if (lErr.Length > 0)
            {
                throw new Exception(lErr);
            }

            osvezi_stranko(pData);

            return(id);
        }
Пример #8
0
        public static void Update(Customer pData)
        {
            cSettings.GetSettings("");
            cSQL   lSql  = new cSQL();
            string lResp = lSql.ConnectSQL(Splosno.AppSQLName);

            if (lResp.Length > 0)
            {
                throw new Exception(lResp);
            }

            StringBuilder sSQL = new StringBuilder();

            // get data
            sSQL.Remove(0, sSQL.Length);
            sSQL.AppendLine("UPDATE Customers SET acShortTitle = @acShortTitle, acTitle = @acTitle, acAddress = @acAddress, anPostID = @anPostID, acPostTitle = @acPostTitle,  ");
            sSQL.AppendLine("    acVATPrefix=@acVATPrefix, acVATNumber = @acVATNumber, acVATTypeID = @acVATTypeID, anCountryID = @anCountryID, acTelephone=@acTelephone, aceMaile = @aceMaile, acContactName = @acContactName, ");
            sSQL.AppendLine("    anActive=@anActive, acNote=@acNote, adModificationDate=@adModificationDate, anUserMod=@anUserMod, anErpID=@anErpID ");
            sSQL.AppendLine("where anCustomerID=@id ");
            sSQL.AppendLine(" ");

            SqlParameter[] sqlParams = new SqlParameter[] {
                new SqlParameter("@id", pData.anCustomerID),
                new SqlParameter("@acShortTitle", pData.acShortTitle),
                new SqlParameter("@anActive", pData.anActive),
                new SqlParameter("@acTitle", pData.acTitle),
                new SqlParameter("@acAddress", pData.acAddress),
                new SqlParameter("@acPostTitle", pData.acPostTitle),
                new SqlParameter("@anPostID", pData.anPostID),
                new SqlParameter("@acVATPrefix", pData.acVATPrefix),
                new SqlParameter("@acVATNumber", pData.acVATNumber),
                new SqlParameter("@acVATTypeID", pData.acVATTypeID),
                new SqlParameter("@anCountryID", pData.anCountryID),
                new SqlParameter("@acTelephone", pData.acTelephone),
                new SqlParameter("@acNote", pData.acNote),
                new SqlParameter("@aceMaile", pData.aceMaile),
                new SqlParameter("@acContactName", pData.acContactName),
                new SqlParameter("@adModificationDate", pData.adModificationDate),
                new SqlParameter("@anUserMod", pData.anUserMod),
                new SqlParameter("@anErpID", pData.anErpID)
            };

            string lErr = lSql.ExecuteQuery(sSQL, sqlParams);

            lSql.DisconnectSQL();

            if (lErr.Length > 0)
            {
                throw new Exception(lErr);
            }

            osvezi_stranko(pData);
        }
Пример #9
0
        public static void Set(string pGroup, string pKey, int pUserMod, string pKeyValue = "")
        {
            cSettings.GetSettings("");
            cSQL   lSql  = new cSQL();
            string lResp = lSql.ConnectSQL(Splosno.AppSQLName);

            if (lResp.Length > 0)
            {
                throw new Exception(lResp);
            }

            StringBuilder sSQL = new StringBuilder();

            sSQL.AppendLine("declare @acGroup varchar(50), @acKey varchar(200), @acKeyValue varchar(max), @tmpKeyValue varchar(max), @anUserMod int ");
            sSQL.AppendLine("SET @acGroup = @pGroup ");
            sSQL.AppendLine("SET @acKey = @pKey ");
            sSQL.AppendLine("SET @acKeyValue = @pKeyValue ");
            sSQL.AppendLine("SET @anUserMod = @pUserMod ");
            sSQL.AppendLine(" ");
            sSQL.AppendLine("select @tmpKeyValue = acKeyValue from _mrt_Settings ");
            sSQL.AppendLine("WHERE acGroup = @acGroup AND acKey = @acKey ");
            sSQL.AppendLine(" ");
            sSQL.AppendLine("IF @tmpKeyValue IS NULL ");
            sSQL.AppendLine(" BEGIN ");
            sSQL.AppendLine("   INSERT INTO _mrt_Settings (acGroup, acKey, acKeyValue, adTimeMod, anUserMod) ");
            sSQL.AppendLine("   VALUES (@acGroup, @acKey, @acKeyValue, GETDATE(), @anUserMod) ");
            sSQL.AppendLine(" END ");
            sSQL.AppendLine("ELSE ");
            sSQL.AppendLine(" BEGIN ");
            sSQL.AppendLine("   UPDATE _mrt_Settings SET acKeyValue = @acKeyValue, adTimeMod = GETDATE(), anUserMod = @anUserMod ");
            sSQL.AppendLine("   WHERE acGroup = @acGroup AND acKey = @acKey ");
            sSQL.AppendLine(" END ");
            sSQL.AppendLine(" ");

            SqlParameter[] sqlParams = new SqlParameter[] {
                new SqlParameter("@pGroup", pGroup),
                new SqlParameter("@pKey", pKey),
                new SqlParameter("@pKeyValue", pKeyValue),
                new SqlParameter("@pUserMod", pUserMod)
            };

            string lErr = lSql.ExecuteQuery(sSQL, sqlParams);

            lSql.DisconnectSQL();
            if (lErr.Length > 0)
            {
                throw new Exception(lErr);
            }
        }
Пример #10
0
        public static void Insert(Country pData)
        {
            cSettings.GetSettings("");
            cSQL   lSql  = new cSQL();
            string lResp = lSql.ConnectSQL(Splosno.AppSQLName);

            if (lResp.Length > 0)
            {
                throw new Exception(lResp);
            }

            StringBuilder sSQL = new StringBuilder();

            // get data
            sSQL.Remove(0, sSQL.Length);
            sSQL.AppendLine("INSERT INTO Countrys (anCountryID, acTitle, acISOCode, acCurrency, acVATCodePrefix, anIsEU, anUserMod, anErpID) ");
            sSQL.AppendLine(" VALUES (@anCountryID, @acTitle, @acISOCode, @acCurrency, @acVATCodePrefix, @anIsEU, @anUserMod, @anErpID) ");
            sSQL.AppendLine(" ");
            sSQL.AppendLine(" ");

            SqlParameter[] sqlParams = new SqlParameter[] {
                new SqlParameter("@anCountryID", pData.anCountryID),
                new SqlParameter("@acTitle", pData.acTitle),
                new SqlParameter("@acISOCode", pData.acISOCode),
                new SqlParameter("@acCurrency", pData.acCurrency),
                new SqlParameter("@acVATCodePrefix", pData.acVATCodePrefix),
                new SqlParameter("@anIsEU", pData.anIsEU),
                new SqlParameter("@adModificationDate", pData.adModificationDate),
                new SqlParameter("@anUserMod", pData.anUserMod),
                new SqlParameter("@anErpID", pData.anErpID)
            };

            string lErr = lSql.ExecuteQuery(sSQL, sqlParams);

            lSql.DisconnectSQL();

            if (lErr.Length > 0)
            {
                throw new Exception(lErr);
            }
        }
Пример #11
0
        public static void Update(Post pData)
        {
            cSettings.GetSettings("");
            cSQL   lSql  = new cSQL();
            string lResp = lSql.ConnectSQL(Splosno.AppSQLName);

            if (lResp.Length > 0)
            {
                throw new Exception(lResp);
            }

            StringBuilder sSQL = new StringBuilder();

            // get data
            sSQL.Remove(0, sSQL.Length);
            sSQL.AppendLine("update Posts SET acTitle = @acTitle, acISOCode = @acISOCode, acCode = @acCode,  ");
            sSQL.AppendLine(" adModificationDate = @adModificationDate, anUserMod = @anUserMod, anErpID = @anErpID ");
            sSQL.AppendLine("where id=@id ");
            sSQL.AppendLine(" ");

            SqlParameter[] sqlParams = new SqlParameter[] {
                new SqlParameter("@id", pData.ID),
                new SqlParameter("@acTitle", pData.acTitle),
                new SqlParameter("@acISOCode", pData.acISOCode),
                new SqlParameter("@acCode", pData.acCode),
                new SqlParameter("@adModificationDate", pData.adModificationDate),
                new SqlParameter("@anUserMod", pData.anUserMod),
                new SqlParameter("@anErpID", pData.anErpID)
            };

            string lErr = lSql.ExecuteQuery(sSQL, sqlParams);

            lSql.DisconnectSQL();

            if (lErr.Length > 0)
            {
                throw new Exception(lErr);
            }
        }
Пример #12
0
        public static void Insert(Device pData)
        {
            cSettings.GetSettings("");
            cSQL   lSql  = new cSQL();
            string lResp = lSql.ConnectSQL(Splosno.AppSQLName);

            if (lResp.Length > 0)
            {
                throw new Exception(lResp);
            }

            StringBuilder sSQL = new StringBuilder();

            // get data
            sSQL.Remove(0, sSQL.Length);
            sSQL.AppendLine("INSERT INTO Devices (acDevID, acBT_Name, acTitle, anUserMod, adInsetDate, acEmail, anUserIns)  ");
            sSQL.AppendLine(" VALUES (@acDevID, @acBT_Name, @acTitle, @anUserMod, @adInsetDate, @acEmail, @anUserIns) ");
            sSQL.AppendLine(" ");
            sSQL.AppendLine(" ");

            SqlParameter[] sqlParams = new SqlParameter[] {
                new SqlParameter("@acDevID", pData.acDevID),
                new SqlParameter("@acBT_Name", pData.acBT_Name),
                new SqlParameter("@acTitle", pData.acTitle),
                new SqlParameter("@anUserMod", pData.anUserMod),
                new SqlParameter("@adInsetDate", pData.adInsetDate),
                new SqlParameter("@acEmail", pData.acEmail),
                new SqlParameter("@anUserIns", pData.anUserIns)
            };

            string lErr = lSql.ExecuteQuery(sSQL, sqlParams);

            lSql.DisconnectSQL();

            if (lErr.Length > 0)
            {
                throw new Exception(lErr);
            }
        }
Пример #13
0
        public static void Insert(DeviceData pData)
        {
            cSettings.GetSettings("");
            cSQL   lSql  = new cSQL();
            string lResp = lSql.ConnectSQL(Splosno.AppSQLName);

            if (lResp.Length > 0)
            {
                throw new Exception(lResp);
            }

            StringBuilder sSQL = new StringBuilder();

            // get data
            sSQL.Remove(0, sSQL.Length);
            sSQL.AppendLine("INSERT INTO DevicesData (acDevID, anBatteryVoltage, anSensor1, anUserMod, anSensor2)  ");
            sSQL.AppendLine(" VALUES (@acDevID, @anBatteryVoltage, @anSensor1, @anUserMod, @anSensor2) ");
            sSQL.AppendLine(" ");
            sSQL.AppendLine(" ");

            SqlParameter[] sqlParams = new SqlParameter[] {
                new SqlParameter("@acDevID", pData.acDevID),
                new SqlParameter("@adModificationDate", pData.adModificationDate),
                new SqlParameter("@anBatteryVoltage", pData.anBatteryVoltage),
                new SqlParameter("@anSensor1", pData.anSensor1),
                new SqlParameter("@anUserMod", pData.anUserMod),
                new SqlParameter("@anSensor2", pData.anSensor2)
            };

            string lErr = lSql.ExecuteQuery(sSQL, sqlParams);

            lSql.DisconnectSQL();

            if (lErr.Length > 0)
            {
                throw new Exception(lErr);
            }
        }
Пример #14
0
        public static void Update(DeviceData pData)
        {
            cSettings.GetSettings("");
            cSQL   lSql  = new cSQL();
            string lResp = lSql.ConnectSQL(Splosno.AppSQLName);

            if (lResp.Length > 0)
            {
                throw new Exception(lResp);
            }

            StringBuilder sSQL = new StringBuilder();

            // get data
            sSQL.Remove(0, sSQL.Length);
            sSQL.AppendLine("update DevicesData SET adModificationDate = @adModificationDate, anUserMod = @anUserMod, anBatteryVoltage = @anBatteryVoltage, anSensor1 = @anSensor1, ");
            sSQL.AppendLine(" anSensor2 = @anSensor2 ");
            sSQL.AppendLine("where id=@id ");
            sSQL.AppendLine(" ");

            SqlParameter[] sqlParams = new SqlParameter[] {
                new SqlParameter("@id", pData.Id),
                new SqlParameter("@adModificationDate", pData.adModificationDate),
                new SqlParameter("@anBatteryVoltage", pData.anBatteryVoltage),
                new SqlParameter("@anSensor1", pData.anSensor1),
                new SqlParameter("@anUserMod", pData.anUserMod),
                new SqlParameter("@anSensor2", pData.anSensor2)
            };

            string lErr = lSql.ExecuteQuery(sSQL, sqlParams);

            lSql.DisconnectSQL();

            if (lErr.Length > 0)
            {
                throw new Exception(lErr);
            }
        }
Пример #15
0
        public static void Edit(int id, string pUserName, string pPassword, string pFirstName, string pLastName, bool pActive, bool pAdmin, string pPravice, HttpSessionState s, string pEmail, string pGsm, int pModifUser)
        {
            foreach (DataRow r in Get().Rows)
            {
                int id_check = Convert.ToInt32(r["anUserID"]);
                if (id_check != id)
                {
                    string username_check = Convert.ToString(r["acUserName"]).ToLower();
                    if (username_check == pUserName.ToLower())
                    {
                        throw new Exception("Uporabnik s tem uporabniškim imenom že obstaja");
                    }
                }
            }

            cSettings.GetSettings("");
            cSQL   lSql  = new cSQL();
            string lResp = lSql.ConnectSQL(Splosno.AppSQLName);

            if (lResp.Length > 0)
            {
                throw new Exception(lResp);
            }

            StringBuilder sSQL = new StringBuilder();

            sSQL.AppendLine("UPDATE [_mrt_Users] SET [acFirstName] = @FirstName, [acLastName] = @LastName, anUserMod = @anUserMod, acEmail = @Email, acGSM = @Gsm, ");
            sSQL.AppendLine(" [anActive] = @Active, [adTimeMod] = @ModifiedDate, [anAdmin] = @anAdmin ");
            sSQL.AppendLine("WHERE  anUserID = @ID ");
            sSQL.AppendLine(" ");

            SqlParameter[] sqlParams = new SqlParameter[] {
                new SqlParameter("@UserName", pUserName),
                new SqlParameter("@FirstName", pFirstName),
                new SqlParameter("@LastName", pLastName),
                new SqlParameter("@anUserMod", pModifUser),
                new SqlParameter("@Active", pActive),
                new SqlParameter("@ModifiedDate", DateTime.Now),
                new SqlParameter("@anAdmin", pAdmin),
                new SqlParameter("@ID", id),
                new SqlParameter("@Email", pEmail),
                new SqlParameter("@Gsm", pGsm)
            };

            string lErr = lSql.ExecuteQuery(sSQL, sqlParams);

            lSql.DisconnectSQL();
            if (lErr.Length > 0)
            {
                throw new Exception(lErr);
            }

            if (!string.IsNullOrWhiteSpace(pPassword))
            {
                lResp = lSql.ConnectSQL(Splosno.AppSQLName);
                if (lResp.Length > 0)
                {
                    throw new Exception(lResp);
                }

                sSQL.Remove(0, sSQL.Length);
                sSQL.AppendLine("UPDATE [_mrt_Users] SET [acPassword] = @Password ");
                sSQL.AppendLine("WHERE  anUserID = @ID ");
                sSQL.AppendLine(" ");

                SqlParameter[] sqlParams1 = new SqlParameter[] {
                    new SqlParameter("@Password", pPassword),
                    new SqlParameter("@ID", id)
                };

                lErr = lSql.ExecuteQuery(sSQL, sqlParams1);
                lSql.DisconnectSQL();
                if (lErr.Length > 0)
                {
                    throw new Exception(lErr);
                }
            }

            if (s != null && Convert.ToInt32(s["id"]) == id)
            {
                s["ime"]     = pFirstName;
                s["priimek"] = pLastName;
                s["Email"]   = pEmail;
                s["Gsm"]     = pGsm;
            }

            Add_UserRoles(pPravice, pUserName, pModifUser);
        }