protected void dtl1_ItemCommand(object sender, DataListCommandEventArgs e) { if (e.CommandArgument.ToString().Equals("chk")) { localhost.Service s = new localhost.Service(); s.EditMessageStatus(((Label)dtl1.Items[e.Item.ItemIndex].FindControl("lbl_user")).Text, ((Label)dtl1.Items[e.Item.ItemIndex].FindControl("lbl_msg")).Text, 1); Show(x, y); } if (e.CommandArgument.ToString().Equals("del")) { localhost.Service s = new localhost.Service(); s.EditMessageStatus(((Label)dtl1.Items[e.Item.ItemIndex].FindControl("lbl_user")).Text, ((Label)dtl1.Items[e.Item.ItemIndex].FindControl("lbl_msg")).Text, 0); Show(x, y); } if (e.CommandArgument.ToString().Equals("ret")) { localhost.Service s = new localhost.Service(); s.EditMessageStatus(((Label)dtl1.Items[e.Item.ItemIndex].FindControl("lbl_user")).Text, ((Label)dtl1.Items[e.Item.ItemIndex].FindControl("lbl_msg")).Text, 1); Show(x, y); } if (e.CommandArgument.ToString().Equals("del1")) { localhost.Service s = new localhost.Service(); s.DeleteMsg(((Label)dtl1.Items[e.Item.ItemIndex].FindControl("lbl_user")).Text, ((Label)dtl1.Items[e.Item.ItemIndex].FindControl("lbl_msg")).Text); Response.Write(@"<script language='javascript'>alert('הודעה נמחקה בהצלחה!');</script>"); Show(x, y); } }
public void Show(int x, int y) { localhost.Service s = new localhost.Service(); DataSet ds = new DataSet(); switch (y) { case 0: ds = s.GetAllMessages(x); break; case 1: ds = s.GetCheckedMessages(x); break; case 2: ds = s.GetUnCheckedMessages(x); break; case 3: ds = s.GetDeletedMessages(x); break; case 4: ds = s.GetDraftMessages(x); break; } dtl1.DataSource = ds; dtl1.DataBind(); BtnCng(); Color(); Board(); Date(); }
protected void Page_Load(object sender, EventArgs e) { string sec; //若是页面首次被加载,获得讨论分区 if (!IsPostBack) { //赋值,保存在服务端作为全局变量,当浏览器关闭时session失效 //获取HTTP查询字符串变量集合 Session["section"] = Request.QueryString.GetValues(0)[0].ToString(); } sec = GetSection(Session["section"].ToString()); //显示论坛分区 lblName.Text = sec; //根据不同的论坛分区显示不同的图标 IconImage(); //显示相应的论坛分区帖子列表 localhost.Service Service = new localhost.Service(); DataSet titleListDS = Service.GetSortList(sec); GridView1.DataSource = titleListDS.Tables["TitleList"].DefaultView; //绑定并显示留言帖标题 GridView1.DataBind(); }
protected void Button1_Click(object sender, EventArgs e) { if (ddl.SelectedIndex >= 0) { localhost.Service serviceObj = new localhost.Service(); localhost.Table tableObj = listOfTables[ddl.SelectedIndex]; localhost.TenantTableInfo obj = serviceObj.ReadData((int)Session["orgID"],tableObj.ObjIDProperty); string[] arr = obj.FieldNamesProperty; List<string> array = new List<string>(arr); string[] values = obj.FieldValuesProperty; List<string> valuearr = new List<string>(values); int countRow = valuearr.Count / array.Count; int counter = 0; for (int i = 0; i < countRow; i++) { TableRow row = new TableRow(); for (int j = 0; j < array.Count; j++) { TableCell cell = new TableCell(); cell.Text = valuearr[counter++].ToString(); row.Cells.Add(cell); } Table1.Rows.Add(row); } } }
protected void Page_Load(object sender, EventArgs e) { //访问webservice数据 localhost.Service Service = new localhost.Service(); //显示帖子标题,通过主题的nodeId属性来获得,该nodeId在数据空中有 DataSet titleListDS = Service.GetTitle(Convert.ToInt32(Request.QueryString.GetValues(0)[0])); DataList1.DataSource = titleListDS.Tables["TitleList"].DefaultView; DataList1.DataBind(); //显示帖子内容 DataSet ContentDS = Service.GetContent(Convert.ToInt32(Request.QueryString.GetValues(0)[0])); DataList2.DataSource = ContentDS.Tables["NoteContent"].DefaultView; DataList2.DataBind(); //如果该帖子由用户发布,则编辑帖子按钮可见 //if ((Session["username"] != null) && (Session["username"].ToString() == titleListDS.Tables["TitleList"].Rows[0].ItemArray[4].ToString().Trim().ToLower())) //{ // editBtn.Visible = true; //} if ((Session["username"] != null) && Session["username"].ToString().Equals(titleListDS.Tables["TitleList"].Rows[0].ItemArray[4].ToString().Trim(), StringComparison.OrdinalIgnoreCase)) { editBtn.Visible = true; } }
protected void Button1_Click(object sender, EventArgs e) { if (ddl.SelectedIndex >= 0 && DropDownList1.SelectedIndex >= 0) { localhost.Service serviceObj = new localhost.Service(); values = (List<localhost.Field>)ViewState["listOfValues"]; listOfTables = (List<localhost.Table>)ViewState["listOfTables"]; localhost.Table tableObj = listOfTables[ddl.SelectedIndex]; localhost.Field fieldObj = values[DropDownList1.SelectedIndex]; bool success = serviceObj.DeleteField((int)Session["orgID"], tableObj.ObjIDProperty, fieldObj.FieldIDProperty); if (success) Label1.Visible = true; else Label2.Visible = true; int OrgID = (int)Session["orgID"]; localhost.Table[] array = serviceObj.GetTables(OrgID); listOfTables = new List<localhost.Table>(array); ddl.DataSource = listOfTables; ddl.DataTextField = "TNameProperty"; ddl.DataValueField = "ObjIDProperty"; ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged); ddl.DataBind(); ViewState["listOfTables"] = listOfTables; values = null; DropDownList1.DataSource = null; DropDownList1.DataBind(); } }
//回复帖子 protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { //若用户没有登陆 跳转到错误页面 if (Session["usernick"] == null) { Response.Redirect("ErrorMsg.aspx"); return; } //添加留言 localhost.Service myBBS = new localhost.Service(); //通过选择不同的分区来获得分区的id,并且通过当前的用户名、昵称名来更新数据库中的信息 int state = myBBS.AppearRes(Convert.ToInt32(Request.QueryString.GetValues(0)[0]), ContentTbx.Text.ToString(), Session["usernick"].ToString(), Session["username"].ToString()); if (state == 1) { //显示留言成功 并重新显示用户回复 lblMsg.Text = "留言成功"; localhost.Service bbsDb = new localhost.Service(); //获取更新后的回复内容 DataSet ContentDS = bbsDb.GetContent(Convert.ToInt32(Request.QueryString.GetValues(0)[0])); DataList2.DataSource = ContentDS.Tables["NoteContent"].DefaultView; DataList2.DataBind(); } else { lblMsg.Text = "留言失败"; } return; }
public Boolean CreateCustomerAccount(string username, string password, string cardNumber, string streetAddress, string cityName, string zipCode, string contactNumber) { localhost.Service serviceObj = new localhost.Service(); List<String> fieldnames = new List<String>(); fieldnames.Add("0"); fieldnames.Add("1"); fieldnames.Add("2"); fieldnames.Add("3"); fieldnames.Add("4"); fieldnames.Add("5"); fieldnames.Add("6"); List<String> valueNames = new List<String>(); valueNames.Add(username); valueNames.Add(password); valueNames.Add(cardNumber); valueNames.Add(streetAddress); valueNames.Add(cityName); valueNames.Add(zipCode); valueNames.Add(contactNumber); bool success = serviceObj.InsertData(11, 32, "CustomerServiceInstance", fieldnames.ToArray(), valueNames.ToArray()); if (success) return true; else return false; }
protected void Page_Load(object sender, EventArgs e) { //显示用户信息 localhost.Service myBBS = new localhost.Service(); DataSet userInforDS = myBBS.GetUserInfo(Session["username"].ToString()); DataList1.DataSource = userInforDS.Tables["UserInfor"].DefaultView; DataList1.DataBind(); //显示所有用户发表的帖子 DataSet titleListDS1 = myBBS.GetUserTitle(Session["username"].ToString(), "站务通知"); DataList2.DataSource = titleListDS1.Tables["TitleList"].DefaultView; DataList2.DataBind(); DataSet titleListDS2 = myBBS.GetUserTitle(Session["username"].ToString(), "文化艺术"); DataList4.DataSource = titleListDS2.Tables["TitleList"].DefaultView; DataList4.DataBind(); DataSet titleListDS3 = myBBS.GetUserTitle(Session["username"].ToString(), "休闲娱乐"); DataList5.DataSource = titleListDS3.Tables["TitleList"].DefaultView; DataList5.DataBind(); DataSet titleListDS4 = myBBS.GetUserTitle(Session["username"].ToString(), "学习天地"); DataList6.DataSource = titleListDS4.Tables["TitleList"].DefaultView; DataList6.DataBind(); DataSet titleListDS5 = myBBS.GetUserTitle(Session["username"].ToString(), "信息技术"); DataList7.DataSource = titleListDS5.Tables["TitleList"].DefaultView; DataList7.DataBind(); }
//更新编辑后的帖子 protected void editBtn_Click(object sender, EventArgs e) { //更新编辑后帖子(内容、时间) localhost.Service service = new localhost.Service(); //Request.QueryString.GetValues(0)[0]获取上一页面中点击“站点文化”的id int state = service.AlterNote(Convert.ToInt32(Request.QueryString.GetValues(0)[0]), titleTbx.Text.ToString(), txtContent.Text.ToString()); if (state == 1) { lblMsg.Text = "更新成功!"; //更新时间 } //将更新成功后的信息展现在我们的页面上 DataSet titleListDS = service.GetTitle(Convert.ToInt32(Request.QueryString.GetValues(0)[0])); // DataRowView mydrview = titleListDS.Tables["TitleList"].DefaultView[0]; //更新内容 txtContent.Text = Convert.ToString(mydrview.Row["noteContent"]); //更新标题 titleTbx.Text = Convert.ToString(mydrview.Row["noteTitle"]); }
protected void Page_Load(object sender, EventArgs e) { //显示各个论坛分区的帖子列表 //获取特定组的主题帖 localhost.Service myBBS = new localhost.Service(); DataSet titleListDS1 = myBBS.GetSortList("站务通知"); GridView1.DataSource = titleListDS1.Tables["TitleList"].DefaultView; GridView1.DataBind(); DataSet titleListDS2 = myBBS.GetSortList("文化艺术"); GridView2.DataSource = titleListDS2.Tables["TitleList"].DefaultView; GridView2.DataBind(); DataSet titleListDS3 = myBBS.GetSortList("信息技术"); GridView3.DataSource = titleListDS3.Tables["TitleList"].DefaultView; GridView3.DataBind(); DataSet titleListDS4 = myBBS.GetSortList("休闲娱乐"); GridView4.DataSource = titleListDS4.Tables["TitleList"].DefaultView; GridView4.DataBind(); DataSet titleListDS5 = myBBS.GetSortList("学习天地"); GridView5.DataSource = titleListDS5.Tables["TitleList"].DefaultView; GridView5.DataBind(); //显示投票列表 DataSet BallotList = myBBS.ShowSubjects(); GridView6.DataSource = BallotList.Tables["Subject"].DefaultView; GridView6.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["User"] != null) { localhost.Service srv = new localhost.Service(); string user = (string)Session["User"]; string content = "<table width=100% align=center><tr><td>מספר הזמנה</td><td>המוצר</td><td>כמות</td><td>מחיר כולל</td></tr>"; DataTable dt = srv.TakeActi("Select * From Orders Where CustomerID='" + user + "'"); for (int i = 0; i < dt.Rows.Count; i++) { DataTable dtD = srv.TakeActi("Select * From products Where OrderID='" + dt.Rows[i][0].ToString() + "'"); for (int h = 0; h < dtD.Rows.Count; h++) { string Proid = dtD.Rows[h][1].ToString(); DataTable dt1 = srv.TakeActi("Select * From capiteria Where ProductID='" + Proid + "'"); int TPrice = int.Parse(dt.Rows[i][2].ToString()); content += "<tr><td>" + dtD.Rows[h][0].ToString() + "</td><td><img height=100 width=100 src='" + dt1.Rows[0][2].ToString() + "'></img><br>" + dt1.Rows[0][1].ToString() + "</td><td>" + dtD.Rows[h][3].ToString() + "</td><td>" + TPrice + "</td></tr>"; } } content += "</table>"; busket.InnerHtml = content; } else { string sPath = System.Web.HttpContext.Current.Request.Url.AbsolutePath; System.IO.FileInfo oInfo = new System.IO.FileInfo(sPath); string sRet = oInfo.Name; Session["Loged"] = sRet; Response.Redirect("Login.aspx"); } }
public void add() { localhost.Service ls = new localhost.Service(); int p = ls.sum(20, 30); Response.Write(p); }
//投票按钮事件 protected void btnBallot_Click(object sender, EventArgs e) { localhost.Service myBBS = new localhost.Service(); for (int i = 0; i < BallotGV.Rows.Count; i++) { // 获取模版列中的CheckBox控件 CheckBox BallotCbx = (CheckBox)BallotGV.Rows[i].Cells[0].FindControl("checkBallot"); if (BallotCbx.Checked == true) { //更新投票 // 摘要: // 获取状态信息的字典,这些信息使您可以在同一页的多个请求间保存和还原服务器控件的视图状态。 // // 返回结果: // 包含服务器控件视图状态信息的 System.Web.UI.StateBag 类的实例。 DataSet myDataSet = (DataSet)ViewState["Ballot"]; //绑定到的字段,选择的是数据绑定控件中绑定到的字段,选择的是第i行中标识为OptionID在Ballot中的元素 int BallotId = Convert.ToInt32(myDataSet.Tables["Ballot"].Rows[i]["OptionID"]); //获取投票项目的id(subjectId),获取绑定到字段,这里为投票分区的subjectId myBBS.UpdateBallot(BallotId, Convert.ToInt32(Request.QueryString.GetValues(0)[0])); } } //重新显示投票 BallotBind(Convert.ToInt32(Request.QueryString.GetValues(0)[0])); }
protected void btn_del_Click(object sender, EventArgs e) { if (lbl_del.Visible == false) { lbl_del.Visible = true; lbl_del1.Visible = true; } else { lbl_del.Visible = false; lbl_del1.Visible = false; localhost.Service my_Serv = new localhost.Service(); my_Serv.ChangeUserStatus(Session["User"].ToString(), 0); DataSet ds = my_Serv.GetUserMess(Session["User"].ToString()); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { my_Serv.EditMessageStatus(ds.Tables[0].Rows[i][0].ToString(), ds.Tables[0].Rows[i][1].ToString(), 0); } Session["User"] = null; Session["Rank"] = null; ((LinkButton)this.Master.FindControl("SignIn")).Visible = true; ((LinkButton)this.Master.FindControl("SignOut")).Visible = false; Response.Redirect("Home.aspx"); } }
protected void Button1_Click(object sender, EventArgs e) { string sql = "Insert Into `cinema` (Name, Rows, SPR) VALUES('" + TextBox5.Text + "', " + int.Parse(TextBox6.Text) + ", " + int.Parse(TextBox7.Text) + ")"; localhost.Service srv = new localhost.Service(); srv.TakeAcon(sql); }
public double apply_discount(int OrgID, double price, int CustomerID) { double discount = 0.0; int CustomerCategoryObjID = 0; int CustomerObjID = 0; localhost.Service serviceObj = new localhost.Service(); localhost.Table[] Tarray = serviceObj.GetTables(OrgID); List<localhost.Table> listOfTables = new List<localhost.Table>(Tarray); for (int i = 0; i < listOfTables.Count; i++) { if (listOfTables[i].TNameProperty == "CustomerCategory") { CustomerCategoryObjID = listOfTables[i].ObjIDProperty; } if (listOfTables[i].TNameProperty == "Customer") { CustomerObjID = listOfTables[i].ObjIDProperty; } } localhost.TenantTableInfo obj = serviceObj.ReadDataWithGUID(OrgID, CustomerObjID, CustomerID); string[] arr = obj.FieldNamesProperty; List<string> array = new List<string>(arr); string[] values = obj.FieldValuesProperty; List<string> valuearr = new List<string>(values); int counter = 0; int categoryid = 0; for (int j = 0; j < array.Count; j++) { if (arr[j].ToString() == "CustCategoryID") { categoryid = Convert.ToInt32(valuearr[counter].ToString()); } counter++; } double total = 0; obj = serviceObj.ReadDataWithGUID(OrgID, CustomerCategoryObjID, CustomerID); arr = obj.FieldNamesProperty; array = new List<string>(arr); values = obj.FieldValuesProperty; valuearr = new List<string>(values); counter = 0; for (int j = 0; j < array.Count; j++) { if (arr[j].ToString() == "DiscountPercentage") { discount = Convert.ToDouble(valuearr[counter].ToString()); total = price - (price * discount) / 100; } counter++; } return total; }
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) { localhost.Service srv = new localhost.Service(); GridView1.EditIndex = -1; DataTable dt = srv.TakeActi("Select * From capiteria WHERE `status`='T'"); GridView1.DataSource = dt; GridView1.DataBind(); }
public void BindTheDataGrid2() { localhost.Service srv = new localhost.Service(); string ff = (string)Session["Follow"]; DataTable dt = srv.TakeTickets(ff); GridView2.DataSource = dt; GridView2.DataBind(); }
public void BindTheDataGrid() { localhost.Service srv = new localhost.Service(); DataTable dt = srv.TakeUsers(); GridView1.DataSource = dt; GridView1.DataBind(); }
protected void Button2_Click(object sender, EventArgs e) { string sql = "Insert Into Catgory (CatgoryName) VALUES('" + TextBox4.Text + "')"; localhost.Service srv = new localhost.Service(); srv.TakeAcon(sql); srv.TakeAcon("Insert Into ActionsLog (CustomerID, ActionInfo) VALUES('" + Session["User"].ToString() + "', 'המשתמש הוסיף קטגוריה לקפיטריה')"); }
protected void AddCommentButton_Click(object sender, EventArgs e) { srv = new localhost.Service(); string mid = Movies.GetMovieByID(Request["mid"].ToString()).GetGlobalID().ToString(); srv.AddComment(mid, CommenterNameTextBox.Text, NewCommentTextBox.Text); Response.Redirect("/Pages/OneMovie.aspx?mid=" + m1.GetID()); }
protected void Button3_Click(object sender, EventArgs e) { string sql = "Insert Into `cinema` (Name, Rows, SPR) VALUES('" + TextBox5.Text + "', " + int.Parse(TextBox6.Text) + ", " + int.Parse(TextBox7.Text) + ")"; localhost.Service srv = new localhost.Service(); srv.TakeAcon(sql); srv.TakeAcon("Insert Into ActionsLog (CustomerID, ActionInfo) VALUES('" + Session["User"].ToString() + "', 'המשתמש הוסיף אולם קולנוע')"); }
protected void GridView3_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) { GridView3.EditIndex = -1; localhost.Service srv = new localhost.Service(); int Selected = (int)Session["Movie"]; DataTable dt = srv.TakeActi("SELECT * From movies Where `movieID`='" + Selected + "'"); GridView3.DataSource = dt; GridView3.DataBind(); }
// 投票结果GridView绑定 private void BallotBind(int subjectId) { // 数据绑定 localhost.Service myBBS = new localhost.Service(); DataSet myDataSet = new DataSet(); myDataSet = myBBS.GetBallotRes(subjectId); balResult.DataSource = myDataSet.Tables["Ballot"]; balResult.DataBind(); }
//GridView分页代码 public void GridView_PageIndexChanging(GridView newGirdView, string sec, object sender, GridViewPageEventArgs e) { newGirdView.PageIndex = e.NewPageIndex; localhost.Service myBBS = new localhost.Service(); //获取讨论分区的主题 DataSet titleListDS = myBBS.GetSortList(sec); newGirdView.DataSource = titleListDS.Tables["TitleList"].DefaultView; newGirdView.DataBind(); }
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e) { localhost.Service serviceObj = new localhost.Service(); TextBox txt = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("LastName"); int orgID = serviceObj.AccountRegistration(CreateUserWizard1.UserName, txt.Text, CreateUserWizard1.Email, CreateUserWizard1.Password); if (orgID > 0) { Session["OrgID"] = orgID; Session["username"] = CreateUserWizard1.Email; Response.Redirect("Home.aspx"); } }
// 投票选项GridView绑定 private void BallotItemsBind(int id) { localhost.Service myBBS = new localhost.Service(); //BBS_DataBase myBBS = new BBS_DataBase(); // 数据绑定 DataSet myDataSet = new DataSet(); myDataSet = myBBS.GetBallotRes(Convert.ToInt32(Request.QueryString.GetValues(0)[0])); BallotGV.DataSource = myDataSet.Tables["Ballot"]; BallotGV.DataBind(); ViewState["Ballot"] = myDataSet; }
protected void GridView2_RowDeleting1(object sender, GridViewDeleteEventArgs e) { int row = e.RowIndex; int k = int.Parse(GridView2.Rows[row].Cells[0].Text); string sql = "Delete from tickets Where ticketID=" + k; localhost.Service srv = new localhost.Service(); srv.TakeAcon(sql); GridView2.EditIndex = -1; BindTheDataGrid2(); }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { GridView1.PageSize = 5; GridView1.PagerSettings.Mode = PagerButtons.Numeric; localhost.Service srv = new localhost.Service(); DataTable dt = srv.TakeActi("Select * From capiteria WHERE `status`='T'"); GridView1.DataSource = dt; GridView1.DataBind(); } }
protected void Button2_Click(object sender, EventArgs e) { if (type == "Movie") { localhost.Service srv = new localhost.Service(); OleDbCommand cmmd3 = new OleDbCommand(); string user3 = (string)Session["User"]; cmmd3.CommandText = "Delete from tickets Where `status`='Y' and costumerID='" + user3 + "' and movieID='" + proid + "'"; srv.TakeAcon(cmmd3.CommandText); Response.Redirect("UserControl.aspx"); } }
protected void GridView2_SelectedIndexChanged(object sender, EventArgs e) { int Selected = int.Parse(GridView2.Rows[GridView2.SelectedIndex].Cells[2].Text); localhost.Service srv = new localhost.Service(); GridView3.Visible = true; DataTable dt3 = srv.TakeActi("SELECT * From movies Where `movieID`='" + Selected + "'"); GridView3.DataSource = dt3; Session["Movie"] = Selected; GridView3.DataBind(); GridView2.Visible = false; }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { int row = e.RowIndex; int k = int.Parse(GridView1.Rows[row].Cells[0].Text); string sql2 = "Delete from tickets Where costumerID='" + k + "'"; string sql = "Delete from Users Where CustomerID='" + k + "'"; localhost.Service srv = new localhost.Service(); srv.TakeAcon(sql2); srv.DeleteGRD(sql); GridView1.EditIndex = -1; BindTheDataGrid(); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { int row = e.RowIndex; int k = int.Parse(GridView1.Rows[row].Cells[0].Text); string sql2 = "Update capiteria SET `status`='F' Where productID='" + k + "'"; localhost.Service srv = new localhost.Service(); srv.TakeAcon(sql2); GridView1.EditIndex = -1; DataTable dt = srv.TakeActi("Select * From capiteria WHERE `status`='T'"); GridView1.DataSource = dt; GridView1.DataBind(); }
protected void Delete() { localhost.Service s = new localhost.Service(); DateTime Today = DateTime.Today; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { if (DateTime.Compare(Today, (DateTime.Parse(ds.Tables[0].Rows[i][3].ToString()))) > 0 && (ds.Tables[0].Rows[i][3].ToString() != "0")) { s.EditMessageStatus(ds.Tables[0].Rows[i][0].ToString(), ds.Tables[0].Rows[i][1].ToString(), 2); ds.Tables[0].Rows.Remove(ds.Tables[0].Rows[i]); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int OrgID = (int)Session["orgID"]; localhost.Service serviceObj = new localhost.Service(); localhost.Table[] array = serviceObj.GetTables(OrgID); listOfTables = new List<localhost.Table>(array); ddl.DataSource = listOfTables; ddl.DataTextField = "TNameProperty"; ddl.DataValueField = "ObjIDProperty"; ddl.DataBind(); } }
protected void LoginButton_Click(object sender, EventArgs e) { localhost.Service serviceObj = new localhost.Service(); int objID = serviceObj.Login(Login1.UserName, Login1.Password); if (objID > 0) { Session["orgID"] = objID; Session["username"] = Login1.UserName; Response.Redirect("Home.aspx"); } else { return; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int OrgID = (int)Session["orgID"]; localhost.Service serviceObj = new localhost.Service(); localhost.Table[] array = serviceObj.GetTables(OrgID); listOfTables = new List<localhost.Table>(array); ddl.DataSource = listOfTables; ddl.DataTextField = "TNameProperty"; ddl.DataValueField = "ObjIDProperty"; ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged); ddl.DataBind(); Label3.Visible = true; Label4.Visible = true; ViewState["listOfTables"] = listOfTables; } }
protected void Button1_Click(object sender, EventArgs e) { if (DropDownList2.SelectedIndex >= 0 && DropDownList1.SelectedIndex >= 0) { lstOfTables = (List<localhost.Table>)ViewState["foreignkey"]; localhost.Table tableObj = lstOfTables[DropDownList2.SelectedIndex]; int index = DropDownList1.SelectedIndex; localhost.Field selectedField = FieldList[index]; localhost.Service serviceObj = new localhost.Service(); int orgID = (int)Session["orgID"]; int ObjID = (int)Session["objID"]; bool success = serviceObj.InsertRelationship(orgID, ObjID, tableObj.ObjIDProperty, selectedField.FieldIDProperty); if (success) Label3.Visible = true; else Label4.Visible = true; } }
protected void BtnForeignKey_Click(object sender, EventArgs e) { if (DropDownList1.SelectedIndex >= 0) { int index = DropDownList1.SelectedIndex; localhost.Field selectedField = FieldList[index]; localhost.Service serviceObj = new localhost.Service(); int orgID = (int)Session["orgID"]; int objID = (int)Session["objID"]; localhost.Table[] tablelst = serviceObj.getTablesWithPrimaryKey(orgID, objID, selectedField.FieldDataType); lstOfTables = new List<localhost.Table>(tablelst); DropDownList2.DataSource = lstOfTables; DropDownList2.DataTextField = "TNameProperty"; DropDownList2.DataValueField = "ObjIDProperty"; DropDownList2.DataBind(); ViewState["foreignkey"] = lstOfTables; } //serviceObj.getTablesWithPrimaryKey((int)Session["orgID"], }
protected void Button1_Click(object sender, EventArgs e) { if (ddl.SelectedIndex >= 0 ) { localhost.Service serviceObj = new localhost.Service(); bool success = serviceObj.DeleteTable((int)Session["orgID"], Convert.ToInt32(ddl.SelectedValue)); if (success) Label3.Visible = true; else Label4.Visible = false; int OrgID = (int)Session["orgID"]; localhost.Table[] array = serviceObj.GetTables(OrgID); listOfTables = new List<localhost.Table>(array); ddl.DataSource = listOfTables; ddl.DataTextField = "TNameProperty"; ddl.DataValueField = "ObjIDProperty"; ddl.DataBind(); } }
protected void Button1_Click(object sender, EventArgs e) { if (ddl.SelectedIndex >= 0) { localhost.Service serviceObj = new localhost.Service(); //localhost.Table tableObj = listOfTables[ddl.SelectedValue]; localhost.Field[] array = serviceObj.ReadField((int)Session["orgID"], Convert.ToInt32(ddl.SelectedValue)); List<localhost.Field> values = new List<localhost.Field>(array); for (int i = 0; i < values.Count; i++) { TableRow row = new TableRow(); TableCell cell1 = new TableCell(); cell1.Text = values[i].FieldNameProperty.ToString(); TableCell cell2 = new TableCell(); cell2.Text = values[i].FieldDataType.ToString(); row.Cells.Add(cell1); row.Cells.Add(cell2); Table1.Rows.Add(row); } } }
public Boolean authenticateUserNamePassword(string username, string password) { string uname = null, pword = null; localhost.Service serviceObj = new localhost.Service(); localhost.TenantTableInfo obj = serviceObj.ReadData(11, 32); string[] arr = obj.FieldNamesProperty; List<string> array = new List<string>(arr); string[] values = obj.FieldValuesProperty; List<string> valuearr = new List<string>(values); int countRow = valuearr.Count / array.Count; int counter = 0; for (int i = 0; i < countRow; i++) { for (int j = 0; j < array.Count; j++) { if (arr[j].ToString() == "password") { pword = valuearr[counter].ToString(); if (username == uname && pword == password) { return true; } else { return false; } } if (arr[j].ToString() == "username") { uname = valuearr[counter].ToString(); } counter++; } } return false; }
private int CreateServices(string wsdl_text) { Type service; try { //Try Database Connection SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["SAASDB"].ToString()); try { conn.Open(); } catch (Exception e) { //Return Error return -1; } localhost.Service serviceObj = new localhost.Service(); //Insert into Data Table the services int count = 0; List<string> fieldnames = new List<string>(); List<localhost.Field> fieldlist = new List<localhost.Field>(); localhost.Field[] fields = serviceObj.ReadField(11, 30); fieldlist = new List<localhost.Field>(fields); foreach (localhost.Field item in fieldlist) { fieldnames.Add(count.ToString()); count++; } Uri uri = new Uri(wsdl_text); WebRequest webRequest = WebRequest.Create(uri); System.IO.Stream requestStream = webRequest.GetResponse().GetResponseStream(); // Get a WSDL file describing a service ServiceDescription sd = ServiceDescription.Read(requestStream); string sdName = sd.Services[0].Name; // Initialize a service description servImport ServiceDescriptionImporter servImport = new ServiceDescriptionImporter(); servImport.AddServiceDescription(sd, String.Empty, String.Empty); servImport.ProtocolName = "Soap"; servImport.CodeGenerationOptions = CodeGenerationOptions.GenerateProperties; CodeNamespace nameSpace = new CodeNamespace(); CodeCompileUnit codeCompileUnit = new CodeCompileUnit(); codeCompileUnit.Namespaces.Add(nameSpace); // Set Warnings ServiceDescriptionImportWarnings warnings = servImport.Import(nameSpace, codeCompileUnit); if (warnings == 0) { StringWriter stringWriter = new StringWriter(System.Globalization.CultureInfo.CurrentCulture); Microsoft.CSharp.CSharpCodeProvider prov = new Microsoft.CSharp.CSharpCodeProvider(); prov.GenerateCodeFromNamespace(nameSpace, stringWriter, new CodeGeneratorOptions()); // Compile the assembly with the appropriate references string[] assemblyReferences = new string[2] { "System.Web.Services.dll", "System.Xml.dll" }; CompilerParameters param = new CompilerParameters(assemblyReferences); param.GenerateExecutable = false; param.GenerateInMemory = true; param.TreatWarningsAsErrors = false; param.WarningLevel = 4; CompilerResults results = new CompilerResults(new TempFileCollection()); results = prov.CompileAssemblyFromDom(param, codeCompileUnit); Assembly assembly = results.CompiledAssembly; service = assembly.GetType(sdName); string input_params = ""; string return_type = ""; MethodInfo[] methodInfo = service.GetMethods(); foreach (MethodInfo t in methodInfo) { List<string> valueNames = new List<string>(); if (t.Name == "Discover") break; input_params = ""; return_type = ""; foreach (ParameterInfo parameter in t.GetParameters()) { //paramname.Text = "(" + temp.ParameterType.Name + " " + temp.Name + ")"; input_params = input_params + parameter.Name + ":" + parameter.ParameterType.Name + " "; } //Get The Return type of the Service(Method) return_type = t.ReturnType.ToString(); //Insert into Service Object(Methods Table) valueNames.Add(Session["OrgID"].ToString()); valueNames.Add(wsdl_text); valueNames.Add(t.Name); valueNames.Add(input_params); valueNames.Add(return_type); bool success = serviceObj.InsertData(11, 30, "WSDL-Instance", fieldnames.ToArray(), valueNames.ToArray()); if (success == false) { return -1; } } return 1; } else { return -1; } } catch (Exception ex) { return -1; } }
private void SaveToDB(Workflow customwrkflw) { customwrkflw.WfName = txtWorkflowName.Text; List<String> fieldnames = new List<String>(); fieldnames.Add("0"); fieldnames.Add("1"); fieldnames.Add("2"); fieldnames.Add("3"); List<String> valueNames = new List<String>(); valueNames.Add(Session["OrgID"].ToString()); valueNames.Add(customwrkflw.WfName); valueNames.Add(customwrkflw.WrkflwMethods); valueNames.Add(customwrkflw.WrkflwInputs); localhost.Service serviceObj = new localhost.Service(); bool success = serviceObj.InsertData(11, 31, "Worfkflow-Instance", fieldnames.ToArray(), valueNames.ToArray()); if (success) { Label1.Text = "Worflow added successfully"; Label1.Visible = true; } else { Label1.Text = "Operation Unsuccessfull"; Label1.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { localhost.Service serviceObj = new localhost.Service(); localhost.TenantTableInfo obj = serviceObj.ReadData(11, 31); string[] arr = obj.FieldNamesProperty; List<string> array = new List<string>(arr); string[] values = obj.FieldValuesProperty; List<string> valuearr = new List<string>(values); int countRow = valuearr.Count / array.Count; int counter = 0; TableRow row = new TableHeaderRow(); var cell1 = new TableCell(); row.TableSection = TableRowSection.TableHeader; cell1.Text = "Global ID"; row.Cells.Add(cell1); WfTable.Rows.Add(row); row.TableSection = TableRowSection.TableHeader; cell1 = new TableCell(); cell1.Text = "Workflow Name"; row.Cells.Add(cell1); WfTable.Rows.Add(row); row.TableSection = TableRowSection.TableHeader; cell1 = new TableCell(); cell1.Text = "Selection"; row.Cells.Add(cell1); WfTable.Rows.Add(row); int addrow = 0; for (int i = 0; i < countRow; i++) { addrow = 0; row = new TableRow(); RadioButton rbnew = new RadioButton(); if (i == 0) { rbnew.Checked = true; } for (int j = 0; j < array.Count; j++) { TableCell cell = new TableCell(); if (arr[j].ToString() == "GUID") { cell.Text = valuearr[counter].ToString(); rbnew.ID = valuearr[counter].ToString(); rbnew.EnableViewState = true; rbnew.CheckedChanged += new EventHandler(Changed); rbnew.AutoPostBack = true; rbnew.GroupName = "Check"; row.Cells.Add(cell); } if (arr[j].ToString() == "wfname") { cell.Text = valuearr[counter].ToString(); row.Cells.Add(cell); } if (arr[j].ToString() == "ownerid") { if (Convert.ToInt32(valuearr[counter]) == 11 || Convert.ToInt32(valuearr[counter]) == Convert.ToInt32(Session["OrgId"])) { addrow = 1; } } counter++; } if (addrow == 1) { TableCell cellcheck = null; row.Cells.Add(cellcheck = new TableCell()); ((IParserAccessor)cellcheck).AddParsedSubObject(rbnew); WfTable.Rows.Add(row); } } }
void ShowServices() { localhost.Service serviceObj = new localhost.Service(); localhost.TenantTableInfo obj = serviceObj.ReadData(11, 30); string[] arr = obj.FieldNamesProperty; List<string> array = new List<string>(arr); string[] values = obj.FieldValuesProperty; List<string> valuearr = new List<string>(values); int counter = 0; int addrow = 0; int countRow = valuearr.Count / array.Count; DataColumn col1 = new DataColumn("Service Name"); DataColumn col2 = new DataColumn("Input params"); DataColumn col3 = new DataColumn("Output params"); col1.DataType = System.Type.GetType("System.String"); col2.DataType = System.Type.GetType("System.String"); col3.DataType = System.Type.GetType("System.String"); dt.Columns.Add(col1); dt.Columns.Add(col2); dt.Columns.Add(col3); for (int i = 0; i < countRow; i++) { addrow = 0; DataRow row = dt.NewRow(); for (int j = 0; j < array.Count; j++) { if (arr[j].ToString() == "mname") { row[col1] = valuearr[counter].ToString(); } if (arr[j].ToString() == "minput") { row[col2] = valuearr[counter].ToString(); } if (arr[j].ToString() == "moutput") { row[col3] = valuearr[counter].ToString(); } if (arr[j].ToString() == "ownerid") { if (Convert.ToInt32(valuearr[counter]) == 11 || Convert.ToInt32(valuearr[counter]) == Convert.ToInt32(Session["OrgId"])) { addrow = 1; } } counter++; } if (addrow > 0) { dt.Rows.Add(row); } } GridView1.DataSource = dt; GridView1.DataBind(); }
public Order Displayinfo(int OrgID, int OrderID) { Order order_obj = null; int ObjID = 0; localhost.Service serviceObj = new localhost.Service(); localhost.Table[] Tarray = serviceObj.GetTables(OrgID); List<localhost.Table> listOfTables = new List<localhost.Table>(Tarray); for (int i = 0; i < listOfTables.Count; i++) { if (listOfTables[i].TNameProperty == "Order") { ObjID = listOfTables[i].ObjIDProperty; } } if (ObjID != 0) { localhost.TenantTableInfo obj = serviceObj.ReadDataWithGUID(OrgID, ObjID, OrderID); string[] arr = obj.FieldNamesProperty; List<string> array = new List<string>(arr); string[] values = obj.FieldValuesProperty; List<string> valuearr = new List<string>(values); int counter = 0; order_obj = new Order(); for (int j = 0; j < array.Count; j++) { if (arr[j].ToString() == "OrderDate") { order_obj.OrderDate = Convert.ToDateTime(valuearr[counter].ToString()); } if (arr[j].ToString() == "DateLastUpdated") { order_obj.DateLastUpdated = Convert.ToDateTime(valuearr[counter].ToString()); } if (arr[j].ToString() == "Quantity") { order_obj.Quantity = Convert.ToInt32(valuearr[counter].ToString()); } if (arr[j].ToString() == "OrderStatus") { order_obj.OrderStatus = valuearr[counter].ToString(); } if (arr[j].ToString() == "ProductID") { order_obj.ProductID = Convert.ToInt32(valuearr[counter].ToString()); } counter++; } } return order_obj; }
public double Compute_Total_Price(int OrgID, int ProductID, int Quantity) { double total = 0.0; int BookObjID = 0; localhost.Service serviceObj = new localhost.Service(); localhost.Table[] Tarray = serviceObj.GetTables(OrgID); List<localhost.Table> listOfTables = new List<localhost.Table>(Tarray); for (int i = 0; i < listOfTables.Count; i++) { if (listOfTables[i].TNameProperty == "Book") { BookObjID = listOfTables[i].ObjIDProperty; } } localhost.TenantTableInfo obj = serviceObj.ReadDataWithGUID(OrgID, BookObjID, ProductID); string[] arr = obj.FieldNamesProperty; List<string> array = new List<string>(arr); string[] values = obj.FieldValuesProperty; List<string> valuearr = new List<string>(values); int counter = 0; for (int j = 0; j < array.Count; j++) { if (arr[j].ToString() == "Cost") { double cost = Convert.ToInt32(valuearr[counter].ToString()); total = cost * Quantity; return total; } counter++; } return total; }
protected void Page_Load(object sender, EventArgs e) { PreRender += new EventHandler(_Default_PreRender); if (!Page.IsPostBack) { int OrgID = (int)Session["orgID"]; Label1.Visible = false; Label2.Visible = false; textboxes = new List<TextBox>(); labels = new List<Label>(); localhost.Service serviceObj = new localhost.Service(); localhost.Table[] array = serviceObj.GetTables(OrgID); listOfTables = new List<localhost.Table>(array); ddl.DataSource = listOfTables; ddl.DataTextField = "TNameProperty"; ddl.DataValueField = "ObjIDProperty"; ddl.DataBind(); List<localhost.Field> fieldlist = new List<localhost.Field>(); if (ddl.SelectedIndex >= 0) { localhost.Table tableObj = listOfTables[ddl.SelectedIndex]; localhost.Field[] fields = serviceObj.ReadField((int)Session["orgID"], tableObj.ObjIDProperty); fieldlist = new List<localhost.Field>(fields); int count = fieldlist.Count; Table methodtable = new Table(); methodtable.Width = 500; methodtable.BorderStyle = BorderStyle.Solid; methodtable.BorderWidth = 5; methodtable.Caption = "Object Fields"; methodtable.HorizontalAlign = HorizontalAlign.Center; for (int i = 0; i < count; i++) { TableRow tr = new TableRow(); TableCell tc = new TableCell(); Label lb = new Label(); lb.ID = "lb" + i; lb.EnableViewState = true; lb.Text = fieldlist[i].FieldNameProperty + "::"; labels.Add(lb); tc.Controls.Add(lb); TableCell tc2 = new TableCell(); TextBox tb = new TextBox(); tb.ID = "tb" + i; tb.EnableViewState = true; tb.Text = Request.Form[tb.ClientID]; textboxes.Add(tb); tc2.Controls.Add(tb); tr.Controls.Add(tc); tr.Controls.Add(tc2); methodtable.Controls.Add(tr); } Panel1.Controls.Add(methodtable); Session["fieldlist"] = fieldlist; } } }
protected void Page_Load(object sender, EventArgs e) { PreRender += new EventHandler(CustomizeWorkflow_PreRender); lstipTextBoxes = new List<TextBox>(); lstMethodNames = new List<TextBox>(); if (!Page.IsPostBack) { ShowServices(); } string Methods; string Inputs; string[] MethodIDs = null; string[] Input = null; #region DataSourceBinding //Get methods for the workflow ID localhost.Service serviceObj = new localhost.Service(); localhost.TenantTableInfo obj = serviceObj.ReadDataWithGUID(11, 31, Convert.ToInt32(Session["WfID"])); string[] arr = obj.FieldNamesProperty; List<string> array = new List<string>(arr); string[] values = obj.FieldValuesProperty; List<string> valuearr = new List<string>(values); int counter = 0; defaultwrkflw.WfID = Convert.ToInt32(Session["WfID"]); for (int j = 0; j < array.Count; j++) { if (arr[j].ToString() == "wfname") { defaultwrkflw.WfName = valuearr[counter].ToString(); } if (arr[j].ToString() == "wfmethods") { Methods = valuearr[counter].ToString(); MethodIDs = Methods.Split(','); } if (arr[j].ToString() == "wfinputs") { Inputs = valuearr[counter].ToString(); Input = Inputs.Split(','); defaultwrkflw.Inputs = Input; } counter++; } foreach (var item in MethodIDs) { defaultwrkflw.Methods.Add(Convert.ToInt32(item)); obj = serviceObj.ReadDataWithGUID(11, 30, Int32.Parse(item)); arr = obj.FieldNamesProperty; array = new List<string>(arr); values = obj.FieldValuesProperty; valuearr = new List<string>(values); counter = 0; for (int j = 0; j < array.Count; j++) { if (arr[j].ToString() == "minput") { defaultwrkflw.InputParam.Add(valuearr[counter].ToString()); } if (arr[j].ToString() == "mname") { defaultwrkflw.MethodName.Add(valuearr[counter].ToString()); } if (arr[j].ToString() == "moutput") { defaultwrkflw.OutputParam.Add(valuearr[counter].ToString()); } counter++; } } obj = serviceObj.ReadData(11, 30); arr = obj.FieldNamesProperty; array = new List<string>(arr); values = obj.FieldValuesProperty; valuearr = new List<string>(values); int countRow = valuearr.Count / array.Count; counter = 0; int addrow = 0; for (int i = 0; i < countRow; i++) { AvailableServices serv = new AvailableServices(); addrow = 0; for (int j = 0; j < array.Count; j++) { if (arr[j].ToString() == "GUID") { serv.MethodId = Convert.ToInt32(valuearr[counter].ToString()); } if (arr[j].ToString() == "mname") { serv.MethodName = valuearr[counter].ToString(); } if (arr[j].ToString() == "minput") { serv.InputParam = valuearr[counter].ToString(); } if (arr[j].ToString() == "moutput") { serv.OutputParam = valuearr[counter].ToString(); } if (arr[j].ToString() == "ownerid") { if (Convert.ToInt32(valuearr[counter]) == 11 || Convert.ToInt32(valuearr[counter]) == Convert.ToInt32(Session["OrgId"])) { addrow = 1; } } counter++; } if (addrow > 0) { availservice.Add(serv); } } #endregion #region AddControls int methodcounter = 0; Panel2.Controls.Add(new LiteralControl("<br />")); Label work_label = new Label(); work_label.Text = defaultwrkflw.WfName + " Workflow Steps"; work_label.Font.Bold = true; work_label.Font.Size = 20; Panel2.Controls.Add(work_label); Panel2.Controls.Add(new LiteralControl("<br />")); Table methodtable = new Table(); methodtable.BorderStyle = BorderStyle.Solid; methodtable.BorderWidth = 5; methodtable.Font.Bold = true; methodtable.Font.Size = 10; methodtable.Attributes.Add("runat", "Server"); methodtable.ID = defaultwrkflw.Methods[methodcounter].ToString(); TableRow row = new TableHeaderRow(); var cell1 = new TableCell(); cell1.Text = "Service Name"; row.Cells.Add(cell1); cell1 = new TableCell(); cell1.Text = "Ouput Mapping"; row.Cells.Add(cell1); methodtable.Rows.Add(row); counter = 0; foreach (string item in defaultwrkflw.MethodName) { if (!item.Equals("")) { TableRow tr = new TableRow(); TableCell tc = new TableCell(); TableCell tc2 = new TableCell(); TextBox txtMethodName = new TextBox(); txtMethodName.Width = 350; txtMethodName.Text = item; TextBox txtInputParam = new TextBox(); txtInputParam.Text = defaultwrkflw.Inputs[counter++]; txtInputParam.Width = 50; lstipTextBoxes.Add(txtInputParam); lstMethodNames.Add(txtMethodName); tc.Controls.Add(txtMethodName); tc2.Controls.Add(txtInputParam); methodtable.Controls.Add(tr); tr.Controls.Add(tc); tr.Controls.Add(tc2); } } int methodcount = 10 - defaultwrkflw.MethodName.Count; while (methodcount > 0 ) { TableRow tr = new TableRow(); TableCell tc = new TableCell(); TableCell tc2 = new TableCell(); TextBox txtMethodName = new TextBox(); txtMethodName.Width = 350; txtMethodName.Text = ""; TextBox txtInputParam = new TextBox(); txtInputParam.Text = ""; txtInputParam.Width = 50; lstipTextBoxes.Add(txtInputParam); lstMethodNames.Add(txtMethodName); tc.Controls.Add(txtMethodName); tc2.Controls.Add(txtInputParam); methodtable.Controls.Add(tr); tr.Controls.Add(tc); tr.Controls.Add(tc2); methodcount--; } Panel2.Controls.Add(methodtable); #endregion }
protected void ShwField_Click(object sender, EventArgs e) { listOfTables = (List<localhost.Table>)ViewState["listOfTables"]; localhost.Table tableObj = listOfTables[ddl.SelectedIndex]; localhost.Service serviceObj = new localhost.Service(); localhost.Field[] array = serviceObj.ReadField((int)Session["orgID"], tableObj.ObjIDProperty); values = new List<localhost.Field>(array); DropDownList1.DataSource = values; DropDownList1.DataTextField = "FieldNameProperty"; DropDownList1.DataValueField = "FieldIDProperty"; DropDownList1.DataBind(); ViewState["listOfValues"] = values; }
private void InvokeWorkFlow(int workflow_id) { int id = 0; int nid = 0; String method_str = null; String ip_mapping_str = null; String workflowname = null; string inputparam_str = null; //Get methods for the workflow ID localhost.Service serviceObj = new localhost.Service(); localhost.TenantTableInfo obj = serviceObj.ReadDataWithGUID(11,31,workflow_id); string[] arr = obj.FieldNamesProperty; List<string> array = new List<string>(arr); string[] values = obj.FieldValuesProperty; List<string> valuearr = new List<string>(values); int counter = 0; for (int j = 0; j < array.Count; j++) { if (arr[j].ToString() == "wfname") { workflowname = valuearr[counter].ToString(); } if (arr[j].ToString() == "wfmethods") { method_str = valuearr[counter].ToString(); method_array = method_str.Split(','); } if (arr[j].ToString() == "wfinputs") { ip_mapping_str = valuearr[counter].ToString(); mapping_array = ip_mapping_str.Split(','); } counter++; } if (Convert.ToInt32(Session["next_index"]) == 0) { Session["next_index"] = 1; } Panel panel1 = new Panel(); panel1.Width = 520; panel1.HorizontalAlign = HorizontalAlign.Center; panel1.BackColor = System.Drawing.Color.Khaki; //panel1.BorderStyle = BorderStyle.Groove; Label wfname = new Label(); wfname.ForeColor = System.Drawing.Color.Black; wfname.Text = workflowname; wfname.Font.Bold = true; panel1.Controls.Add(wfname); form1.Controls.Add(panel1); form1.Controls.Add(new LiteralControl("<br />")); if (method_array != null) { for (int iter_methods = 0; iter_methods < method_array.Length; iter_methods++) { id = Convert.ToInt32(method_array[iter_methods]); if (iter_methods + 1 < method_array.Length) nid = Convert.ToInt32(method_array[iter_methods + 1]); else nid = 0; obj = serviceObj.ReadDataWithGUID(11, 30, id); arr = obj.FieldNamesProperty; array = new List<string>(arr); values = obj.FieldValuesProperty; valuearr = new List<string>(values); counter = 0; inputparam_str = ""; panel1 = new Panel(); panel1.Width = 520; panel1.BackColor = System.Drawing.Color.Khaki; panel1.BorderStyle = BorderStyle.Dashed; panel1.HorizontalAlign = HorizontalAlign.Center; for (int j = 0; j < array.Count; j++) { if (arr[j].ToString() == "mname") { Label methodname = new Label(); methodname.Font.Bold = true; methodname.Text = "Webservice : " + valuearr[counter].ToString(); panel1.Controls.Add(methodname); } if (arr[j].ToString() == "minput") { inputparam_str = valuearr[counter].ToString(); } counter++; } Table methodtable = new Table(); methodtable.Width = 500; methodtable.Attributes.Add("runat", "Server"); methodtable.ID = id.ToString(); methodtable.ToolTip = nid.ToString(); TableRow tr = new TableRow(); TableCell tc = new TableCell(); methodtable.Controls.Add(tr); if (inputparam_str != "") { int arg_count = 0; string[] inputp = inputparam_str.Split(' '); for (int ip = 0; ip < inputp.Length - 1; ip++) { string[] p = inputp[ip].Split(':'); tr = new TableRow(); tr.Font.Bold = true; tr.Font.Size = 10; tc = new TableCell(); Label paramname = new Label(); paramname.Text = p[0].ToString() + ":" + p[1].ToString(); tc.Controls.Add(paramname); tr.Controls.Add(tc); tc = new TableCell(); TextBox tb = new TextBox(); tb.Attributes.Add("runat", "Server"); tb.Attributes.Add("Tooltip", p[1].ToString()); tb.EnableViewState = true; tb.MaxLength = 128; tb.ID = "arg-" + id + "-" + arg_count; tc.Controls.Add(tb); tr.Controls.Add(tc); arg_count++; methodtable.Controls.Add(tr); } } tr = new TableRow(); tr.Font.Bold = true; TableCell cell = new TableCell(); Button btn = new Button(); btn.Text = "Invoke service"; /*Would like to pass value of i as argument to myFunction*/ btn.CommandArgument = id.ToString(); btn.Command += new CommandEventHandler(processMethodRequest); cell.Controls.Add(btn); tr.Controls.Add(cell); tr.Font.Bold = true; methodtable.Controls.Add(tr); tr = new TableRow(); methodtable.Controls.Add(tr); tr = new TableRow(); tr.Font.Bold = true; tc = new TableCell(); Label result_box = new Label(); result_box.Text = "Result"; tc.Controls.Add(result_box); tr.Controls.Add(tc); tc = new TableCell(); TextBox result_str = new TextBox(); result_str.Attributes.Add("runat", "Server"); result_str.EnableViewState = true; result_str.ID = "result-" + id.ToString(); tc.Controls.Add(result_str); tr.Controls.Add(tc); methodtable.Controls.Add(tr); panel1.Controls.Add(methodtable); form1.Controls.Add(panel1); if (iter_methods + 1 < method_array.Length) { panel1 = new Panel(); panel1.Width = 520; Image image = new Image(); image.ImageUrl = "../images/arrow_solid_down.png"; image.Height = 50; image.Attributes.Add("Style", "padding-left:250px;"); panel1.Controls.Add(image); form1.Controls.Add(panel1); } } } }
private void check_if_to_proceed(string curr_methodid) { string output = ""; string inputparam_str = ""; string methodname = ""; string wsdltext = ""; Table curr_table = form1.FindControl(curr_methodid) as Table; localhost.Service serviceObj = new localhost.Service(); localhost.TenantTableInfo obj = serviceObj.ReadDataWithGUID(11, 30, Int32.Parse(curr_methodid)); string[] arr = obj.FieldNamesProperty; List<string> array = new List<string>(arr); string[] values = obj.FieldValuesProperty; List<string> valuearr = new List<string>(values); int counter = 0; for (int j = 0; j < array.Count; j++) { if (arr[j].ToString() == "minput") { inputparam_str = valuearr[counter].ToString(); } if (arr[j].ToString() == "mname") { methodname = valuearr[counter].ToString(); } if (arr[j].ToString() == "wsdl") { wsdltext = valuearr[counter].ToString(); } counter++; } if (inputparam_str != "") { string[] inputp = inputparam_str.Split(' '); object[] param1 = new object[inputp.Length - 1]; for (int ip = 0; ip < inputp.Length - 1; ip++) { string[] p = inputp[ip].Split(':'); try { if (String.Compare(p[1].Substring(0, 6), "System.") != 0) { p[1] = "System." + p[1]; } } catch (Exception eexc) { p[1] = "System." + p[1]; } TextBox txt_box = curr_table.FindControl("arg-" + curr_methodid + "-" + ip.ToString()) as TextBox; param1[ip] = Convert.ChangeType(txt_box.Text, System.Type.GetType(p[1])); } output = InvokeMethod(wsdltext, methodname, param1); } else { output = InvokeMethod(wsdltext, methodname, null); } if (output != null) { int mapped_flag = 0; //Display result in current method result box TextBox resultbox = curr_table.FindControl("result-" + curr_methodid) as TextBox; resultbox.Text = output; //Check if we need to map the output to next method int index = Convert.ToInt32(Session["next_index"]); if (index < method_array.Length) { if (Convert.ToInt32(mapping_array[index]) != 0) { int arg = Convert.ToInt32(mapping_array[index]) - 1; TextBox next_param = curr_table.FindControl("arg-" + curr_table.ToolTip + "-" + arg.ToString()) as TextBox; next_param.Text = output; mapped_flag = 1; } Session["next_index"] = index + 1; } else { Session["next_index"] = 0; } string[] nextp = null; if (Int32.Parse(curr_table.ToolTip) > 0) { obj = serviceObj.ReadDataWithGUID(11, 30, Int32.Parse(curr_table.ToolTip)); arr = obj.FieldNamesProperty; array = new List<string>(arr); values = obj.FieldValuesProperty; valuearr = new List<string>(values); counter = 0; for (int j = 0; j < array.Count; j++) { if (arr[j].ToString() == "minput") { inputparam_str = valuearr[counter].ToString(); } if (arr[j].ToString() == "mname") { methodname = valuearr[counter].ToString(); } if (arr[j].ToString() == "wsdl") { wsdltext = valuearr[counter].ToString(); } counter++; } } if (inputparam_str != "") { nextp = inputparam_str.Split(' '); } if (nextp != null && (nextp.Length - 1) == 1 && mapped_flag == 1) { check_if_to_proceed(curr_table.ToolTip); } else if (nextp == null && index != (method_array.Length - 1)) { check_if_to_proceed(curr_table.ToolTip); } } }
void ddl_SelectedIndexChanged(object sender, EventArgs e) { if (ddl.SelectedIndex > 0) { localhost.Table tableObj = listOfTables[ddl.SelectedIndex]; localhost.Service serviceObj = new localhost.Service(); localhost.Field[] array = serviceObj.ReadField((int)Session["orgID"], tableObj.ObjIDProperty); values = new List<localhost.Field>(array); DropDownList1.DataSource = values; DropDownList1.DataTextField = "FieldNameProperty"; DropDownList1.DataValueField = "FieldIDProperty"; DropDownList1.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { localhost.Service serviceObj = new localhost.Service(); int orgID = (int)Session["orgID"]; int objID = (int)Session["objID"]; localhost.Field[] array = serviceObj.ReadField(orgID, objID); FieldList = new List<localhost.Field>(array); DropDownList1.DataSource = FieldList; DropDownList1.DataTextField = "FieldNameProperty"; DropDownList1.DataValueField = "FieldIDProperty"; DropDownList1.DataBind(); Label4.Visible = false; Label3.Visible = false; }
public int bill_to_card_displayConfirmation(int OrgID,int CustomerID,int ProductID,int Quantity,double price) { try { bool success = false; Order order_obj = new Order(); int CustomerObjID = 0; int OrderObjID = 0; localhost.Service serviceObj = new localhost.Service(); localhost.Table[] Tarray = serviceObj.GetTables(OrgID); List<localhost.Table> listOfTables = new List<localhost.Table>(Tarray); for (int i = 0; i < listOfTables.Count; i++) { if (listOfTables[i].TNameProperty == "Customer") { CustomerObjID = listOfTables[i].ObjIDProperty; } if (listOfTables[i].TNameProperty == "Order") { OrderObjID = listOfTables[i].ObjIDProperty; } } if (CustomerObjID != 0) { localhost.TenantTableInfo obj = serviceObj.ReadDataWithGUID(OrgID, CustomerObjID, CustomerID); string[] arr = obj.FieldNamesProperty; List<string> array = new List<string>(arr); string[] values = obj.FieldValuesProperty; List<string> valuearr = new List<string>(values); int counter = 0; for (int j = 0; j < array.Count; j++) { if (arr[j].ToString() == "Ship_FirstName") { order_obj.Ship_FirstName = valuearr[counter].ToString(); } if (arr[j].ToString() == "Ship_LastName") { order_obj.Ship_LastName = valuearr[counter].ToString(); } if (arr[j].ToString() == "Ship_phone") { order_obj.Ship_phone = valuearr[counter].ToString(); } if (arr[j].ToString() == "Ship_postalcode") { order_obj.Ship_postalcode = valuearr[counter].ToString(); } if (arr[j].ToString() == "Ship_AddressLine1") { order_obj.Ship_AddressLine1 = valuearr[counter].ToString(); } if (arr[j].ToString() == "Ship_AddressLine2") { order_obj.Ship_AddressLine2 = valuearr[counter].ToString(); } counter++; } order_obj.ProductID = ProductID; order_obj.Quantity = Quantity; order_obj.OrderStatus = "Billed"; order_obj.OrderDate = DateTime.Now; order_obj.DateLastUpdated = DateTime.Now; List<String> fieldnames = new List<String>(); fieldnames.Add("0"); fieldnames.Add("1"); fieldnames.Add("2"); fieldnames.Add("3"); fieldnames.Add("4"); fieldnames.Add("5"); fieldnames.Add("6"); fieldnames.Add("7"); fieldnames.Add("8"); fieldnames.Add("9"); fieldnames.Add("10"); fieldnames.Add("11"); fieldnames.Add("12"); List<String> valueNames = new List<String>(); valueNames.Add(order_obj.ProductID.ToString()); valueNames.Add(order_obj.Quantity.ToString()); valueNames.Add(order_obj.OrderDate.ToString()); valueNames.Add(order_obj.DateLastUpdated.ToString()); valueNames.Add(order_obj.OrderStatus.ToString()); valueNames.Add(order_obj.Ship_FirstName.ToString()); valueNames.Add(order_obj.Ship_LastName.ToString()); valueNames.Add(order_obj.Ship_AddressLine1.ToString()); valueNames.Add(order_obj.Ship_AddressLine2.ToString()); valueNames.Add(order_obj.Ship_phone.ToString()); valueNames.Add(order_obj.Ship_postalcode.ToString()); valueNames.Add(order_obj.Price.ToString()); valueNames.Add(CustomerID.ToString()); int custorderID = 0; success = serviceObj.InsertData(OrgID, OrderObjID, "Order-Instance-" + OrgID.ToString(), fieldnames.ToArray(), valueNames.ToArray()); if (success) { obj = serviceObj.ReadData(OrgID, OrderObjID); arr = obj.FieldNamesProperty; array = new List<string>(arr); values = obj.FieldValuesProperty; valuearr = new List<string>(values); int countRow = valuearr.Count / array.Count; counter = 0; for (int i = 0; i < countRow; i++) { for (int j = 0; j < array.Count; j++) { if (arr[j].ToString() == "GUID") { custorderID = Convert.ToInt32(valuearr[counter].ToString()); } counter++; } } return custorderID; } else { return custorderID; } } else { return 0; } } catch (Exception ex) { throw; } }
protected void CreateTable_Click(object sender, EventArgs e) { List<string> FieldNames = new List<string>(); List<string> DataTypes = new List<string>(); list = (List<ListOfItems>)GridView1.DataSource; //GridView1.DataSource = list; //GridView1.DataBind(); foreach (TableRow item in GridView1.Rows) { TextBox txtName = (TextBox)item.Cells[0].FindControl("TextBox1"); FieldNames.Add(txtName.Text); TextBox txtdata = (TextBox)item.Cells[1].FindControl("txtData"); if (txtdata.Text == "int" || txtdata.Text == "nvarchar(MAX)" || txtdata.Text == "float") DataTypes.Add(txtdata.Text); else { Label2.Visible=true; return; } } localhost.Service serviceObj = new localhost.Service(); int objid = -1; int counter = 0; bool flag = false; if( TextBox2.Text != "") { foreach (string item in FieldNames) { if(TextBox2.Text == item ) { string[] arrayfields = FieldNames.ToArray(); string[] arraydatatype = DataTypes.ToArray(); objid = serviceObj.CreateObject((int)Session["orgID"], txt1.Text,arrayfields, arraydatatype,counter); flag = true; break; } counter++; } } if( flag == false && TextBox2.Text == "") objid = serviceObj.CreateObject((int)Session["orgID"], txt1.Text, FieldNames.ToArray(), DataTypes.ToArray(),-1); if (objid < 0) Label1.Visible = true; else { Session["objID"] = objid; Response.Redirect("AddRelationships.aspx"); } }
protected void Button2_Click(object sender, EventArgs e) { if (ddl.SelectedIndex >= 0) { int OrgID = (int)Session["orgID"]; int index_sel = ddl.SelectedIndex; List<string> fieldnames = new List<string>(); List<string> valueNames = new List<string>(); Label1.Visible = false; Label2.Visible = false; localhost.Service serviceObj = new localhost.Service(); localhost.Table tableObj = listOfTables[index_sel]; textboxes = new List<TextBox>(); labels = new List<Label>(); fieldlist = (List<localhost.Field>)Session["fieldlist"]; int count = fieldlist.Count; Table methodtable = new Table(); methodtable.Width = 500; methodtable.BorderStyle = BorderStyle.Solid; methodtable.BorderWidth = 5; methodtable.Caption = "Object Fields"; methodtable.HorizontalAlign = HorizontalAlign.Center; for (int i = 0; i < count; i++) { TableRow tr = new TableRow(); TableCell tc = new TableCell(); Label lb = new Label(); lb.ID = "lb" + i; lb.EnableViewState = true; lb.Text = fieldlist[i].FieldNameProperty + "::"; labels.Add(lb); tc.Controls.Add(lb); TableCell tc2 = new TableCell(); TextBox tb = new TextBox(); tb.ID = "tb" + i; tb.EnableViewState = true; tb.Text = Request.Form[tb.ClientID]; textboxes.Add(tb); tc2.Controls.Add(tb); tr.Controls.Add(tc); tr.Controls.Add(tc2); methodtable.Controls.Add(tr); } Panel1.Controls.Add(methodtable); if (fieldlist != null) { count = 0; foreach (TextBox item in textboxes) { valueNames.Add(item.Text); } foreach (localhost.Field item in fieldlist) { fieldnames.Add(count.ToString()); count++; } bool success = serviceObj.InsertData((int)Session["orgID"], tableObj.ObjIDProperty, "", fieldnames.ToArray(), valueNames.ToArray()); if (success) Label1.Visible = true; else Label2.Visible = true; } } }