本文整理汇总了C#中DTO类的典型用法代码示例。如果您正苦于以下问题:C# DTO类的具体用法?C# DTO怎么用?C# DTO使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DTO类属于命名空间,在下文中一共展示了DTO类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UcDetail
public UcDetail(DTO.SanPham data)
{
InitializeComponent();
this.data = data;
if (Init())
{
tbMa.Text = data.MaSanPham;
cbGroup.Text = data.SanPhamGroup.Ten;
tbTen.Text = data.Ten;
if (data.IsActive)
{
rbBan.Checked = true;
}
else
{
rbTamNgung.Checked = true;
}
tbMoTa.Text = data.MoTa;
}
else
{
this.Visible = false;
}
}
示例2: Save
public void Save(DTO.Macro item)
{
using (var sqlMacro = new DataLayer.RemoteHelperDataContext())
{
if (item.Id.HasValue)
{
var items_to_delete = (from itms in sqlMacro.MacroSteps
where itms.MacroId == item.Id
select itms);
foreach (var item_to_delete in items_to_delete)
{
sqlMacro.MacroSteps.DeleteOnSubmit(item_to_delete);
}
}
if (item.Steps != null && item.Steps.Count > 0)
foreach (var item_to_insert in item.Steps)
{
var tmp = new DataLayer.MacroStep
{
CommandLine = null,
SequenceNumber = item_to_insert.SequenceNumber
};
sqlMacro.MacroSteps.InsertOnSubmit(tmp);
}
sqlMacro.SubmitChanges();
}
}
示例3: Create
public static int Create(DTO.MAD_Transportation item)
{
int result = 0;
DataProvider.ConnectionVanTai conn = null;
try
{
conn = new DataProvider.ConnectionVanTai();
conn.Open();
List<System.Data.SqlClient.SqlParameter> lsInput = new List<System.Data.SqlClient.SqlParameter>();
lsInput.Add(new System.Data.SqlClient.SqlParameter("@TransportationNo_", item.TransportationNo_.Trim()));
lsInput.Add(new System.Data.SqlClient.SqlParameter("@TransportationName", item.TransportationName.Trim()));
lsInput.Add(new System.Data.SqlClient.SqlParameter("@RoMooc", item.RoMooc.Trim()));
lsInput.Add(new System.Data.SqlClient.SqlParameter("@Status", item.Status));
result = conn.ExecuteNonQuery("sp_MAD_Transportation_Create", lsInput);
}
catch (Exception ex)
{
result = -1;
}
finally
{
conn.Close();
}
return result;
}
示例4: ThemLOAIKH
public void ThemLOAIKH(DTO.DTOLOAIKH e)
{
List<SqlParameter> parameters = new List<SqlParameter>();
parameters.Add(new SqlParameter("@MALOAIKH", e.MALOAIKH));
parameters.Add(new SqlParameter("@TENLOAIKH", e.TENLOAIKH));
conn.ExecuteProcedure("THEMVAOLOAIKH",parameters);
}
示例5: CapnhatKIEUPHONG
public void CapnhatKIEUPHONG(DTO.DTOKIEUPHONG e)
{
List<SqlParameter> parameters = new List<SqlParameter>();
parameters.Add(new SqlParameter("@MAKP", e.MAKP));
parameters.Add(new SqlParameter("@TENKP", e.TENKP));
conn.ExecuteProcedure("CAPNHATKIEUPHONG",parameters);
}
示例6: ThemTINHTRANG
public void ThemTINHTRANG(DTO.DTOTINHTRANG e)
{
List<SqlParameter> parameters = new List<SqlParameter>();
parameters.Add(new SqlParameter("@MATT", e.MATT));
parameters.Add(new SqlParameter("@TENTT", e.TENTT));
conn.ExecuteProcedure("THEMVAOTINHTRANG",parameters);
}
示例7: Create
public static int Create(DTO.SAM_DriverShipment item)
{
int result = 0;
DataProvider.ConnectionVanTai conn = null;
try
{
conn = new DataProvider.ConnectionVanTai();
conn.Open();
List<System.Data.SqlClient.SqlParameter> lsInput = new List<System.Data.SqlClient.SqlParameter>();
lsInput.Add(new System.Data.SqlClient.SqlParameter("@ShipmentNo_", item.ShipmentNo_));
lsInput.Add(new System.Data.SqlClient.SqlParameter("@TransportationNo_", item.TransportationNo_));
lsInput.Add(new System.Data.SqlClient.SqlParameter("@UserNo_", item.UserNo_));
lsInput.Add(new System.Data.SqlClient.SqlParameter("@IsDriver", item.IsDriver));
result = conn.ExecuteNonQuery("sp_SAM_DriverShipment_Create", lsInput);
}
catch (Exception ex)
{
result = -1;
}
finally
{
conn.Close();
}
return result;
}
示例8: CreateNewPalestrante
public DTO.Palestrante CreateNewPalestrante(DTO.Palestrante palestrante)
{
using (var db = new SemanaTecnologiaEntities())
{
var PalestranteRow = db.Palestrante.Create();
PalestranteRow.NAME = palestrante.NAME;
PalestranteRow.EMAIL = palestrante.EMAIL;
PalestranteRow.CV = palestrante.CV;
PalestranteRow.CITY = palestrante.CITY;
PalestranteRow.TEL = palestrante.TEL;
PalestranteRow.TITRATION = palestrante.TITRATION;
db.Palestrante.Add(PalestranteRow);
db.SaveChanges();
palestrante.PK_PALESTRANTE = PalestranteRow.PK_PALESTRANTE;
return palestrante;
}
}
示例9: Create
public static int Create(DTO.MAD_Employee item)
{
int result = 0;
DataProvider.ConnectionVanTai conn = null;
try
{
conn = new DataProvider.ConnectionVanTai();
conn.Open();
List<System.Data.SqlClient.SqlParameter> lsInput = new List<System.Data.SqlClient.SqlParameter>();
lsInput.Add(new System.Data.SqlClient.SqlParameter("@EmployeeNo_", item.EmployeeNo_));
lsInput.Add(new System.Data.SqlClient.SqlParameter("@EmployeeName", item.EmployeeName));
lsInput.Add(new System.Data.SqlClient.SqlParameter("@EmployeeType", item.EmployeeType));
lsInput.Add(new System.Data.SqlClient.SqlParameter("@IdentityCard", item.IdentityCard));
lsInput.Add(new System.Data.SqlClient.SqlParameter("@Cellphone", item.Cellphone));
lsInput.Add(new System.Data.SqlClient.SqlParameter("@BeginDate", item.BeginDate));
lsInput.Add(new System.Data.SqlClient.SqlParameter("@Status", item.Status));
result = conn.ExecuteNonQuery("sp_MAD_Employee_Create", lsInput);
}
catch (Exception ex)
{
result = -1;
}
finally
{
conn.Close();
}
return result;
}
示例10: CreateDataShapedObject
public object CreateDataShapedObject(DTO.Expense expense, List<string> lstOfFields)
{
if (!lstOfFields.Any())
{
return expense;
}
else
{
// create a new ExpandoObject & dynamically create the properties for this object
ExpandoObject objectToReturn = new ExpandoObject();
foreach (var field in lstOfFields)
{
// need to include public and instance, b/c specifying a binding flag overwrites the
// already-existing binding flags.
var fieldValue = expense.GetType()
.GetProperty(field, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance)
.GetValue(expense, null);
// add the field to the ExpandoObject
((IDictionary<String, Object>)objectToReturn).Add(field, fieldValue);
}
return objectToReturn;
}
}
示例11: Create
public static int Create(DTO.SAM_Contract item)
{
int result = 0;
DataProvider.ConnectionVanTai conn = null;
try
{
conn = new DataProvider.ConnectionVanTai();
conn.Open();
List<System.Data.SqlClient.SqlParameter> lsInput = new List<System.Data.SqlClient.SqlParameter>();
lsInput.Add(new System.Data.SqlClient.SqlParameter("@ContractNo_", item.ContractNo_.Trim()));
lsInput.Add(new System.Data.SqlClient.SqlParameter("@CreatedUser", item.CreatedUser.Trim()));
lsInput.Add(new System.Data.SqlClient.SqlParameter("@CreatedDate", item.CreatedDate));
lsInput.Add(new System.Data.SqlClient.SqlParameter("@PartnerNo_", item.PartnerNo_.Trim()));
lsInput.Add(new System.Data.SqlClient.SqlParameter("@ContractValue", item.ContractValue));
lsInput.Add(new System.Data.SqlClient.SqlParameter("@Status", item.Status));
result = conn.ExecuteNonQuery("sp_SAM_Contract_Create", lsInput);
}
catch (Exception ex)
{
result = -1;
}
finally
{
conn.Close();
}
return result;
}
示例12: UcInfo
public UcInfo(DTO.SanPham data)
{
InitializeComponent();
this.data = data;
isUpdate = true;
lbSelect.Text = Constant.DEFAULT_TITLE_EDIT;
if (Init())
{
tbMa.Text = data.MaSanPham;
tbTen.Text = data.Ten;
if (data.IsActive)
{
rbBan.Checked = true;
}
else
{
rbTamNgung.Checked = true;
}
tbMoTa.Text = data.MoTa;
cbGroup.Text = data.SanPhamGroup.Ten;
}
else
{
this.Visible = false;
}
}
示例13: CreateNewParticipante
public DTO.Participante CreateNewParticipante(DTO.Participante participante)
{
using (var db = new SemanaTecnologiaEntities())
{
var ParticipanteROW = db.Participante.Create();
ParticipanteROW.PK_PARTICIPANTE = participante.PK_PARTICIPANTE;
ParticipanteROW.COURSE = participante.COURSE;
ParticipanteROW.EMAIL = participante.EMAIL;
ParticipanteROW.LOGIN = participante.LOGIN;
ParticipanteROW.NAME = participante.NAME;
ParticipanteROW.PASSWORD = participante.PASSWORD;
ParticipanteROW.PERIOD = participante.PERIOD;
ParticipanteROW.PROFILE = participante.PROFILE;
ParticipanteROW.TEL = participante.TEL;
db.Participante.Add(ParticipanteROW);
db.SaveChanges();
return participante;
}
}
示例14: Create
public static int Create(DTO.SAM_SalesPrice item)
{
int result = 0;
DataProvider.ConnectionVanTai conn = null;
try
{
conn = new DataProvider.ConnectionVanTai();
conn.Open();
List<System.Data.SqlClient.SqlParameter> lsInput = new List<System.Data.SqlClient.SqlParameter>();
lsInput.Add(new System.Data.SqlClient.SqlParameter("@ID", item.ID));
lsInput.Add(new System.Data.SqlClient.SqlParameter("@ContractNo_", item.ContractNo_.Trim()));
lsInput.Add(new System.Data.SqlClient.SqlParameter("@RouteNo_", item.RouteNo_.Trim()));
lsInput.Add(new System.Data.SqlClient.SqlParameter("@ItemNo_", item.ItemNo_.Trim()));
lsInput.Add(new System.Data.SqlClient.SqlParameter("@UnitOfMeasure", item.UnitOfMeasure.Trim()));
lsInput.Add(new System.Data.SqlClient.SqlParameter("@FromDate", item.FromDate));
lsInput.Add(new System.Data.SqlClient.SqlParameter("@ToDate", item.ToDate));
lsInput.Add(new System.Data.SqlClient.SqlParameter("@UnitPrice", item.UnitPrice));
result = conn.ExecuteNonQuery("sp_SAM_SalesPrice_Create", lsInput);
}
catch (Exception ex)
{
result = -1;
}
finally
{
conn.Close();
}
return result;
}
示例15: ThemtblMODULE
public void ThemtblMODULE(DTO.DTOtblMODULE e)
{
List<SqlParameter> parameters = new List<SqlParameter>();
parameters.Add(new SqlParameter("@MODULEID", e.MODULEID));
parameters.Add(new SqlParameter("@MODULENAME", e.MODULENAME));
conn.ExecuteProcedure("THEMVAOtblMODULE",parameters);
}