public SupportDocDAO()
 {
     ctx = new modelDataContext();//ModelFactory.getModelInstance();
 }
    public bool merge(SupportDocDTO entity)
    {
        try
        {
            var addObj = (from p in ctx.supportDocs
                       where p.userName == @entity.userName && p.title == @entity.title
                       select p).Single();

             supportDoc obj = (supportDoc)addObj;

            /*Update*/
            obj.userName = entity.userName;
            obj.title = entity.title;
            obj.description = entity.description;
            obj.content = new System.Data.Linq.Binary(entity.content);//Array of bytes to Linq.Binary

            ctx.SubmitChanges();
            return true;
        }
        catch (Exception e)
        {
             Log log = new Log();
            log.message = "supportDoc Merge: " + " ["+entity.userName+" , "+entity.title+"] " + e.Message;
            ctx.SubmitChanges();

            ctx.Dispose();
            ctx = new modelDataContext();
            return false;
        }
    }
    public bool presist(SupportDocDTO entity)
    {
        try
        {
             supportDoc obj = new supportDoc();
            obj.userName = entity.userName;
            obj.title = entity.title;
            obj.description = entity.description;
            obj.content = new System.Data.Linq.Binary(entity.content);//Array of bytes to Linq.Binary

            ctx.supportDocs.InsertOnSubmit(obj);
            ctx.SubmitChanges();
            return true;
        }
        catch (Exception)
        {
            ctx.Dispose();
            ctx = new modelDataContext();
            return false;
        }
    }
    public bool removeByUserId(string userName, string title)
    {
        try
        {
            var obj = (from p in ctx.supportDocs
                       where p.userName == @userName && p.title == @title
                       select p).Single();

            supportDoc accObj = (supportDoc)obj;

            ctx.supportDocs.DeleteOnSubmit(accObj);
            ctx.SubmitChanges();
            return true;

        }
        catch (Exception)
        {
            ctx.Dispose();
            ctx = new modelDataContext();
            return false;
        }
    }
    public bool removeByUserId(string question, string vacancyNumber)
    {
        try
        {
            var obj = (from p in ctx.VacancyKillerQuestions
                       where p.question == @question && p.vacancyNumber == @vacancyNumber
                       select p).Single();

            VacancyKillerQuestion accObj = (VacancyKillerQuestion)obj;

            ctx.VacancyKillerQuestions.DeleteOnSubmit(accObj);
            ctx.SubmitChanges();
            return true;

        }
        catch (Exception)
        {
            ctx.Dispose();
            ctx = new modelDataContext();
            return false;
        }
    }
Esempio n. 6
0
    public bool removeByUserId(string userName, string id)
    {
        try
        {
            var obj = (from p in ctx.Users
                       where p.userName == @userName && p.id == @id
                       select p).Single();

            User accObj = (User)obj;

            ctx.Users.DeleteOnSubmit(accObj);
            ctx.SubmitChanges();
            return true;

        }
        catch (Exception)
        {
            ctx.Dispose();
            ctx = new modelDataContext();
            return false;
        }
    }
    public bool merge(ApplicationDTO entity)
    {
        try
        {
            var addObj = (from p in ctx.Applications
                       where p.userName == @entity.userName && p.vacancyNumber == @entity.vacancyNumber
                       select p).Single();

             Application obj = (Application)addObj;

            /*Update*/
            obj.userName = entity.userName;
            obj.vacancyNumber = entity.vacancyNumber;
            obj.status = entity.status;

            ctx.SubmitChanges();
            return true;
        }
        catch (Exception e)
        {
             Log log = new Log();
            log.message = "Application Merge: " + " [" + entity.userName + " , " + entity.vacancyNumber + "] " + e.Message;

            ctx.Dispose();
            ctx = new modelDataContext();
            ctx.SubmitChanges();

            return false;
        }
    }
Esempio n. 8
0
    public bool merge(LicenseDTO entityDTO)
    {
        try
         {
        var obj = (from p in ctx.Licenses
                   where p.userName == @entityDTO.userName
                   select p).Single();

        License accObj = (License)obj;

        /*Update*/
        accObj.userName = entityDTO.userName;
        accObj.type = entityDTO.type;

        ctx.SubmitChanges();
        return true;
          }
          catch (Exception)
          {
              ctx.Dispose();
              ctx = new modelDataContext();
              return false;
          }
    }
    public bool removeByUserId(string userName, string vacancyNumber)
    {
        try
        {
            var obj = (from p in ctx.Applications
                       where p.userName == @userName && p.vacancyNumber == @vacancyNumber
                       select p).Single();

            Application accObj = (Application)obj;

            ctx.Applications.DeleteOnSubmit(accObj);
            ctx.SubmitChanges();
            return true;

        }
        catch (Exception)
        {
            ctx.Dispose();
            ctx = new modelDataContext();
            return false;
        }
    }
 public ApplicationDAO()
 {
     ctx = new modelDataContext();//ModelFactory.getModelInstance();
 }
    public bool presist(ApplicationDTO entity)
    {
        try
        {
            Application obj = new Application();
            obj.userName = entity.userName;
            obj.vacancyNumber = entity.vacancyNumber;
            obj.status = entity.status;

            ctx.Applications.InsertOnSubmit(obj);
            ctx.SubmitChanges();
            return true;
        }
        catch (Exception)
        {
            ctx.Dispose();
            ctx = new modelDataContext();
            return false;
        }
    }
    public bool merge(VacancyKillerQuestionDTO entity)
    {
        try
        {
            var addObj = (from p in ctx.VacancyKillerQuestions
                       where p.question == @entity.question && p.vacancyNumber == @entity.vacancyNumber
                       select p).Single();

             VacancyKillerQuestion obj = (VacancyKillerQuestion)addObj;

            /*Update*/
            obj.question = entity.question;
            obj.vacancyNumber = entity.vacancyNumber;
            obj.answer = entity.answer;

            ctx.SubmitChanges();
            return true;
        }
        catch (Exception e)
        {
             Log log = new Log();
            log.message = "VacancyKillerQuestion Merge: " + " [" + entity.question + " , " + entity.vacancyNumber + "] " + e.Message;
            ctx.SubmitChanges();

            ctx.Dispose();
            ctx = new modelDataContext();
            return false;
        }
    }
 public VacancyKillerQuestionDAO()
 {
     ctx = new modelDataContext();//ModelFactory.getModelInstance();
 }
Esempio n. 14
0
    public bool removeByUserId(string userName)
    {
        try
        {
            var obj = (from p in ctx.Licenses
                       where p.userName == @userName
                       select p).Single();

             License accObj = (License)obj;

            ctx.Licenses.DeleteOnSubmit(accObj);
            ctx.SubmitChanges();
            return true;

        }
        catch (Exception)
        {
            ctx.Dispose();
            ctx = new modelDataContext();
            return false;
        }
    }
Esempio n. 15
0
    public bool merge(UserDTO entity)
    {
        try
        {
            var addObj = (from p in ctx.Users
                       where p.userName == @entity.userName && p.id == @entity.id
                       select p).Single();

             User obj = (User)addObj;

            /*Update*/
            obj.userName = entity.userName;
            obj.id = entity.id;
            obj.fullname = entity.fullName;
            obj.nickName = entity.nickName;
            obj.gender = entity.gender;
            obj.race = entity.race;
            obj.disabled = entity.disabled;
            obj.citizenship = entity.citizenship;
            obj.idType = entity.idType;
            obj.license = entity.license;
            obj.basicEducation = entity.basicEducation;
            obj.higherEducaton = entity.higherEducation;
            obj.language = entity.language;
            obj.residentialAddress = entity.residentialAddress;
            obj.postalAddress = entity.postalAddress;
            obj.employed = entity.employed;
            obj.employmentHistory = entity.employmentHistory;

            ctx.SubmitChanges();
            return true;
        }
        catch (Exception e)
        {
            Log log = new Log();
            log.message = "User Merge: " + " ["+entity.userName+" , "+entity.id+"] " + e.Message;
            ctx.SubmitChanges();

            ctx.Dispose();
            ctx = new modelDataContext();
            return false;
        }
    }
Esempio n. 16
0
 public LicenseDAO()
 {
     ctx = new modelDataContext();//ModelFactory.getModelInstance();
 }
Esempio n. 17
0
    public bool presist(UserDTO entity)
    {
        try
        {
             User obj = new User();
            obj.userName = entity.userName;
            obj.id = entity.id;
            obj.fullname = entity.fullName;
            obj.nickName = entity.nickName;
            obj.gender = entity.gender;
            obj.race = entity.race;
            obj.disabled = entity.disabled;
            obj.citizenship = entity.citizenship;
            obj.idType = entity.idType;
            obj.license = entity.license;
            obj.basicEducation = entity.basicEducation;
            obj.higherEducaton = entity.higherEducation;
            obj.language = entity.language;
            obj.residentialAddress = entity.residentialAddress;
            obj.postalAddress = entity.postalAddress;
            obj.employed = entity.employed;
            obj.employmentHistory = entity.employmentHistory;

            ctx.Users.InsertOnSubmit(obj);
            ctx.SubmitChanges();
            return true;
        }
        catch (Exception)
        {
            ctx.Dispose();
            ctx = new modelDataContext();
            return false;
        }
    }
Esempio n. 18
0
    public bool presist(LicenseDTO entityDTO)
    {
        try
        {
            License obj = new License();
            obj.userName = entityDTO.userName;
            obj.type = entityDTO.type;

            ctx.Licenses.InsertOnSubmit(obj);
            ctx.SubmitChanges();
            return true;
        }
        catch (Exception)
        {
            ctx.Dispose();
            ctx = new modelDataContext();
            return false;
        }
    }
    public bool presist(VacancyKillerQuestionDTO entity)
    {
        try
        {
            VacancyKillerQuestion obj = new VacancyKillerQuestion();
            obj.question = entity.question;
            obj.vacancyNumber = entity.vacancyNumber;
            obj.answer = entity.answer;

            ctx.VacancyKillerQuestions.InsertOnSubmit(obj);
            ctx.SubmitChanges();
            return true;
        }
        catch (Exception)
        {
            ctx.Dispose();
            ctx = new modelDataContext();
            return false;
        }
    }