当前位置: 首页>>代码示例>>C#>>正文


C# Service.Save方法代码示例

本文整理汇总了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();
        }
开发者ID:zaheerahmad,项目名称:Admin,代码行数:29,代码来源:ctlAddServices.ascx.cs

示例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();
 }
开发者ID:toddmo,项目名称:male.services,代码行数:13,代码来源:EntityFrameworkTests.cs

示例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();
                    }
                }
            }
        }
开发者ID:zaheerahmad,项目名称:Admin,代码行数:43,代码来源:ctlAddServices.ascx.cs

示例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);
        }
开发者ID:zaheerahmad,项目名称:Admin,代码行数:16,代码来源:ServiceController.cs

示例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);
        }
开发者ID:zaheerahmad,项目名称:Admin,代码行数:12,代码来源:ServiceController.cs

示例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;
 }
开发者ID:zaheerahmad,项目名称:Admin,代码行数:31,代码来源:ctlAddServices.ascx.cs


注:本文中的Service.Save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。