本文整理汇总了C#中Service.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Service.Save方法的具体用法?C# Service.Save怎么用?C# Service.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Service
的用法示例。
在下文中一共展示了Service.Save方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Save
public void Save()
{
string serviceTitle = txtServiceTitle.Text;
string serviceDescription = txtServiceDescription.Text;
Service service = new Service();
service.IsNew = true;
service.ServiceTitle = serviceTitle;
service.ServiceDescription = serviceDescription;
service.Save();
//Now Save Picture As Well..
string result = UploadPrintableFile(service);
if (result.Equals(""))
{
divStatusError.Visible = false;
divStatusSuccess.Visible = true;
lblStatusSuccess.Text = Global.SuccessLabelStatus;
//lblStatusSuccess.ForeColor = System.Drawing.Color.Green;
}
else
{
divStatusSuccess.Visible = false;
divStatusError.Visible = true;
labelStatusError.Text = Global.ErrorLabelStatus + result;
//labelStatusError.ForeColor = System.Drawing.Color.Red;
}
ClearForm();
}
示例2: TestDataModel
public void TestDataModel()
{
var service = new Service() { Name = "Massage", Description = "Relaxing" };//
service.Save();
var member = new Member() { FirstName = "Brad", LastName = "Pitt" };//
member.Save();
//var member = biz.Member.Collection[3];//
var s = member.Services[20];
s.Name = "Companionship2";
member.FirstName = "Christopher";
member.Services.AddRange(biz.Service.Collection);
member.Save();
}
示例3: btnAddService_Click
protected void btnAddService_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
if (serviceId > 0)
{
Service service = new Service(serviceId);
service.IsNew = false;
service.ServiceTitle = txtServiceTitle.Text;
service.ServiceDescription = txtServiceDescription.Text;
try
{
service.Save();
UploadPrintableFile(service);
divStatusError.Visible = false;
divStatusSuccess.Visible = true;
lblStatusSuccess.Text = Global.UpdatedLabelStatus;
//lblStatusSuccess.ForeColor = System.Drawing.Color.Green;
}
catch (Exception ex) {
divStatusSuccess.Visible = false;
divStatusError.Visible = true;
labelStatusError.Text = Global.ErrorLabelStatus + ex.ToString();
//labelStatusError.ForeColor = System.Drawing.Color.Red;
}
}
else
{
try
{
Save();
}
catch(Exception ex)
{
divStatusSuccess.Visible = false;
divStatusError.Visible = true;
labelStatusError.Text = Global.ErrorLabelStatus + ex.ToString();
}
}
}
}
示例4: Update
public void Update(int ServiceId,string ServiceTitle,string ServiceDescription,string ServiceImage)
{
Service item = new Service();
item.MarkOld();
item.IsLoaded = true;
item.ServiceId = ServiceId;
item.ServiceTitle = ServiceTitle;
item.ServiceDescription = ServiceDescription;
item.ServiceImage = ServiceImage;
item.Save(UserName);
}
示例5: Insert
public void Insert(string ServiceTitle,string ServiceDescription,string ServiceImage)
{
Service item = new Service();
item.ServiceTitle = ServiceTitle;
item.ServiceDescription = ServiceDescription;
item.ServiceImage = ServiceImage;
item.Save(UserName);
}
示例6: UploadPrintableFile
string UploadPrintableFile(Service service)
{
string NewFileName = service.ServiceId + "-" + Path.GetFileName(fuServicePicture.PostedFile.FileName);
string FileNameWithoutExt = service.ServiceId + "-" + Path.GetFileNameWithoutExtension(fuServicePicture.PostedFile.FileName);
string error;
if (fuServicePicture.PostedFile.FileName == null || fuServicePicture.PostedFile.FileName.Equals("") && serviceId == 0)
{
service = new Service(Service.Columns.ServiceId, service.ServiceId);
service.IsNew = false;
service.ServiceImage = "NoImage.jpg";
service.Save(Guid.NewGuid());
return string.Empty;
}
if (fuServicePicture.PostedFile.ContentLength > 1)
{
Utility.DeleteFile(Global.ServicesImages + service.ServiceImage);
if (Utility.UploadFile(fuServicePicture, FileNameWithoutExt, Global.ServicesImages, out error))
{
service = new Service(Service.Columns.ServiceId, service.ServiceId);
service.IsNew = false;
service.ServiceImage = NewFileName;
service.Save(Guid.NewGuid());
}
else
{
Service.Destroy(service.ServiceId);
return error.ToString();
}
}
return String.Empty;
}