本文整理汇总了C#中Cookbook.CookDBDataContext类的典型用法代码示例。如果您正苦于以下问题:C# CookDBDataContext类的具体用法?C# CookDBDataContext怎么用?C# CookDBDataContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CookDBDataContext类属于Cookbook命名空间,在下文中一共展示了CookDBDataContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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");
}
示例2: 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("");
}
示例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: 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");
}
示例5: 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("");
}
示例6: 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! ");
}
示例7: 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
示例8: 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");
}
示例9: 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
示例10: 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");
}
示例11: ProcessRequest
public override PagedData ProcessRequest(HttpContext context, CookDBDataContext db)
{
string filter = context.Request.Params.Get("project_id");
IQueryable<ChangeLog> q = db.ChangeLogs.Where(a => a.project_id.Equals(int.Parse(filter)));
return new PagedData(q.Select(a => new {a.changelog_id, a.user_name, a.date, a.description, a.time, a.tab}));
}
示例12: 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");
}
示例13: 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);
}
示例14: 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");
}
示例15: 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();
String blob = (string)jsonSerializer.Deserialize(new JsonTextReader(new StringReader(reader.ReadToEnd())));
string filter = context.Request.Params.Get("project_id");
if (!isNull(filter))
{
var projsArray = blob.Split(',');
var currentProjNum = "";
List<string> projsList = new List<string>();
string returnString = "";
foreach(string currentIteration in projsArray)
{
currentProjNum = currentIteration.Trim();
if (currentProjNum!= "" && db.ProjectInformations.Count(a => a.project_number.Equals(currentProjNum)) > 0)
{
var currentProj = db.ProjectInformations.First(a => a.project_number.Equals(currentProjNum));
var currentProjUATInfo = db.UatProdInstalls.First(a => a.project_id.Equals(currentProj.project_id));
projsList.Add(currentProj.project_number + ";" + currentProjUATInfo.uat_usan_ccr + ";" + currentProjUATInfo.uat_ccr + ";" + currentProjUATInfo.uat_maintenance_start);
}
}
for (int i = 0; i < projsList.Count; i++)
{
returnString += projsList[i];
if (i != projsList.Count - 1)
{
returnString += "|";
}
}
return new PagedData(returnString);
}
return new PagedData("success! " + comment);
}
开发者ID:nismonster,项目名称:ExtJS4.0-Infrastructure-Application,代码行数:34,代码来源:UpdateBuffetLinkedProjects.ashx.cs