本文整理汇总了C#中Cookbook.CookDBDataContext.SubmitChanges方法的典型用法代码示例。如果您正苦于以下问题:C# CookDBDataContext.SubmitChanges方法的具体用法?C# CookDBDataContext.SubmitChanges怎么用?C# CookDBDataContext.SubmitChanges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cookbook.CookDBDataContext
的用法示例。
在下文中一共展示了CookDBDataContext.SubmitChanges方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessRequest
public override PagedData ProcessRequest(HttpContext context, CookDBDataContext db)
{
System.IO.StreamReader reader = new System.IO.StreamReader(context.Request.InputStream, context.Request.ContentEncoding);
var jsonSerializer = new JsonSerializer();
JObject blob = (JObject)jsonSerializer.Deserialize(new JsonTextReader(new StringReader(reader.ReadToEnd())));
string filter = context.Request.Params.Get("project_id");
string username = context.Request.Params.Get("user_name");
string permission = context.Request.Params.Get("permission");
if (!isNull(filter))
{
//AH: the hardware/software and systems reqs are now stored in their respective GET handlers
if (blob["systemsCommentsArea"] != null)
{
var oldComments = db.SWDSchedules.Single(a => a.project_id.Equals(int.Parse(filter)));
oldComments.systems_comments = (string)blob["systemsCommentsArea"];
db.SubmitChanges();
}
else
{
var oldComments = db.SWDSchedules.Single(a => a.project_id.Equals(int.Parse(filter)));
oldComments.systems_comments = "";
db.SubmitChanges();
}
}
return new PagedData("success! " + comment2 + comment);
}
示例2: ProcessRequest
public override PagedData ProcessRequest(HttpContext context, CookDBDataContext db)
{
System.IO.StreamReader reader = new System.IO.StreamReader(context.Request.InputStream, context.Request.ContentEncoding);
var jsonSerializer = new JsonSerializer();
JObject blob = (JObject)jsonSerializer.Deserialize(new JsonTextReader(new StringReader(reader.ReadToEnd())));
string filter = context.Request.Params.Get("project_id");
string username = context.Request.Params.Get("user_name");
string permission = context.Request.Params.Get("permission");
if (!isNull(filter))
{
/*
* Begin: Comments Area
*/
if (blob["tlsCommentsArea"] != null)
{
var oldComments = db.SWDSchedules.Single(a => a.project_id.Equals(int.Parse(filter)));
oldComments.tls_comments = (string)blob["tlsCommentsArea"];
db.SubmitChanges();
}
else
{
var oldComments = db.SWDSchedules.Single(a => a.project_id.Equals(int.Parse(filter)));
oldComments.tls_comments = (string)blob["tlsCommentsArea"];
db.SubmitChanges();
}
}
return new PagedData("success! ");
}
示例3: ProcessRequest
public override PagedData ProcessRequest(HttpContext context, CookDBDataContext db)
{
string project_id = context.Request.Params.Get("project_id");
if (!isNull(project_id))
{
string username = context.Request.Params.Get("user_name");
string permission = context.Request.Params.Get("permission");
SystemsAssessment record = new SystemsAssessment();
record.project_id = int.Parse(project_id);
record.Contact = db.Contacts.Single(a => a.name.Equals("Test Guy"));
record.description = "";
record.billed_hours = "";
record.booked_hours = "";
record.target_start = "";
record.target_complete = "";
record.scheduled_start = "";
record.scheduled_complete = "";
record.actual_complete = "";
db.SystemsAssessments.InsertOnSubmit(record);
db.SubmitChanges();
doChangeLogging(username, permission, project_id, db);
return new PagedData(new { record.systems_req_id, record.Contact.name });
}
return new PagedData("AddSystemsAssessment.ashx requires a project_id");
}
示例4: doChangeLogging
public void doChangeLogging(string type, string username, string permission, string project_id, CookDBDataContext db, SystemsAssessment record)
{
//if (permission != "PM")
//{
ChangeLog newLog = new ChangeLog();
newLog.project_id = Convert.ToInt32(project_id);
newLog.time = DateTime.Now.ToShortTimeString();
newLog.date = DateTime.Now.ToShortDateString();
newLog.tab = "Systems";
newLog.user_name = username;
string description = (record.description == null || record.description == "") ? "(empty)" : record.description;
string billed = (record.billed_hours == null || record.billed_hours == "") ? "(empty)" : record.billed_hours;
string booked = (record.booked_hours == null || record.booked_hours == "") ? "(empty)" : record.booked_hours;
string targetstart = (record.target_start == null || record.target_start == "") ? "(empty)" : record.target_start;
string targetcomplete = (record.target_complete == null || record.target_complete == "") ? "(empty)" : record.target_complete;
string scheduledstart = (record.scheduled_start == null || record.scheduled_start == "") ? "(empty)" : record.scheduled_start;
string scheduledcomplete = (record.scheduled_complete == null || record.scheduled_complete == "") ? "(empty)" : record.scheduled_complete;
string actualcomplete = (record.actual_complete == null || record.actual_complete == "") ? "(empty)" : record.actual_complete;
newLog.description = "Existing record deleted from Systems Engineering Assessment: Name: " + record.Contact.name +
"; Description: " + description + "; Billed Hours: " + billed + "; Booked Hours: " + booked + "; Target Start: "+ targetstart +
"; Target Complete: " + targetcomplete + "; Scheduled Start: " + scheduledstart + "; Scheduled Complete: " + scheduledcomplete + "; Actual Complete: " +
actualcomplete + ".";
db.ChangeLogs.InsertOnSubmit(newLog);
db.SubmitChanges();
//}
}
开发者ID:nismonster,项目名称:ExtJS4.0-Infrastructure-Application,代码行数:26,代码来源:RemoveSystemsAssessment.ashx.cs
示例5: ProcessRequest
public override PagedData ProcessRequest(HttpContext context, CookDBDataContext db)
{
IQueryable<ProjectInformation> q = db.ProjectInformations;
string filter = context.Request.Params.Get("project_id");
if (!isNull(filter))
{
string user_name = context.Request.Params.Get("user_name");
if (!isNull(user_name))
{
ProjectInformation pi = db.ProjectInformations.Single(a => a.project_id.Equals(int.Parse(filter)));
if (((bool)pi.locked) && pi.user_name.Equals(user_name, StringComparison.OrdinalIgnoreCase))
{
//unlock it
pi.locked = false;
pi.user_name = null;
db.SubmitChanges();
return new PagedData("Project successfully released");
}
return new PagedData("Project is currently unlocked. Nothing to release");
}
return new PagedData("ReleaseProjectLock.ashx requires a user_name");
}
return new PagedData("ReleaseProjectLock.ashx requires a project_id");
}
示例6: ProcessRequest
public override PagedData ProcessRequest(HttpContext context, CookDBDataContext db)
{
if (context.Request.Params.Count == 0)
return new PagedData("Can't call UpdateProject.ashx without parameters");
bool doSubmit = false;
for (int i = 0; i < context.Request.Params.Count; i++)
{
if (context.Request.Params.GetKey(i) == "application")
{
Application app = new Application();
app.base_name = context.Request.Params.Get(i);
app.name = app.base_name + ".APP";
db.Applications.InsertOnSubmit(app);
doSubmit = true;
}
}
if (doSubmit)
db.SubmitChanges();
return new PagedData("");
}
示例7: ProcessRequest
public override PagedData ProcessRequest(HttpContext context, CookDBDataContext db)
{
IQueryable<ProjectInformation> q = db.ProjectInformations;
System.IO.StreamReader reader = new System.IO.StreamReader(context.Request.InputStream, context.Request.ContentEncoding);
var jsonSerializer = new JsonSerializer();
JObject blob = (JObject)jsonSerializer.Deserialize(new JsonTextReader(new StringReader(reader.ReadToEnd())));
string filter = context.Request.Params.Get("project_id");
if (!isNull(filter))
{
if (db.PromptDetails.Count(a => a.project_id.Equals(int.Parse(filter)) && a.language.Equals((string)blob["viewPromptsLangOneLanguage"])) > 0)
{
PromptDetail record = db.PromptDetails.Single(a => a.project_id.Equals(int.Parse(filter)) && a.language.Equals((string)blob["viewPromptsLangOneLanguage"]));
db.PromptDetails.DeleteOnSubmit(record);
db.SubmitChanges();
return new PagedData("project_id(" + filter + ") and language(" + (string)blob["viewPromptsLangOneLanguage"] + ") deleted");
}
return new PagedData("project_id(" + filter + ") and language(" + (string)blob["viewPromptsLangOneLanguage"] + ") don't exist");
}
return new PagedData("DeletePromptDetails.ashx requires a project_id");
}
示例8: ProcessRequest
public override PagedData ProcessRequest(HttpContext context, CookDBDataContext db)
{
if (context.Request.Params.Count == 0)
return new PagedData("Can't call AddGrammar.ashx without parameters");
if (context.Request.Params.Get("name") == null)
return new PagedData("Name is null");
Grammar gram = new Grammar();
gram.name = context.Request.Params.Get("name");
gram.filename = "n/a";
/*if (context.Request.Params.Get("filename") != null)
gram.name = context.Request.Params.Get("filename");*/
db.Grammars.InsertOnSubmit(gram);
db.SubmitChanges();
return new PagedData("");
}
示例9: ProcessRequest
public override PagedData ProcessRequest(HttpContext context, CookDBDataContext db)
{
string project_id = context.Request.Params.Get("project_id");
if (!isNull(project_id))
{
string type = context.Request.Params.Get("install_type");
if (!isNull(type))
{
StagingFolder record = new StagingFolder();
record.folder = "";
record.notes = "";
record.project_id = int.Parse(project_id);
//record.is_buffet = type.Equals(1) ? true : false;
record.type = type;
db.StagingFolders.InsertOnSubmit(record);
db.SubmitChanges();
return new PagedData(new { record.staging_folder_id });
}
return new PagedData("AddStagingFolder.ashx requires a type");
}
return new PagedData("AddStagingFolder.ashx requires a project_id");
}
示例10: ProcessRequest
public override PagedData ProcessRequest(HttpContext context, CookDBDataContext db)
{
string project_id = context.Request.Params.Get("project_id");
if (!isNull(project_id))
{
string assessment_id = context.Request.Params.Get("assessment_id");
string username = context.Request.Params.Get("user_name");
string permission = context.Request.Params.Get("permission");
if (!isNull(assessment_id))
{
SWDAssessment record = db.SWDAssessments.Single(a => a.swd_assessment_id.Equals(assessment_id));
doChangeLogging(assessment_id, username, permission, project_id, db, record);
db.SWDAssessments.DeleteOnSubmit(record);
db.SubmitChanges();
return new PagedData("TLSAssessment deleted");
}
return new PagedData("RemoveTLSAssessment.ashx requires an assessment_id");
}
return new PagedData("RemoveTLSAssessment.ashx requires a project_id");
}
示例11: ProcessRequest
public override PagedData ProcessRequest(HttpContext context, CookDBDataContext db)
{
string project_id = context.Request.Params.Get("project_id");
if (!isNull(project_id))
{
string type = context.Request.Params.Get("type");
string username = context.Request.Params.Get("user_name");
string permission = context.Request.Params.Get("permission");
if (!isNull(type))
{
SWDAssessment record = new SWDAssessment();
record.project_id = int.Parse(project_id);
record.assessment_type_id = db.AssessmentTypes.Single(a => a.type.Equals(type)).assessment_type_id;
record.contact_id = db.Contacts.Single(a => a.name.Equals("Test Guy")).contact_id;
record.action = "";
record.booked_hours = "0";
record.hours = "0";
db.SWDAssessments.InsertOnSubmit(record);
db.SubmitChanges();
doChangeLogging(type, username, permission, project_id, db);
return new PagedData(new { record.swd_assessment_id, record.Contact.name });
}
return new PagedData("AddSWDAssessment.ashx requires a type");
}
return new PagedData("AddSWDAssessment.ashx requires a project_id");
}
示例12: ProcessRequest
public override PagedData ProcessRequest(HttpContext context, CookDBDataContext db)
{
IQueryable<PromptWorksheet> q = db.PromptWorksheets;
System.IO.StreamReader reader = new System.IO.StreamReader(context.Request.InputStream, context.Request.ContentEncoding);
var jsonSerializer = new JsonSerializer();
JObject blob = (JObject)jsonSerializer.Deserialize(new JsonTextReader(new StringReader(reader.ReadToEnd())));
string filter = context.Request.Params.Get("project_id");
if (!isNull(filter))
{
PromptWorksheet record = db.PromptWorksheets.Single(a => a.project_id.Equals(int.Parse(filter)));
if (blob["promptsPromptWorksheet"] != null) { record.prompt_worksheet = (String)blob["promptsPromptWorksheet"]; }
if (blob["promptsSummary"] != null) { record.prompt_summary = (String)blob["promptsSummary"]; }
if (blob["promptsPONum"] != null) { record.po_num = (String)blob["promptsPONum"]; }
if (blob["viewPromptsGreatVoiceCDFee"] != null) { record.great_voice_cd_fee = (String)blob["viewPromptsGreatVoiceCDFee"]; }
if (blob["viewPromptsGreatVoiceTotalFee"] != null) { record.great_voice_total_fee = (String)blob["viewPromptsGreatVoiceTotalFee"]; }
if (blob["viewPromptsGMVoicesTotalFee"] != null) { record.gm_voices_total_fee = (String)blob["viewPromptsGMVoicesTotalFee"]; }
db.SubmitChanges();
return new PagedData("Prompts worksheet and summary saved");
}
return new PagedData("UpdatePromptsMisc.ashx requires a project_id");
}
示例13: ProcessRequest
public override PagedData ProcessRequest(HttpContext context, CookDBDataContext db)
{
string project_id = context.Request.Params.Get("project_id");
if (!isNull(project_id))
{
string username = context.Request.Params.Get("user_name");
string permission = context.Request.Params.Get("permission");
HardwareRequirement record = new HardwareRequirement();
record.project_id = int.Parse(project_id);
record.description = "";
record.cost_per_item = "";
record.total_item_cost = "";
record.target_order_date = "";
record.target_delivery = "";
record.actual_order_date = "";
record.actual_delivery_date = "";
db.HardwareRequirements.InsertOnSubmit(record);
db.SubmitChanges();
doChangeLogging(username, permission, project_id, db);
return new PagedData(new { record.hardware_req_id });
}
return new PagedData("AddSystemsAssessment.ashx requires a project_id");
}
开发者ID:nismonster,项目名称:ExtJS4.0-Infrastructure-Application,代码行数:27,代码来源:AddHardwareAssessment.ashx.cs
示例14: ProcessRequest
public override PagedData ProcessRequest(HttpContext context, CookDBDataContext db)
{
System.IO.StreamReader reader = new System.IO.StreamReader(context.Request.InputStream, context.Request.ContentEncoding);
var jsonSerializer = new JsonSerializer();
JObject blob = (JObject)jsonSerializer.Deserialize(new JsonTextReader(new StringReader(reader.ReadToEnd())));
string filter = context.Request.Params.Get("project_id");
string username = context.Request.Params.Get("user_name");
if (!isNull(filter))
{
/*
* Begin: QA Total Hours added 2-1-13
*/
if (blob["submittedTotalQAHours"] != null)
{
var currentRec = db.SWDSchedules.Single(a => a.project_id.Equals(int.Parse(filter)));
currentRec.total_qa_hours = (string)blob["submittedTotalQAHours"];
db.SubmitChanges();
}
/*
* Begin: Comments Area
*/
if (blob["qaCommentsArea"] != null)
{
var oldComments = db.SWDSchedules.Single(a => a.project_id.Equals(int.Parse(filter)));
oldComments.qa_comments = (string)blob["qaCommentsArea"];
db.SubmitChanges();
}
return new PagedData("UpdateQAPage successfully updated|"+comment);
}
else
{
return new PagedData("UpdateQAPage expects a project id");
}
}
示例15: ProcessRequest
public override PagedData ProcessRequest(HttpContext context, CookDBDataContext db)
{
if (context.Request.Params.Count == 0)
return new PagedData("Can't call AddContact.ashx without parameters");
if (context.Request.Params.Get("name") == null)
return new PagedData("Name is null");
if (context.Request.Params.Get("company_name") == null)
return new PagedData("Company is null");
if (context.Request.Params.Get("email") == null)
return new PagedData("Email is null");
Contact contact;
bool insert = true;
if (!isNull(context.Request.Params.Get("contact_id")))
{
contact = db.Contacts.Single(a => a.contact_id.Equals(context.Request.Params.Get("contact_id")));
insert = false;
}
else
{
contact = new Contact();
}
Company company = db.Companies.Single(a => a.company_name.Equals(context.Request.Params.Get("company_name")));
ContactType type = null;
string strType = context.Request.Params.Get("type");
if (strType != "")
{
type = db.ContactTypes.Single(a => a.type.Equals(strType));
contact.ContactType = type;
}
else
{
contact.ContactType = null;
contact.contact_type_id = null;
}
contact.name = context.Request.Params.Get("name");
contact.email1 = context.Request.Params.Get("email");
contact.Company = company;
contact.title = context.Request.Params.Get("title");
contact.phone = context.Request.Params.Get("phone");
if (insert)
{
db.Contacts.InsertOnSubmit(contact);
}
db.SubmitChanges();
return new PagedData("");
}