public string headercontent_delete() { var pars = Request.Params; string contentid = pars["contentid"]; sqlServer db = new sqlServer(ConfigurationManager.ConnectionStrings["winhost"].ConnectionString); db.fetch(string.Format("delete from sandbox.headercontent where contentID='{0}' ;", contentid)); db.fetch(string.Format("delete from sandbox.content where contentID='{0}' ;", contentid)); return(""); }
//build Organizations Hierarchy tree public JsonResult json_readWorkFlow() { sqlServer db = new sqlServer(connString); DataTable dt = db.fetch("select * from dbo.organization").Tables[0]; //build tree List <Classes.organization> tree = new List <Classes.organization> { }; for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["parent_org_id"].ToString() == "") { var node = new Classes.organization() { org_id = dt.Rows[i][0].ToString(), parent_org_id = dt.Rows[i][1].ToString(), org_name = dt.Rows[i][2].ToString(), logo = "/jsplugins/workflow/images/" + dt.Rows[i][6].ToString(), children = new List <Classes.organization>(), //assignedUsers = this.getTaskAssignedUsers(Convert.ToUInt16(dt.Rows[i][0])) }; tree.Add(node); } } for (int j = 0; j < tree.Count; j++) { this.RecTree(tree[j], dt); } return(Json(tree, JsonRequestBehavior.AllowGet)); }
public ActionResult getHeaderContents() { var query = "select id,label from sandbox.header;" + "select hc.ID as headerContentID,h.id as headerID , contentID,c.label , content,viewurl from sandbox.header h " + "inner join sandbox.headerContent hc on hc.headerID=h.ID " + "inner join sandbox.Content c on hc.contentID=c.ID " + " order by h.id" ; sqlServer db = new sqlServer(ConfigurationManager.ConnectionStrings["winhost"].ConnectionString); var ds = db.fetch(query); var headers = ds.Tables[0] .AsEnumerable() .Select(x => new { id = x.ItemArray[0], label = x.ItemArray[1] }); var headerContents = ds.Tables[1] .AsEnumerable() .Select(x => new { headerContentID = x.ItemArray[0], headerID = x.ItemArray[1], contentID = x.ItemArray[2], contentLabel = x.ItemArray[3], content = x.ItemArray[4], viewurl = x.ItemArray[5] }) .OrderBy(x => x.headerID); return(Json(new { headers = headers, headerContents = headerContents }, JsonRequestBehavior.AllowGet)); }
public ActionResult getListings() { sqlServer db = new sqlServer(connString); var listings = db.fetch("exec realestate.getListings").Tables[0].AsEnumerable(); ViewBag.data = listings; return(PartialView("index1/listings")); }
public JsonResult json_getTopicDetails() { var pars = Request.Params; int topic_id = Convert.ToInt32(pars["topic_id"]); sqlServer db = new sqlServer(ConfigurationManager.ConnectionStrings["winhostConnection"].ConnectionString); DataTable dt = db.fetch("select topic_details from saeid.topic where is_active=1 and topic_id=" + topic_id + " order by datetime").Tables[0]; return(Json(new { result = dt.Rows[0][0].ToString() })); }
//DS public ActionResult getHeaders() { sqlServer db = new sqlServer(ConfigurationManager.ConnectionStrings["winhost"].ConnectionString); var source = db.fetch("select id,label from sandbox.header").Tables[0] .AsEnumerable() .Select(x => new { id = x.ItemArray[0], label = x.ItemArray[1] }); return(Json(source, JsonRequestBehavior.AllowGet)); }
public JsonResult transactionTypes() { sqlServer db = new sqlServer(connString); var data = db.fetch("select id,name from accounting.categoryType") .Tables[0] .AsEnumerable() .Select(r => new { id = r.ItemArray[0], name = r.ItemArray[1] }); return(Json(data, JsonRequestBehavior.AllowGet)); }
public string headercontent_savenew() { var pars = Request.Params; string headerid = pars["headerid"]; string url = pars["viewurl"]; string content = pars["description"]; string label = pars["label"]; sqlServer db = new sqlServer(ConfigurationManager.ConnectionStrings["winhost"].ConnectionString); DataTable dt1 = db.fetch(string.Format("insert into sandbox.content (content,label,viewurl) values('{0}','{1}','{2}');select SCOPE_IDENTITY();", content, label, url)).Tables[0]; var contentid = dt1.Rows[0][0].ToString(); db.exec(string.Format("insert into sandbox.headercontent (headerId,contentid) values('{0}','{1}')", headerid, contentid)); return(""); }
public object getTransactions() { string connString = "server=s06.winhost.com;uid=DB_40114_codeclub_user;pwd=p0$31d0n;database=DB_40114_codeclub"; sqlServer db = new sqlServer(connString); var data = db.fetch("select * from accounting.categoryType ct " + "inner join accounting.gltype t on t.id=ct.glTypeID " + "inner join Accounting.account a on a.catTypeID=ct.ID " + "full join Accounting.[transaction] trans on trans.accountid=a.ID") .Tables[0] .AsEnumerable() .Select(r => new { catTypeID = r.ItemArray[0], name = r.ItemArray[1] }); return(data); }
public static organization getOrgDetails(string org_id) { sqlServer db = new sqlServer(ConfigurationManager.ConnectionStrings["winhostConnection"].ConnectionString); DataTable dt = db.fetch("select * from organization where org_id=" + org_id).Tables[0]; organization data = new organization(); data = new organization() { org_id = dt.Rows[0][0].ToString(), parent_org_id = dt.Rows[0][1].ToString(), org_name = dt.Rows[0][2].ToString(), street = dt.Rows[0][3].ToString(), city = dt.Rows[0][4].ToString(), postalcode = dt.Rows[0][5].ToString() }; return(data); }
//tik public JsonResult json_getTopics() { sqlServer db = new sqlServer(ConfigurationManager.ConnectionStrings["winhostConnection"].ConnectionString); DataTable dt = db.fetch( "select topic_id as type_id,topic_title as type_title, topic_details as type_detail, topic_parent_id as parent_type_id,topic_title as type_name,is_active " + " from saeid.topic where is_active=1 order by datetime").Tables[0]; List <menu> tree = new List <menu> { }; for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["parent_type_id"].ToString() == "") { var node = new menu() { id = dt.Rows[i]["type_id"].ToString(), iconCls = "treei", type_name = dt.Rows[i]["type_name"].ToString(), parent_type_id = dt.Rows[i]["parent_type_id"].ToString(), type_title = dt.Rows[i]["type_title"].ToString(), type_detail = dt.Rows[i]["type_detail"].ToString(), children = new List <menu>() }; tree.Add(node); } } for (int j = 0; j < tree.Count; j++) { Rec(tree[j], dt); } return(Json(tree, JsonRequestBehavior.AllowGet)); }
public static organization getOrgDetails(string org_id) { sqlServer db = new sqlServer(ConfigurationManager.ConnectionStrings["winhostConnection"].ConnectionString); DataTable dt = db.fetch("select * from organization where org_id=" + org_id).Tables[0]; organization data = new organization(); data = new organization() { org_id = dt.Rows[0][0].ToString(), parent_org_id = dt.Rows[0][1].ToString(), org_name = dt.Rows[0][2].ToString(), street = dt.Rows[0][3].ToString(), city = dt.Rows[0][4].ToString(), postalcode = dt.Rows[0][5].ToString() }; return data; }
//tik public JsonResult json_getTopics() { sqlServer db = new sqlServer(ConfigurationManager.ConnectionStrings["winhostConnection"].ConnectionString); DataTable dt = db.fetch( "select topic_id as type_id,topic_title as type_title, topic_details as type_detail, topic_parent_id as parent_type_id,topic_title as type_name,is_active " + " from saeid.topic where is_active=1 order by datetime").Tables[0]; List<menu> tree = new List<menu> { }; for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["parent_type_id"].ToString() == "") { var node = new menu() { id = dt.Rows[i]["type_id"].ToString(), iconCls = "treei", type_name = dt.Rows[i]["type_name"].ToString(), parent_type_id = dt.Rows[i]["parent_type_id"].ToString(), type_title = dt.Rows[i]["type_title"].ToString(), type_detail = dt.Rows[i]["type_detail"].ToString(), children = new List<menu>() }; tree.Add(node); } } for (int j = 0; j < tree.Count; j++) Rec(tree[j], dt); return Json(tree, JsonRequestBehavior.AllowGet); }
public JsonResult json_getTopicDetails() { var pars = Request.Params; int topic_id = Convert.ToInt32(pars["topic_id"]); sqlServer db = new sqlServer(ConfigurationManager.ConnectionStrings["winhostConnection"].ConnectionString); DataTable dt = db.fetch("select topic_details from saeid.topic where is_active=1 and topic_id=" + topic_id + " order by datetime").Tables[0]; return Json(new { result = dt.Rows[0][0].ToString() }); }
//get Users assigned to Task public IEnumerable<object> getTaskAssignedUsers(int task_id) { sqlServer db=new sqlServer(connString); return db.fetch("exec [workflow].[getTaskAssignedUsers] @taskID="+task_id).Tables[0].AsEnumerable() .Select(x => new { org_id=x["org_id"].ToString(), person_id = x["person_id"].ToString(), fname = x["fname"].ToString(), lname = x["lname"].ToString() }); }
public JsonResult getOrgUsers() { var pars = Request.Params; int orgID=Convert.ToInt32(pars["orgID"]); sqlServer db = new sqlServer(connString); var data= db.fetch("exec workflow.getOrgUsers @orgID =" + orgID).Tables[0].AsEnumerable(); List<dynamic> result = new List<dynamic>(); foreach (var item in data) result.Add(new { person_id=item["person_id"], name = item["name"] }); return Json(result,JsonRequestBehavior.AllowGet); }