Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET WebService
[WebMethod]
    public string AddUser(Int64 UID,String Uname,String Password ,String Role,String LastUpdate,String Fname,String Lname,String Company,String City,String State,String Phone,String Email,String Jtype)
    {
        if (UID == 0)
        {
            if (!_obj.SUserMasters.Any(u => u.Username == Uname.Trim()))
            {
                SUserMaster _Utb = new SUserMaster
                {
                    Username = Uname.Trim(),
                    Password = Password.Trim(),
                    Role = Role.Trim(),
                    Lastupdate = LastUpdate,
                    IsActive = true
                };
                _obj.SUserMasters.InsertOnSubmit(_Utb);
                try
                {
                    _obj.SubmitChanges();
                    Int64 _UserID = _Utb.UserID;
                    if (Role == "J")
                    {
                        AddJ(_UserID, Fname, Lname, Company, City, State, Phone, Email, Jtype, "I");
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
 
                }
            }
            //else { // user exists }
            
        }
        else
        {
            var query = from SUser in _obj.SUserMasters where SUser.UserID == UID select SUser;
            // Execute the query, and change the column values
            // you want to change.
            foreach (var _itme in query)
            {
             //   _itme.Username = Uname.Trim();
                _itme.Password = Password.Trim();
                _itme.Role = Role.Trim();
                _itme.Lastupdate = LastUpdate.Trim();
                
                // Insert any additional changes to column values.
            }
            try
            {
                _obj.SubmitChanges();
                AddJ(UID, Fname, Lname, Company, City, State, Phone, Email, Jtype,"U");
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                // Provide for exceptions.
            }
 
        }
        // Submit the changes to the database.
       
        //
        return "Thanks !";
    }
    [WebMethod]
    public string AddJ(Int64 UID, String Fname, String Lname, String Company, String City, String State, String Phone, String Email, String type, String flag)
    {
        if (flag == "I")
        {
            SJudgeInfo _jtb = new SJudgeInfo
            {
                First_Name = Fname.Trim(),
                Last_Name = Lname.Trim(),
                Company = Company.Trim(),
                City = City,
                JState = State,
                Telephone=Phone,
                JEmail=Email,
                JType=type
            };
            _obj.SJudgeInfos.InsertOnSubmit(_jtb);
            try
            {
                _obj.SubmitChanges();
                //Int64 _UserID = _Utb.UserID;

            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                // Provide for exceptions.
            }
 

        }
        else
        {
            var query = from SUser in _obj.SJudgeInfos where SUser.UserID == @UID select SUser;
            // Execute the query, and change the column values
            // you want to change.
            foreach (var _itme in query)
            {
               _itme.First_Name = Fname.Trim();
                _itme.Last_Name = Lname.Trim();
                _itme.Company = Company.Trim();
                _itme.City = City;
                _itme.JState = State;
                _itme.Telephone = Phone;
                _itme.JEmail = Email;
                _itme.JType = type;
                // Insert any additional changes to column values.
            }
            try
            {
                _obj.SubmitChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                // Provide for exceptions.
            }
 
        }
        return "Thanks !";
    }
    [WebMethod]
    public string AddDivision(Int64 ID, String name)
    {
        if (ID == 0)
        {
            if (!_obj.SDivisions.Any(u => u.Division == name.Trim()))
            {
                SDivision _tb = new SDivision
                {
                    Division = name.Trim(),
                };
                _obj.SDivisions.InsertOnSubmit(_tb);
                try
                {
                    _obj.SubmitChanges();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
 
                }
            }
        }
        else {
            if (!_obj.SDivisions.Any(u => u.Division == name.Trim()))
            {
                var query = from SUser in _obj.SDivisions where SUser.DivisionID == ID select SUser;
                // Execute the query, and change the column values
                // you want to change.
                foreach (var _itme in query)
                {
                 
                    _itme.Division = name.Trim();
                 
                }
                try
                {
                    _obj.SubmitChanges();
                 
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    // Provide for exceptions.
                }
            }
        }
        return "Thanks !";
    }
    [WebMethod]
    public string AddWeights(Int64 ID, String name)
    {
        if (ID == 0)
        {
            if (!_obj.SWeights.Any(u => u.Weight == name.Trim()))
            {
                SWeight _tb = new SWeight
                {
                    Weight = name.Trim(),
                };
                _obj.SWeights.InsertOnSubmit(_tb);
                try
                {
                    _obj.SubmitChanges();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
 
                }
            }
        }
        else
        {
            if (!_obj.SWeights.Any(u => u.Weight == name.Trim()))
            {
                var query = from SUser in _obj.SWeights where SUser.WeightID == ID select SUser;
                // Execute the query, and change the column values
                // you want to change.
                foreach (var _itme in query)
                {
 
                    _itme.Weight = name.Trim();
 
                }
                try
                {
                    _obj.SubmitChanges();
 
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    // Provide for exceptions.
                }
            }
        }
        return "Thanks !";
    }
Posted 9-Oct-12 23:01pm
Edited 9-Oct-12 23:05pm
Legor5.5K
v2
Comments
Legor at 10-Oct-12 5:04am
   
Any question related to that pile of code ?
Milind Thakkar at 10-Oct-12 5:07am
   
What is the problem Sir?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Wow you are giving out the whole code !!
If by any chance, your client sees this post, you will be in trouble man !
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You can use SOAP UI to check webservices(The most famous one).
 
Also, Many browsers support checking webservices in built. Open the webservice URL using FireFox and it will provide a webform so that you can enter and validate the webservice.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web02 | 2.8.141015.1 | Last Updated 24 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100