public int Insert(VolunteersShow item, HttpPostedFileBase file, string vid, HttpServerUtilityBase Server) { var photos = ""; s26webDataContext db = new s26webDataContext(); if (file != null) if (file.ContentLength > 0 && file.ContentType.ToLower() == "image/jpeg" || file.ContentType == "image/png") photos = Method.Upload_File(file, vid, Server); else photos = ""; if (item.LastMemberId > 0) item.AdminUpdateTime = DateTime.Now; try { Volunteers new_item = new Volunteers { Mobile = item.Mobile, Password = Get_HashPassword(item.Password), Name = item.Name, BabyBirthday = item.BabyBirthday.Value, NowBrand = item.NowBrand, BrandName = item.BrandName, Email = item.Email, CityId = item.CityId, AreaId = item.AreaId, Address = item.Address, GiftMobile = item.GiftMobile, CityId2 = item.CityId2, AreaId2 = item.AreaId2, Address2 = item.Address2, Status = item.Status, SendCount = item.SendCount, Photos = photos, SerialNo = item.SerialNo, MemberNumber = item.NowBrand, FBConnect = item.FBConnect, FBFriend = item.FBFriend, Memo = item.Memo, AdminUpdateTime = item.AdminUpdateTime, CreateTime = DateTime.UtcNow, UpdateTime = DateTime.UtcNow, Point = 0 }; db.Volunteers.InsertOnSubmit(new_item); db.SubmitChanges(); db.Connection.Close(); return new_item.Id; } catch { return -1; } }
public List<eCRM> Get_eCRM() { s26webDataContext db = new s26webDataContext(); VolunteersShow data = new VolunteersShow(); data.eCRM_list = db.eCRM.ToList(); db.Connection.Close(); return data.eCRM_list; }