Example #1
0
        protected int AddServiceObj(Services serviceObj)
        {
            serviceObj.CreatedDate = DateTime.Now;
            serviceObj.LastModifiedDate = DateTime.Now;
            serviceObj.IsDeleted = false;
            int counts = 0;
            try
            {
                CDProDatabaseEntities MWDB = new CDProDatabaseEntities();
                MWDB.Services.AddObject(serviceObj);
                counts = MWDB.SaveChanges();
                if (counts > 0)
                {
                    string userHostAddress = HttpContext.Current.Request.UserHostAddress;

                    return 0;
                }
            }
            catch (Exception ex)
            {
                string userHostAddress = HttpContext.Current.Request.UserHostAddress;

                return -1;
            }
            return 1;
        }
Example #2
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            const long MaxTotalBytes = 548576; // 500kbs
            long totalBytes;
            if (AsyncUpload1.UploadedFiles.Count > 0)
            {
                UploadedFile file = AsyncUpload1.UploadedFiles[0];
                totalBytes = file.InputStream.Length;

                if (totalBytes < MaxTotalBytes)
                {
                    byte[] fileData = new byte[totalBytes];
                    file.InputStream.Read(fileData, 0, (int)totalBytes);
                    Services serviceObj = new Services();

                    serviceObj.ServiceID = Guid.NewGuid();
                    serviceObj.ServiceName = rtxtMerchantName.Text.Trim();
                    serviceObj.Description = rtxtRegCode.Text.Trim();
                    serviceObj.Logo = fileData;

                    this.AddServiceObj(serviceObj);
                }
                else
                {
                    //大于1MB

                    return;
                }
            }
            else
            {
                //大于1MB

                return;
            }
        }
Example #3
0
 /// <summary>
 /// 用于向 Services EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToServices(Services services)
 {
     base.AddObject("Services", services);
 }
Example #4
0
 /// <summary>
 /// 创建新的 Services 对象。
 /// </summary>
 /// <param name="serviceID">ServiceID 属性的初始值。</param>
 /// <param name="isDeleted">IsDeleted 属性的初始值。</param>
 /// <param name="createdByID">CreatedByID 属性的初始值。</param>
 /// <param name="lastModifiedByID">LastModifiedByID 属性的初始值。</param>
 /// <param name="createdDate">CreatedDate 属性的初始值。</param>
 /// <param name="lastModifiedDate">LastModifiedDate 属性的初始值。</param>
 public static Services CreateServices(global::System.Guid serviceID, global::System.Boolean isDeleted, global::System.Guid createdByID, global::System.Guid lastModifiedByID, global::System.DateTime createdDate, global::System.DateTime lastModifiedDate)
 {
     Services services = new Services();
     services.ServiceID = serviceID;
     services.IsDeleted = isDeleted;
     services.CreatedByID = createdByID;
     services.LastModifiedByID = lastModifiedByID;
     services.CreatedDate = createdDate;
     services.LastModifiedDate = lastModifiedDate;
     return services;
 }