本文整理汇总了C#中Cookbook.CookDBDataContext类的典型用法代码示例。如果您正苦于以下问题:C# CookDBDataContext类的具体用法?C# CookDBDataContext怎么用?C# CookDBDataContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CookDBDataContext类属于Cookbook命名空间,在下文中一共展示了CookDBDataContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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");
}
开发者ID:nismonster,项目名称:ExtJS4.0-Infrastructure-Application,代码行数:30,代码来源:ReleaseProjectLock.ashx.cs
示例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("");
}
开发者ID:nismonster,项目名称:ExtJS4.0-Infrastructure-Application,代码行数:25,代码来源:AddGrammar.ashx.cs
示例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");
}
开发者ID:nismonster,项目名称:ExtJS4.0-Infrastructure-Application,代码行数:28,代码来源:AddSystemsAssessment.ashx.cs
示例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");
}
开发者ID:nismonster,项目名称:ExtJS4.0-Infrastructure-Application,代码行数:26,代码来源:RemoveTLSAssessment.ashx.cs
示例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("");
}
开发者ID:nismonster,项目名称:ExtJS4.0-Infrastructure-Application,代码行数:25,代码来源:UpdateProject.ashx.cs
示例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! ");
}
开发者ID:nismonster,项目名称:ExtJS4.0-Infrastructure-Application,代码行数:31,代码来源:UpdateTLSPage.ashx.cs
示例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");
}
开发者ID:nismonster,项目名称:ExtJS4.0-Infrastructure-Application,代码行数:31,代码来源:AddTLSAssessment.ashx.cs
示例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");
}
开发者ID:nismonster,项目名称:ExtJS4.0-Infrastructure-Application,代码行数:26,代码来源:DeletePromptDetails.ashx.cs
示例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}));
}
开发者ID:nismonster,项目名称:ExtJS4.0-Infrastructure-Application,代码行数:7,代码来源:GetChangeLogs.ashx.cs
示例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");
}
开发者ID:nismonster,项目名称:ExtJS4.0-Infrastructure-Application,代码行数:25,代码来源:AddStagingFolder.ashx.cs
示例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);
}
开发者ID:nismonster,项目名称:ExtJS4.0-Infrastructure-Application,代码行数:29,代码来源:UpdateSystemsPage.ashx.cs
示例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");
}
开发者ID:nismonster,项目名称:ExtJS4.0-Infrastructure-Application,代码行数:27,代码来源:UpdatePromptsMisc.ashx.cs
示例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
示例16: ProcessRequest
public override PagedData ProcessRequest(HttpContext context, CookDBDataContext db)
{
IQueryable<SWDAssessment> q = db.SWDAssessments;
string username = context.Request.Params.Get("user_name");
string filter = context.Request.Params.Get("project_id");
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 readOnly = context.Request.Params.Get("read_only");
if (readOnly == "true" && context.Request.RequestType != "GET")
{
return new PagedData("Read Only");
}
switch (context.Request.RequestType)
{
case "GET":
{
if (!isNull(filter))
{
List<String> assessmentTypeList = new List<string>();
assessmentTypeList.Add("Design/Documentation");
assessmentTypeList.Add("Coding");
q = q.Where(a => a.project_id == int.Parse(filter) && (
a.AssessmentType.type == "AccessUSAN SetUp TLS_IP" ||
a.AssessmentType.type == "Production Implementation TLS_IP" ||
a.AssessmentType.type == "UAT Support TLS_IP" ||
a.AssessmentType.type == "UAT Implementation TLS_IP" ||
a.AssessmentType.type == "Other TLS_IP"
));
return new PagedData(q.Select(a => new
{
a.project_id,
a.Contact.name,
a.AssessmentType.type,
a.hours,
a.action,
a.requested_start_date,
a.requested_complete,
a.scheduled_start_date,
a.scheduled_complete,
a.actual_complete,
a.booked_hours,
a.swd_assessment_id
}));
}
else
{
return new PagedData("GetSWDAssessment expects a project_id");
}
}
default:
return new PagedData("Error: Unsupported Http Request: " + context.Request.RequestType + " not recognized", false);
}
}
开发者ID:nismonster,项目名称:ExtJS4.0-Infrastructure-Application,代码行数:59,代码来源:GetTLSAssessment.ashx.cs
示例17: 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("");
}
开发者ID:nismonster,项目名称:ExtJS4.0-Infrastructure-Application,代码行数:57,代码来源:AddContact.ashx.cs
示例18: ProcessRequest
public override PagedData ProcessRequest(HttpContext context, CookDBDataContext db)
{
string user_name = context.Request.Params.Get("user_name");
string project_id = context.Request.Params.Get("project_id");
int currProjectMISNewID = db.MISNews.Single(a => a.project_id.Equals(project_id)).mis_new_id;
int currProjectMISUpdatesID = db.MISUpdates.Single(a => a.project_id.Equals(project_id)).mis_update_id;
return new PagedData("Deleted");
}
开发者ID:nismonster,项目名称:ExtJS4.0-Infrastructure-Application,代码行数:12,代码来源:DeleteProject.ashx.cs
示例19: ProcessRequest
public override PagedData ProcessRequest(HttpContext context, CookDBDataContext db)
{
IQueryable<Company> q = db.Companies;
string filter = context.Request.Params.Get("name");
if (!isNull(filter))
{
q = q.Where(a => a.company_name.IndexOf(filter) != -1);
}
return new PagedData(q.Select(a => new { a.company_id, a.company_name }));
}
开发者ID:nismonster,项目名称:ExtJS4.0-Infrastructure-Application,代码行数:12,代码来源:GetCompanies.ashx.cs
示例20: ProcessRequest
public override PagedData ProcessRequest(HttpContext context, CookDBDataContext db)
{
IQueryable<BackofficeProcessReq> q = db.BackofficeProcessReqs;
string filter = context.Request.Params.Get("project_id");
if (!isNull(filter))
{
q = q.Where(a => a.project_id == int.Parse(filter));
return new PagedData(q.Select(a => new { a.backoffice_process_req_id, [email protected], a.name, a.exe_file, a.config_file, a.notes }));
}
return new PagedData("GetBackofficeProcessRequirements expects a project_id");
}
开发者ID:nismonster,项目名称:ExtJS4.0-Infrastructure-Application,代码行数:13,代码来源:BackofficeProcessReq.ashx.cs
注:本文中的Cookbook.CookDBDataContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论