سلام به مهندسین عزیز
من استادمون از این روش برای اتصال به sql استفاده می کنه . من متوجه نشدم که چجوری این اتفاق داره می افته .
کسی می تونه کمکم کنه ؟؟
public class KanonCrud
{
#region [ - ctor - ]
public KanonCrud()
{
Ref_Person = new DTO.EFModel.Person();
}
#endregion
public Model.DTO.EFModel.Person Ref_Person { get; set; }
#region [ - Insert(string firstname, string lastname, string spicialid, string fathername, string spicialcode, string issued, string legalcode, string jobtitle, string startdate, string filenumber, string degree, string serviceorganzation, string addres, string tell, string mobile, string religion, string states, string city, string postalcode, string email, string accoantnumber, string servicelocation, string education, string typeofretirement, string dateofbirth, string maritalstatus, string numberofchilderen, string fieldofstudy, string garagenumber, string insurancenumber, string servicestartdate, string formermploymentorganisation, string lastsideofnaja, string salary, string description, string serviceenddate) - ]
public void Insert(string firstname, string lastname, string spicialid, string fathername, string spicialcode, string issued, string legalcode, string jobtitle, string startdate, string filenumber, string degree, string serviceorganzation, string addres, string tell, string mobile, string religion, string states, string city, string postalcode, string email, string accoantnumber, string servicelocation, string education, string typeofretirement, string dateofbirth, string maritalstatus, string numberofchilderen, string fieldofstudy, string garagenumber, string insurancenumber, string servicestartdate, string formermploymentorganisation, string lastsideofnaja, string salary, string description,string serviceenddate)
{
using (var context = new DTO.EFModel.KanonEntities2())
{
Ref_Person.FirstName = firstname;
Ref_Person.LastName = lastname;
Ref_Person.SpicialId = spicialid;
Ref_Person.FatherName = fathername;
Ref_Person.SpicialCode = spicialcode;
Ref_Person.Issued = issued;
Ref_Person.LegalCode = legalcode;
Ref_Person.JobTitle = jobtitle;
Ref_Person.StartDate = startdate;
Ref_Person.FileNumber = filenumber;
Ref_Person.Degree = degree;
Ref_Person.ServiceOrganization = serviceorganzation;
Ref_Person.Addres = addres;
Ref_Person.Tell = tell;
Ref_Person.Mobile = mobile;
Ref_Person.Religion = religion;
Ref_Person.States = states;
Ref_Person.City = city;
Ref_Person.PostalCode = postalcode;
Ref_Person.Email = email;
Ref_Person.AccountNumber = accoantnumber;
Ref_Person.ServiceLocation = servicelocation;
Ref_Person.Education = education;
Ref_Person.TypeOfRetirement = typeofretirement;
Ref_Person.DateOfBirth = dateofbirth;
Ref_Person.MaritalStatus = maritalstatus;
Ref_Person.NumberOfChilderen = numberofchilderen;
Ref_Person.FieldOfStudy = fieldofstudy;
Ref_Person.GarageNumber = garagenumber;
Ref_Person.InsuranceNumber = insurancenumber;
Ref_Person.ServiceStartDate = servicestartdate;
Ref_Person.FormerEmploymentOrganization = formermploymentorganisation;
Ref_Person.LastSideOfNaja = lastsideofnaja;
Ref_Person.Salary = salary;
Ref_Person.Descriptions = description;
Ref_Person.ServiceEndDate = serviceenddate;
context.Person.Add(Ref_Person);
context.SaveChanges();
}
}
#endregion
#region [ - SelectAllRecords() - ]
public List<Model.DTO.EFModel.Person> SelectAllRecords()
{
using (var context = new Model.DTO.EFModel.KanonEntities2())
{
var q = context.Person.Select(p => p).OrderBy(p => p.Id).ToList();
return q;
}
}
#endregion
}