本文整理汇总了C#中s26web.Models.s26webDataContext.SubmitChanges方法的典型用法代码示例。如果您正苦于以下问题:C# s26webDataContext.SubmitChanges方法的具体用法?C# s26webDataContext.SubmitChanges怎么用?C# s26webDataContext.SubmitChanges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类s26web.Models.s26webDataContext
的用法示例。
在下文中一共展示了s26webDataContext.SubmitChanges方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Sale_SMS
public static MobileModel Sale_SMS(int Id, String mobile, int collected, DateTime ExcTime, string detail = null)
{
s26webDataContext db = new s26webDataContext();
IntroductionModel intro = new IntroductionModel();
var msg = intro.Get_One(Id);
var data = db.Volunteers.FirstOrDefault(f => f.Mobile == mobile);
/////////////////////
msg.Content = msg.Content.Replace("<--end_time-->", ExcTime.AddHours(8).ToString("yyyy/MM/dd HH:mm"));
msg.Content = msg.Content.Replace("<--collected-->", collected.ToString());
/////////////////////
var mm = SMS_Send(msg, mobile);
SMS sms = new SMS
{
sms_id = mm.error_code,
content = mm.error_msg,
CreateTime = DateTime.UtcNow,
mobile = mobile,
detail = detail
};
db.SMS.InsertOnSubmit(sms);
db.SubmitChanges();
db.Connection.Close();
//return the response
return mm;
}
示例2: Update
public void Update(string[] UserName, string[] FBUrl)
{
s26webDataContext db = new s26webDataContext();
for (int i = 0; i < UserName.Count(); i++)
{
var data = db.eCRM.FirstOrDefault(f => f.Id == (i + 1));
data.UserName = UserName[i];
data.FBUrl = FBUrl[i];
}
db.SubmitChanges();
db.Connection.Close();
}
示例3: Set
public int Set(IntroductionModelShow item)
{
try
{
s26webDataContext db = new s26webDataContext();
if (item.Id > 0)
{
var data = db.Introduction.FirstOrDefault(f => f.Id == item.Id);
if (data != null)
{
data.Title = item.Title;
data.Content = item.Content;
data.UpdateTime = DateTime.UtcNow;
db.SubmitChanges();
db.Connection.Close();
return item.Id;
}
}
db.Connection.Close();
return -1;
}
catch { return -1; }
}
示例4: Delete
/// <summary>
/// Delete index[id] record of UserProfile
/// </summary>
/// <param name="id"></param>
private void Delete(int[] id)
{
if (id.Any())
{
s26webDataContext db = new s26webDataContext();
var data = db.UserProfile.Where(w => id.Contains(w.Id) && w.Id != 0);
if (data.Any())
{
db.UserProfile.DeleteAllOnSubmit(data);
db.SubmitChanges();
}
db.Connection.Close();
}
}
示例5: Update_FunctionCompetence
/// <summary>
/// Update [all-col] of CompetenceTable. If success finally, return [true], otherwise, return [false]
/// </summary>
/// <param name="FunctionChange"></param>
/// <param name="Id"></param>
/// <returns></returns>
private bool Update_FunctionCompetence(bool[] FunctionChange, int Id)
{
try
{
s26webDataContext db = new s26webDataContext();
var query = db.CompetenceTable.Where(w => w.UserLevelId == Id);
List<CompetenceTable> ct = new List<CompetenceTable>();
for (int i = 0; i < FunctionChange.Count(); i++)
{
var temp = db.CompetenceTable.FirstOrDefault(f => f.UserLevelId == Id && f.FunctionId == (i + 1));
if (temp == null)
{
ct.Add(new CompetenceTable
{
UserLevelId = Id,
FunctionId = (i + 1),
Enable = FunctionChange[i]
});
}
else
{
temp.Enable = FunctionChange[i];
}
}
db.CompetenceTable.InsertAllOnSubmit(ct);
db.SubmitChanges();
db.Connection.Close();
return true;
}
catch
{
return false;
}
}
示例6: OrdersStatesUpdate
/// <summary>
/// OrdersStates Update Function
/// </summary>
/// <param name="Osid"></param>
/// <param name="changeState"></param>
/// <param name="userId"></param>
private void OrdersStatesUpdate(string Osid, int changeState, int userId)
{
s26webDataContext db = new s26webDataContext();
var data = db.Orders.FirstOrDefault(w => w.Osid == Osid);
data.OrdersStates = changeState;
data.UpdateUserId = userId;
data.UpdateTime = DateTime.Now.AddHours(-8);
db.SubmitChanges();
}
示例7: Update
public int Update(OnlineModelShow item)
{
try
{
s26webDataContext db = new s26webDataContext();
var data = db.Online.FirstOrDefault(f => f.Id == item.Id);
if (data != null)
{
data.Type = item.Type;
data.Name = item.Name;
data.Content = item.Content;
if (item.Banner_PC != null)
{
data.Banner_PC = item.Banner_PC;
}
if (item.Banner_Mobile != null)
{
data.Banner_Mobile = item.Banner_Mobile;
}
data.Url = item.Url;
data.Display = item.Display;
data.StartTime = item.StartTime.AddHours(-8);
if (item.EndTime != DateTime.Parse("0001/1/1 上午 12:00:00"))
{
data.EndTime = item.EndTime.AddHours(-8);
}
else
{
data.EndTime = null;
}
data.UpdateTime = DateTime.UtcNow;
db.SubmitChanges();
db.Connection.Close();
return data.Id;
}
db.Connection.Close();
return -1;
}
catch { return -1; }
}
示例8: Update
public int Update(ProductModelShow item, int LastUserId, HttpPostedFileBase file, string vid, HttpServerUtilityBase Server, HttpPostedFileBase ContentPic)
{
try
{
s26webDataContext db = new s26webDataContext();
var data = db.Product.FirstOrDefault(f => f.Id == item.Id);
if (data != null)
{
data.Content = item.Content;
if (file != null)
if (file.ContentLength > 0 && file.ContentType.ToLower() == "image/jpeg" || file.ContentType == "image/png")
data.PictureLink = Method.Upload_File(file, vid, Server);
else
data.PictureLink = "";
if (ContentPic != null)
if (ContentPic.ContentLength > 0 && ContentPic.ContentType.ToLower() == "image/jpeg" || ContentPic.ContentType == "image/png")
data.ContentPic = Method.Upload_File(ContentPic, vid, Server);
else
data.ContentPic = "";
data.Price = item.Price;
data.Point = item.Point;
data.Limit = item.Limit;
data.Display = item.Display;
data.UpdateTime = DateTime.UtcNow;
data.LastUserId = LastUserId;
data.Link = item.Link;
data.Memo = item.Memo;
db.SubmitChanges();
db.Connection.Close();
return data.Id;
}
db.Connection.Close();
return -1;
}
catch { return -1; }
}
示例9: SaveImportData
public void SaveImportData(IEnumerable<ImportClass> importSalesCodes, int SalesPromotionId = 0, string fileName = "")
{
s26webDataContext db = new s26webDataContext();
try
{
foreach (var item in importSalesCodes)
{
SalesCode new_item = new SalesCode
{
SalesPromotionId = SalesPromotionId,
SalesPromotionPoint = Get_SalesPromotionPoint(SalesPromotionId),
SalesPromotionDeadline = Get_SalesPromotionDeadline(SalesPromotionId),
Code = item.Code,
ExchangeStatus = false,
VolunteersId = 0,
CreateTime = DateTime.UtcNow
};
db.SalesCode.InsertOnSubmit(new_item);
db.SubmitChanges();
db.Connection.Close();
}
if (File.Exists(fileName))
{
File.Delete(fileName);
}
}
catch
{
throw;
}
}
示例10: ScoreUpdate
/// <summary>
/// 資料筆數更新,提供多筆同時更新的功能
/// </summary>
/// <param name="EgidSource"></param>
/// <param name="StateSoucre"></param>
/// <param name="Updater"></param>
public void ScoreUpdate(string EgidSource, string StateSoucre, int Updater)
{
s26webDataContext db = new s26webDataContext();
string[] TempId = EgidSource.Split(',').ToArray();
string[] TempState = StateSoucre.Split(',').ToArray();
for (int i = 0; i < TempId.Length; i++)
{
ExchangeGift compareTemp = db.ExchangeGift.FirstOrDefault(w => w.Egid == TempId[i]);
if (compareTemp.Status != int.Parse(TempState[i]))
{
compareTemp.Status = int.Parse(TempState[i]);
compareTemp.UpdateUserId = Updater;
compareTemp.CreateTime = DateTime.Now.AddHours(-8);
db.SubmitChanges();
}
}
db.Connection.Close();
}
示例11: Insert
/// <summary>
/// Insert a new record to [UserProfile] database.If success return [Id],otherwise, return -1
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public int Insert(MemberShow item)
{
s26webDataContext db = new s26webDataContext();
if (db.UserProfile.FirstOrDefault(f => f.Account_Phone.ToLower() == item.Account_Phone.ToLower()) == null)
{
UserProfile new_item = new UserProfile
{
Account_Phone = item.Account_Phone,
Password = Get_HashPassword(item.Password),
Name = item.Name,
Level = item.Level,
Enable = item.Enable,
CreateTime = DateTime.UtcNow
};
db.UserProfile.InsertOnSubmit(new_item);
db.SubmitChanges();
db.Connection.Close();
return new_item.Id;
}
else
{
db.Connection.Close();
return -1;
}
}
示例12: Insert
public int Insert(DeliveryModel.OrdersModel item)
{
s26webDataContext db = new s26webDataContext();
try
{
Orders orders = new Orders
{
VolunteersId = item.VolunteersId,
Osid = DateTime.UtcNow.AddHours(8).ToString("yyyyMMddHHmm"),
ProductId = item.ProductId,
Order_Quantity = item.Order_Quantity,
TotalPrice = item.TotalPrice,
Name = item.Name,
Mobile = item.Mobile,
CityId = item.CityId,
AreaId = item.AreaId,
Address = item.Address,
SharePoint= true,
Remarks = item.Remarks,
OrdersStates = 22,
OrdersTime = DateTime.UtcNow,
ReciveTimeChoice = 15,
OrdersFrom = 0,
};
db.Orders.InsertOnSubmit(orders);
db.SubmitChanges();
Invoice invoice = new Invoice
{
OrdersId = db.Orders.OrderByDescending(o => o.Id).FirstOrDefault(f => f.Id != null).Id,
InvoiceCategory = item.InvoiceCategory
};
if (item.InvoiceCategory == db.Category.FirstOrDefault(w => w.Fun_Id == 5 && w.Memo.Equals("Invoice")).Id)
{
invoice.InvoiceName = item.InvoiceName;
invoice.InvoiceNo = item.InvoiceNo;
}
db.Invoice.InsertOnSubmit(invoice);
db.SubmitChanges();
db.Connection.Close();
return orders.Id;
}
catch
{
return -1;
}
}
示例13: Update_BabyBirthday
public int Update_BabyBirthday(string account, DateTime New_BabyBirthday)
{
try
{
s26webDataContext db = new s26webDataContext();
var data = db.Volunteers.FirstOrDefault(w => w.Id == int.Parse(account));
if (data != null)
{
data.BabyBirthday = New_BabyBirthday;
data.UpdateTime = DateTime.UtcNow;
db.SubmitChanges();
db.Connection.Close();
return data.Id;
}
db.Connection.Close();
return -1;
}
catch { return -1; }
}
示例14: Delete
public void Delete(int[] id)
{
if (id != null)
{
if (id.Any())
{
s26webDataContext db = new s26webDataContext();
var data = db.LoginRecord.Where(w => id.Contains(w.Id));
if (data.Any())
{
db.LoginRecord.DeleteAllOnSubmit(data);
db.SubmitChanges();
}
db.Connection.Close();
}
}
}
示例15: Login_Record
public static int Login_Record(string account, HttpRequestBase Request, bool login)
{
try
{
s26webDataContext db = new s26webDataContext();
LoginRecord item = Convert(account, Request, login);
db.LoginRecord.InsertOnSubmit(item);
db.SubmitChanges();
db.Connection.Close();
return item.Id;
}
catch { return -1; }
}