public void formfill(string empid) { FormView1.DataSource = d.formfill(empid); FormView1.DataBind(); }
protected void DynamicFilter_FilterChanged(object sender, EventArgs e) { GridView1.EditIndex = -1; GridView1.PageIndex = 0; FormView1.ChangeMode(FormViewMode.ReadOnly); }
protected void GridView1_SelectedIndexChanging(object sender, EventArgs e) { GridView1.EditIndex = -1; FormView1.ChangeMode(FormViewMode.ReadOnly); }
protected void RadListView1_ItemCommand(object sender, RadListViewCommandEventArgs e) { try { if (e.CommandName == "PerformInsert") { var item = e.ListViewItem; var FileImageName = (RadUpload)item.FindControl("FileImageName"); var strProjectCategoryTitle = ((Label)FormView1.FindControl("lblProjectCategoryTitle")).Text.Trim(); var strConvertedProjectCategoryName = Common.ConvertTitle(strProjectCategoryTitle); var strImageName = FileImageName.UploadedFiles.Count > 0 ? FileImageName.UploadedFiles[0].GetName() : ""; var strTitle = ((TextBox)item.FindControl("txtTitle")).Text.Trim(); var strDescription = ((TextBox)item.FindControl("txtDescription")).Text.Trim(); var strTitleEn = ((TextBox)item.FindControl("txtTitleEn")).Text.Trim(); var strDescriptionEn = ((TextBox)item.FindControl("txtDescriptionEn")).Text.Trim(); var strTitleCam = ((TextBox)item.FindControl("txtTitleCam")).Text.Trim(); var strDescriptionCam = ((TextBox)item.FindControl("txtDescriptionCam")).Text.Trim(); var IsAvailable = ((CheckBox)item.FindControl("chkAddIsAvailable")).Checked.ToString(); var IsBackground = ((CheckBox)item.FindControl("chkIsBackground")).Checked.ToString(); var Priority = ((RadNumericTextBox)item.FindControl("txtPriority")).Text.Trim(); var oProjectCategoryImage = new ProjectCategoryImage(); strImageName = oProjectCategoryImage.ProjectCategoryImageInsert( strImageName, strConvertedProjectCategoryName, strTitle, strDescription, strTitleEn, strDescriptionEn, strTitleCam, strDescriptionCam, Request.QueryString["PI"], IsAvailable, Priority, IsBackground); string strFullPath = "~/res/projectcategory/album/" + strImageName; if (!string.IsNullOrEmpty(strImageName)) { FileImageName.UploadedFiles[0].SaveAs(Server.MapPath(strFullPath)); //ResizeCropImage.ResizeByCondition(strFullPath, 600, 600); //ResizeCropImage.CreateThumbNailByCondition("~/res/projectcategory/album/", "~/res/projectcategory/album/thumbs/", strImageName, 120, 120); } RadListView1.InsertItemPosition = RadListViewInsertItemPosition.None; } else if (e.CommandName == "Update") { var item = e.ListViewItem; var FileImageName = (RadUpload)item.FindControl("FileImageName"); var dsUpdateParam = ObjectDataSource1.UpdateParameters; var strProjectCategoryImageID = ((HiddenField)e.ListViewItem.FindControl("hdnProjectCategoryImageID")).Value; var strProjectCategoryTitle = ((Label)FormView1.FindControl("lblProjectCategoryTitle")).Text.Trim(); var strConvertedProjectCategoryName = Common.ConvertTitle(strProjectCategoryTitle); var strImageName = FileImageName.UploadedFiles.Count > 0 ? FileImageName.UploadedFiles[0].GetName() : ""; var strOldImageName = ((HiddenField)e.ListViewItem.FindControl("hdnImageName")).Value; var strIsAvailable = ((CheckBox)item.FindControl("chkAddIsAvailable")).Checked.ToString(); var strIsBackground = ((CheckBox)item.FindControl("chkIsBackground")).Checked.ToString(); dsUpdateParam["ImageName"].DefaultValue = strImageName; dsUpdateParam["ConvertedProjectCategoryName"].DefaultValue = strConvertedProjectCategoryName; dsUpdateParam["IsAvailable"].DefaultValue = strIsAvailable; dsUpdateParam["IsBackground"].DefaultValue = strIsBackground; if (!string.IsNullOrEmpty(strImageName)) { var strOldImagePath = Server.MapPath("~/res/projectcategory/album/" + strOldImageName); var strOldThumbImagePath = Server.MapPath("~/res/projectcategory/album/thumbs/" + strOldImageName); if (File.Exists(strOldImagePath)) { File.Delete(strOldImagePath); } if (File.Exists(strOldThumbImagePath)) { File.Delete(strOldThumbImagePath); } strImageName = (string.IsNullOrEmpty(strConvertedProjectCategoryName) ? "" : strConvertedProjectCategoryName + "-") + strProjectCategoryImageID + strImageName.Substring(strImageName.LastIndexOf('.')); string strFullPath = "~/res/projectcategory/album/" + strImageName; FileImageName.UploadedFiles[0].SaveAs(Server.MapPath(strFullPath)); //ResizeCropImage.ResizeByCondition(strFullPath, 600, 600); //ResizeCropImage.CreateThumbNailByCondition("~/res/projectcategory/album/", "~/res/projectcategory/album/thumbs/", strImageName, 120, 120); } } else if (e.CommandName == "Delete") { var strOldImageName = ((HiddenField)e.ListViewItem.FindControl("hdnImageName")).Value; DeleteImage(strOldImageName); } else if (e.CommandName == "QuickUpdate") { string ProjectCategoryImageID, Priority, IsAvailable, IsBackground; var oProjectCategoryImage = new ProjectCategoryImage(); foreach (RadListViewDataItem item in RadListView1.Items) { ProjectCategoryImageID = item.GetDataKeyValue("ProjectCategoryImageID").ToString(); Priority = ((RadNumericTextBox)item.FindControl("txtPriority")).Text.Trim(); IsAvailable = ((CheckBox)item.FindControl("chkIsAvailable")).Checked.ToString(); IsBackground = ((CheckBox)item.FindControl("chkIsBackground")).Checked.ToString(); oProjectCategoryImage.ProjectCategoryImageQuickUpdate( ProjectCategoryImageID, IsAvailable, Priority, IsBackground ); } } else if (e.CommandName == "DeleteSelected") { var oProjectCategoryImage = new ProjectCategoryImage(); string ProjectCategoryImageID, OldImageName; foreach (RadListViewDataItem item in RadListView1.Items) { var chkSelect = (CheckBox)item.FindControl("chkSelect"); if (chkSelect.Checked) { ProjectCategoryImageID = item.GetDataKeyValue("ProjectCategoryImageID").ToString(); OldImageName = ((HiddenField)item.FindControl("hdnImageName")).Value; DeleteImage(OldImageName); oProjectCategoryImage.ProjectCategoryImageDelete(ProjectCategoryImageID); } } } RadListView1.Rebind(); } catch (Exception ex) { lblError.Text = ex.Message; } }
protected void EventList_SelectedIndexChanged(object sender, EventArgs e) { //Queries Relevant to home page, fetching event info student info and more String sqlQuery = "Select EventName, Time, FORMAT(Date,'dd/MM/yyyy') as Date, RoomNbr from Event where EventID = " + EventList.SelectedItem.Value; String sqlQuery1 = "SELECT Student.FirstName +' ' + Student.LastName as StudentName, Student.TeacherID from Student " + "inner join Teacher on Student.TeacherID = Teacher.TeacherID " + "inner join EventAttendanceList on EventAttendanceList.TeacherID = Teacher.TeacherID " + "where EventAttendanceList.EventID = " + EventList.SelectedItem.Value; String sqlQuery2 = "select EventPersonnel.FirstName +' ' + EventPersonnel.LastName as VolunteerName, EventPersonnel.PersonnelType from EventPresenters " + "inner join EventPersonnel on EventPersonnel.VolunteerID = EventPresenters.PersonnelID where EventPresenters.Role = 'Volunteer' and EventPresenters.EventID = " + EventList.SelectedItem.Value; String sqlQuery3 = "select EventPersonnel.FirstName + ' ' + EventPersonnel.LastName as CoordinatorName from EventPresenters " + "inner join EventPersonnel on EventPersonnel.VolunteerID = EventPresenters.PersonnelID where EventPresenters.Role = 'Coordinator' and EventPresenters.EventID = " + EventList.SelectedItem.Value; //Get connection string from web.config file string strcon = ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString; //create new sqlconnection and connection to database by using connection string from web.config file SqlConnection con = new SqlConnection(strcon); con.Open(); SqlDataAdapter sqlAdapter = new SqlDataAdapter(sqlQuery, con); SqlDataAdapter sqlAdapter1 = new SqlDataAdapter(sqlQuery1, con); SqlDataAdapter sqlAdapter2 = new SqlDataAdapter(sqlQuery2, con); var items = new List <string>(); using (SqlCommand command = new SqlCommand(sqlQuery2, con)) { using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { //Read info into List items.Add(reader.GetString(0)); } } } rep1.DataSource = items; rep1.DataBind(); //Fill table with data DataTable dt = new DataTable(); sqlAdapter1.Fill(dt); var items1 = new List <string>(); using (SqlCommand command = new SqlCommand(sqlQuery3, con)) { using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { //Read info into List items1.Add(reader.GetString(0)); } } } CoordinatorRepeater.DataSource = items1; CoordinatorRepeater.DataBind(); //Fill table with data DataTable dt2 = new DataTable(); sqlAdapter2.Fill(dt2); if (dt.Rows.Count > 0) { ListBox1.DataSource = dt; ListBox1.DataTextField = "StudentName"; ListBox1.DataBind(); } DataSet ds = new DataSet(); sqlAdapter.Fill(ds); FormView1.DataSource = ds; FormView1.DataBind(); con.Close(); }
protected void BTN_CustomerIDSerach_INSERT_Click(object sender, EventArgs e) { if (((TextBox)FormView1.FindControl("TXT_CUSTOMER_ID_INSERT")).Text.Trim().Length > 0 || ((TextBox)FormView1.FindControl("TXT_CUSTOMER_ID_INSERT")).Text != "") { DataSet ds = new DataSet(); ds = lov.Get_RPS_SP_Customer_GetByCode(((TextBox)FormView1.FindControl("TXT_CUSTOMER_ID_INSERT")).Text); /* set lov of Province */ if (ds.Tables[0].Rows.Count > 0) { Session["SPDS_ProductArrangement_CustomerID"] = ds.Tables[0].Rows[0]["ID"].ToString(); CustomerID = ds.Tables[0].Rows[0]["ID"].ToString(); ((TextBox)FormView1.FindControl("TXT_CUSTOMER_ID_INSERT")).Text = ds.Tables[0].Rows[0]["BankCode"].ToString(); ((TextBox)FormView1.FindControl("TXT_CustomerName_INSERT")).Text = ds.Tables[0].Rows[0]["BankName"].ToString(); } else { ((TextBox)FormView1.FindControl("TXT_CUSTOMER_ID_INSERT")).Text = null; ((TextBox)FormView1.FindControl("TXT_CustomerName_INSERT")).Text = null; ((TextBox)FormView1.FindControl("TXT_CUSTOMER_ID_INSERT")).Focus(); ((RequiredFieldValidator)FormView1.FindControl("REQ_CUSTOMER_ID_INSERT")).Validate(); ((TextBox)FormView1.FindControl("TXT_CUSTOMER_ID_INSERT")).Focus(); } } else { ((TextBox)FormView1.FindControl("TXT_CUSTOMER_ID_INSERT")).Text = null; ((TextBox)FormView1.FindControl("TXT_CustomerName_INSERT")).Text = null; ((TextBox)FormView1.FindControl("TXT_CUSTOMER_ID_INSERT")).Focus(); } }
protected void BTN_CategoryIDSearch_INSERT_Click(object sender, EventArgs e) { if (((TextBox)FormView1.FindControl("TXT_CATEGORY_ID_INSERT")).Text.Trim().Length > 0 || ((TextBox)FormView1.FindControl("TXT_CATEGORY_ID_INSERT")).Text != "") { DataSet ds = new DataSet(); ds = lov.Get_SPDS_SignatoryCategorySetup_SPC(((TextBox)FormView1.FindControl("TXT_CATEGORY_ID_INSERT")).Text); if (ds.Tables[0].Rows.Count > 0) { CategoryID = ds.Tables[0].Rows[0]["ID"].ToString(); ((TextBox)FormView1.FindControl("TXT_CATEGORY_ID_INSERT")).Text = ds.Tables[0].Rows[0]["ID"].ToString(); ((TextBox)FormView1.FindControl("TXT_CATEGORY_Name_INSERT")).Text = ds.Tables[0].Rows[0]["CATEGORY_NAME"].ToString(); ((TextBox)FormView1.FindControl("TXT_FROMLIMIT_INSERT")).Text = ds.Tables[0].Rows[0]["FROM_LIMIT"].ToString(); ((TextBox)FormView1.FindControl("TXT_TOLIMIT_INSERT")).Text = ds.Tables[0].Rows[0]["TO_LIMIT"].ToString(); } else { ((TextBox)FormView1.FindControl("TXT_CATEGORY_ID_INSERT")).Text = null; ((TextBox)FormView1.FindControl("TXT_CATEGORY_Name_INSERT")).Text = null; ((TextBox)FormView1.FindControl("TXT_CATEGORY_ID_INSERT")).Focus(); ((TextBox)FormView1.FindControl("TXT_FROMLIMIT_INSERT")).Text = null; ((TextBox)FormView1.FindControl("TXT_TOLIMIT_INSERT")).Text = null; ((RequiredFieldValidator)FormView1.FindControl("REQ_CATEGORY_ID_INSERT")).Validate(); ((TextBox)FormView1.FindControl("TXT_CATEGORY_ID_INSERT")).Focus(); } } else { ((TextBox)FormView1.FindControl("TXT_CATEGORY_ID_INSERT")).Text = null; ((TextBox)FormView1.FindControl("TXT_CATEGORY_Name_INSERT")).Text = null; ((TextBox)FormView1.FindControl("TXT_FROMLIMIT_INSERT")).Text = null; ((TextBox)FormView1.FindControl("TXT_TOLIMIT_INSERT")).Text = null; ((TextBox)FormView1.FindControl("TXT_CATEGORY_ID_INSERT")).Focus(); } }
protected void Page_Load(object sender, EventArgs e) { HiddenField1.Value = LoginName1.Page.User.Identity.Name; this.Form.DefaultButton = ((LinkButton)FormView1.FindControl("UpdateButton")).UniqueID; }
private void Continue() { FormView1.DataSource = messagelist; FormView1.DataBind(); }
protected void fillformview() { DataSet ds; Label lbl; int len; string couponid = ""; string cno, cno1; string OrderNo = Request.QueryString["ID"].ToString(); string userid = Request.QueryString["userid"].ToString(); float tax_shipping = 0F; int userno = 0; string test = "select O.*,O.ShippingCharge as OrdShipCharg,O.salestax as TaxAmount from " + customUtility.DBPrefix + "order O inner join " + customUtility.DBPrefix + "orderdetail OD on O.orderno=OD.orderno where O.OrderNo='" + OrderNo + "'"; ds = customUtility.GetTableData(test); if (ds.Tables[0].Rows.Count > 0) { FormView1.DataSource = ds; FormView1.DataBind(); string getuserfromorder = "select userno from " + customUtility.DBPrefix + "order where orderno='" + OrderNo + "'"; DataSet dsuserorder = customUtility.GetTableData(getuserfromorder); if (dsuserorder.Tables[0].Rows.Count > 0) { userno = Convert.ToInt32(dsuserorder.Tables[0].Rows[0]["userno"].ToString()); string getuserinfo = "select email from " + customUtility.DBPrefix + "memberlist where id=" + userno; DataSet dsgetuserinfo = customUtility.GetTableData(getuserinfo); if (dsgetuserinfo.Tables[0].Rows.Count > 0) { lbl = (Label)FormView1.FindControl("lblemail"); lbl.Text = dsgetuserinfo.Tables[0].Rows[0]["email"].ToString(); } else { lblMsg.Visible = true; lblMsg.Text = "User account has been deleted by the admin."; } } Label lblPurchaseOrder = (Label)FormView1.FindControl("lblPurchaseOrder"); string getPurchaseOrder = "select PurchaseOrder from " + customUtility.DBPrefix + "order where orderno='" + OrderNo + "'"; DataSet dsPurchaseOrder = customUtility.GetTableData(getPurchaseOrder); if (dsPurchaseOrder.Tables[0].Rows.Count > 0) { if (dsPurchaseOrder.Tables[0].Rows[0]["PurchaseOrder"].ToString() != "") { lblPurchaseOrder.Text = dsPurchaseOrder.Tables[0].Rows[0]["PurchaseOrder"].ToString(); } else { lblPurchaseOrder.Text = "None"; } } couponid = ds.Tables[0].Rows[0]["DiscountcouponID"].ToString(); Label lblispaid = (Label)FormView1.FindControl("lblispaid"); if (ds.Tables[0].Rows[0]["Ispaid"].ToString().ToLower().Equals("true")) { lblispaid.Text = "Yes"; } else { lblispaid.Text = "No"; } Label lbltotalamount = (Label)FormView1.FindControl("lbltotalamount"); Label lblTax = (Label)FormView1.FindControl("lblTax"); if (!String.IsNullOrEmpty(ds.Tables[0].Rows[0]["TaxAmount"].ToString())) { tax_shipping = Convert.ToSingle(ds.Tables[0].Rows[0]["TaxAmount"]) + Convert.ToSingle(ds.Tables[0].Rows[0]["OrdShipCharg"]); } // code for coupon info //FormView fv_coupon = (FormView)FormView1.FindControl("frmcoupon"); //if (couponid != null && !couponid.Equals("")) //{ // ds = customUtility.GetTableData("select * from " + customUtility.DBPrefix + "individualcoupon where couponid=" + couponid); // if (ds.Tables[0].Rows.Count > 0) // { // fv_coupon.DataSource = ds; // fv_coupon.DataBind(); // Label lbldiscountamount = (Label)fv_coupon.FindControl("lbldiscountamount"); // Label lblcoupontype = (Label)fv_coupon.FindControl("lblcoupontype"); // if (ds.Tables[0].Rows[0]["CouponType"].ToString().ToLower().Equals("individual")) // lblcoupontype.Text = "Individual Coupon"; // else if (ds.Tables[0].Rows[0]["CouponType"].ToString().ToLower().Equals("freeship")) // lblcoupontype.Text = "Free Shiping Coupon"; // else if (ds.Tables[0].Rows[0]["CouponType"].ToString().ToLower().Equals("giftcertificate")) // lblcoupontype.Text = "Gift Certificate"; // if (ds.Tables[0].Rows[0]["discountmode"].ToString().ToLower().Equals("percent")) // lbldiscountamount.Text = ds.Tables[0].Rows[0]["discountamt"].ToString() + " %"; // else // { // lbldiscountamount.Text = String.Format("{0:c}", ds.Tables[0].Rows[0]["discountamt"]); // } // } // else // { // FormView1.FindControl("trcoupon").Visible = false; // FormView1.FindControl("trhrrol").Visible = false; // } //} //else //{ // FormView1.FindControl("trcoupon").Visible = false; // FormView1.FindControl("trhrrol").Visible = false; //} //code for billing info DataSet dsbillinfo; dsbillinfo = customUtility.GetTableData("select ml.*,(select Country from " + customUtility.DBPrefix + "Country where id=ml.Country)Countryname from " + customUtility.DBPrefix + "billinfo ml where OrderNo='" + OrderNo + "'"); FormView fv_bill = (FormView)FormView1.FindControl("FormView_billing"); if (dsbillinfo.Tables[0].Rows.Count > 0) { fv_bill.Visible = true; fv_bill.DataSource = dsbillinfo; fv_bill.DataBind(); Label lblstatebill = (Label)fv_bill.FindControl("lblstatebill"); //if(!dsbillinfo.Tables[0].Rows[0]["country"].ToString().Equals("254")) // lblstatebill.Text = dsbillinfo.Tables[0].Rows[0]["bilother"].ToString(); } else { fv_bill.Visible = false; } //code for shipping info ds = customUtility.GetTableData("select * from " + customUtility.DBPrefix + "shippinfo where OrderNo='" + OrderNo + "'"); FormView fv_shipp = (FormView)FormView1.FindControl("FormView_Shipping"); if (ds.Tables[0].Rows.Count > 0) { fv_shipp.DataSource = ds; fv_shipp.DataBind(); Label lblctship = (Label)fv_shipp.FindControl("lblcountryship"); Label lblshipingstate = (Label)fv_shipp.FindControl("lblshipingstate"); if (ds.Tables[0].Rows[0]["state"].ToString() == "Others") { lblshipingstate.Text = ds.Tables[0].Rows[0]["Province"].ToString(); } Label lblfedex = (Label)fv_shipp.FindControl("lblfedex"); if (ds.Tables[0].Rows[0]["fedexaccountnumber"].ToString() == null || ds.Tables[0].Rows[0]["fedexaccountnumber"].ToString() == "") { lblfedex.Visible = false; } string countryname; countryname = customUtility.GetFieldName(ds.Tables[0].Rows[0]["Country"].ToString(), "country", "country", "id", customUtility.CompareType.text, ""); lblctship.Text = countryname; } else { fv_shipp.Visible = false; } //code for Hear From //DataSet dh = customUtility.GetTableData("select source from " + customUtility.DBPrefix + "hearfrom where userid='" + userid + "'"); //Repeater rpthear = (Repeater)FormView1.FindControl("rpthear"); //rpthear.DataSource = dh; //rpthear.DataBind(); ////code for purchase items ds = customUtility.GetTableData("select *,(select productname from " + customUtility.DBPrefix + "product where id in (select productid from " + customUtility.DBPrefix + "catalog where id=" + customUtility.DBPrefix + "orderdetail.productid)) as prodname from " + customUtility.DBPrefix + "orderdetail where OrderNo='" + OrderNo + "'"); GridView GV; GV = (GridView)FormView1.FindControl("GridView1"); if (ds.Tables[0].Rows.Count > 0) { GV.DataSource = ds; GV.DataBind(); } else { GV.Visible = false; } //<a href="#" onclick="javascript:window.open('PrintOrder.aspx?ID=<%=Request.QueryString["ID"].ToString() %> &uid=<%=Request.QueryString["userid"].ToString() %>','OrderDetails','width=600,height=600,scrollbars=yes,toolbar=no,top=100,left=100')">Print Order</a> hyprint.NavigateUrl = "javascript:window.open('PrintOrder.aspx?ID=" + Request.QueryString["ID"].ToString() + "&userid=" + Request.QueryString["userid"].ToString() + "','OrderDetails','width=600,height=600,scrollbars=yes,toolbar=no,top=50,left=100');void(0);"; } }
protected void Wizard2_FinishButtonClick(object sender, WizardNavigationEventArgs e) { FormView1.InsertItem(false); }
protected void Page_Init(object sender, EventArgs e) { table = DynamicDataRouteHandler.GetRequestMetaTable(Context); FormView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context)); DetailsDataSource.EntityTypeName = table.EntityType.AssemblyQualifiedName; }
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { FormView1.ChangeMode(FormViewMode.Edit); FormView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { FormView1.ChangeMode(FormViewMode.Insert); }
protected void UserRequestTypeIDTextBox_SelectedIndexChanged(object sender, EventArgs e) { DropDownList lUserRequestTypeIDTextBox = (DropDownList)FormView1.FindControl("UserRequestTypeIDTextBox"); Class1 cs = new Class1(); RequiredFieldValidator RequiredFieldValidator9 = (RequiredFieldValidator)FormView1.FindControl("RequiredFieldValidator9"); RequiredFieldValidator RequiredFieldValidator10 = (RequiredFieldValidator)FormView1.FindControl("RequiredFieldValidator10"); if (Convert.ToBoolean(cs.AnyFieldFromFormType(Convert.ToInt32(lUserRequestTypeIDTextBox.SelectedValue), "IsLimitsRequired"))) { RequiredFieldValidator9.ValidationGroup = "InsertApp"; RequiredFieldValidator10.ValidationGroup = "InsertApp"; EnableLimits(); } else { RequiredFieldValidator9.ValidationGroup = ""; RequiredFieldValidator10.ValidationGroup = ""; DisableLimits(); } }
protected void GridView1_SelectedIndexChanged1(object sender, EventArgs e) { GridViewRow row = GridView1.SelectedRow; string a = row.Cells[0].Text; Session["cid"] = Convert.ToInt32(a); try { SqlConnection con = new SqlConnection(); con.ConnectionString = @"Data Source=DESKTOP-R083DVH\SQLEXPRESS;Initial Catalog=police;Integrated Security=True"; int cid; SqlCommand cmd = new SqlCommand(); cmd.Connection = con; SqlDataAdapter dataAdapter = new SqlDataAdapter(); string img; DataSet ds = new DataSet(); cmd.CommandText = "select * from complaint where cid=@cid"; cmd.Parameters.AddWithValue("@cid", Convert.ToInt32(a)); dataAdapter.SelectCommand = cmd; con.Open(); dataAdapter.Fill(ds, "complaint"); cid = Convert.ToInt32(ds.Tables[0].Rows[0]["id"]); img = ds.Tables[0].Rows[0]["cevd1"].ToString(); labelcase.Visible = true; FormView1.Visible = true; FormView1.DataSource = ds; FormView1.DataBind(); con.Close(); if (img.Equals("null")) { imagelink.Visible = false; labelimginfo.Text = "No evidence for complaint"; } else { imagelink.Visible = true; string range = @"\"; int lastindex = img.LastIndexOf(range); string imgloc = img.Substring(lastindex + 1); Image1.Visible = true; labelimginfo.Text = "Evidence Found"; Image1.ImageUrl = "~/assets/civilian/evidence/" + imgloc; } cmd.CommandText = "select cfname,clname,gender,phone from jass where Id=@clid"; cmd.Parameters.AddWithValue("@clid", cid); DataSet ds1 = new DataSet(); SqlDataAdapter ad = new SqlDataAdapter(); ad.SelectCommand = cmd; con.Open(); ad.Fill(ds1); LabelCivilian.Visible = true; FormView2.DataSource = ds1; FormView2.DataBind(); con.Close(); } catch (Exception ex) { Response.Write(ex.Message); } }
protected void EditToolbar_ItemClick(object sender, EO.Web.ToolBarEventArgs e) { Page.Validate(); if (e.Item.ToolTip == "Update") { if (Page.IsValid) { LOV_COLLECTION L = new LOV_COLLECTION(); DataSet DS; DS = L.SP_AuthorizationMatrix_DP (((TextBox)FormView1.FindControl("TXT_CUSTOMER_ID_EDIT")).Text, ///((TextBox)FormView1.FindControl("TXT_INSTRUMENT_ID_EDIT")).Text, "123", ((TextBox)FormView1.FindControl("TXT_MAKE_SIGNATORY_ID_EDIT")).Text, ((TextBox)FormView1.FindControl("TXT_CHECKER_SIGNATORY_ID_EDIT")).Text, ((TextBox)FormView1.FindControl("TXT_CATEGORY_ID_EDIT")).Text, Session["SPDS_AuthorizationMatrix_ID"].ToString()); if (DS.Tables[0].Rows.Count > 0) { ((Label)FormView1.FindControl("lblDuplicate_EDIT")).Text = "Duplicate Record"; } else { if (DS.Tables[0].Rows.Count <= 0) { P_SPDS_AuthorizationMatrix.RecordInputStart(); P_SPDS_AuthorizationMatrix.Get_ID = Session["SPDS_AuthorizationMatrix_ID"].ToString(); P_SPDS_AuthorizationMatrix.Get_CUSTOMER_ID = ((TextBox)FormView1.FindControl("TXT_CUSTOMER_ID_EDIT")).Text; P_SPDS_AuthorizationMatrix.Get_INSTRUMENT_ID = "123";///((TextBox)FormView1.FindControl("TXT_INSTRUMENT_ID_EDIT")).Text; P_SPDS_AuthorizationMatrix.Get_MAKE_SIGNATORY_ID = ((TextBox)FormView1.FindControl("TXT_MAKE_SIGNATORY_ID_EDIT")).Text; P_SPDS_AuthorizationMatrix.Get_CHECKER_SIGNATORY_ID = ((TextBox)FormView1.FindControl("TXT_CHECKER_SIGNATORY_ID_EDIT")).Text; P_SPDS_AuthorizationMatrix.Get_CATEGORY_ID = ((TextBox)FormView1.FindControl("TXT_CATEGORY_ID_EDIT")).Text; P_SPDS_AuthorizationMatrix.Get_A_UserID = Session["U_NAME"].ToString(); P_SPDS_AuthorizationMatrix.Get_A_DateTime = DateTime.Now.ToString("dd-MMM-yyyy").ToString(); P_SPDS_AuthorizationMatrix.Get_E_UserID = Session["U_NAME"].ToString();//((TextBox)FormView1.FindControl("TXT_E_UserID_EDIT")).Text; P_SPDS_AuthorizationMatrix.Get_E_DateTime = DateTime.Now.ToString("dd-MMM-yyyy").ToString(); P_SPDS_AuthorizationMatrix.RecordInputCommit(); P_SPDS_AuthorizationMatrix.EditNewGroup(); BackPage(); } else { ((TextBox)FormView1.FindControl("TXT_CUSTOMER_ID_EDIT")).Text = ""; ((TextBox)FormView1.FindControl("TXT_INSTRUMENT_ID_EDIT")).Text = ""; ((TextBox)FormView1.FindControl("TXT_MAKE_SIGNATORY_ID_EDIT")).Text = ""; ((TextBox)FormView1.FindControl("TXT_CHECKER_SIGNATORY_ID_EDIT")).Text = ""; ((TextBox)FormView1.FindControl("TXT_CATEGORY_ID_EDIT")).Text = ""; ((RequiredFieldValidator)FormView1.FindControl("REQ_CUSTOMER_ID_EDIT")).Validate(); } } } } else if (e.Item.ToolTip == "Cancel") { BackPage(); } }
protected void Button1_Click(object sender, EventArgs e) { CarList.Initialize(); FormView1.DataBind(); }
protected void BTN_InstrumentIDSearch_EDIT_Click(object sender, EventArgs e) { if (((TextBox)FormView1.FindControl("TXT_INSTRUMENT_ID_EDIT")).Text.Trim().Length > 0 || ((TextBox)FormView1.FindControl("TXT_INSTRUMENT_ID_EDIT")).Text != "") { DataSet ds = new DataSet(); ds = lov.Get_SP_SPDS_InstrumentSetup_GetByCode(Convert.ToInt32(((TextBox)FormView1.FindControl("TXT_INSTRUMENT_ID_EDIT")).Text)); if (ds.Tables[0].Rows.Count > 0) { InstrumentID = ds.Tables[0].Rows[0]["ID"].ToString(); ((TextBox)FormView1.FindControl("TXT_INSTRUMENT_ID_EDIT")).Text = ds.Tables[0].Rows[0]["ID"].ToString(); ((TextBox)FormView1.FindControl("TXT_InstrumentName_EDIT")).Text = ds.Tables[0].Rows[0]["INSTRUMENT_NAME"].ToString(); } else { ((TextBox)FormView1.FindControl("TXT_INSTRUMENT_ID_EDIT")).Text = null; ((TextBox)FormView1.FindControl("TXT_InstrumentName_EDIT")).Text = null; ((TextBox)FormView1.FindControl("TXT_INSTRUMENT_ID_EDIT")).Focus(); ((RequiredFieldValidator)FormView1.FindControl("REQ_INSTRUMENT_ID_EDIT")).Validate(); ((TextBox)FormView1.FindControl("TXT_INSTRUMENT_ID_EDIT")).Focus(); } } else { ((TextBox)FormView1.FindControl("TXT_INSTRUMENT_ID_EDIT")).Text = null; ((TextBox)FormView1.FindControl("TXT_InstrumentName_EDIT")).Text = null; ((TextBox)FormView1.FindControl("TXT_INSTRUMENT_ID_EDIT")).Focus(); } }
protected void Button1_Click(object sender, EventArgs e) { conn.Open(); SqlDataAdapter sda8 = new SqlDataAdapter("SELECT A.cimage AS cimage1, B.cimage AS cimage2 FROM models A, models B WHERE A.Mid=" + int.Parse((Modelname.Text).Trim()) + " And B.Mid=" + int.Parse((Modelname2.Text).Trim()), conn); DataSet ds8 = new DataSet(); sda8.Fill(ds8); FormView1.DataSource = ds8; FormView1.DataBind(); conn.Close(); conn.Open(); //SqlDataAdapter sda = new SqlDataAdapter("select * from models where Mid="+ int.Parse((Modelname.Text).Trim()), conn); SqlDataAdapter sda = new SqlDataAdapter("SELECT A.Car_version AS CarVersion1, A.Cprice AS cprice1, B.Car_version AS CarVersion2, B.Cprice AS CPrice2 FROM models A, models B WHERE A.Mid=" + int.Parse((Modelname.Text).Trim()) + " And B.Mid=" + int.Parse((Modelname2.Text).Trim()), conn); DataSet ds = new DataSet(); sda.Fill(ds); f1.DataSource = ds; f1.DataBind(); conn.Close(); conn.Open(); SqlDataAdapter sda1 = new SqlDataAdapter("SELECT A.Body_type AS Body_type1, A.segment AS segment1, A.engine AS engin1, A.displacement AS desplacement1, A.fuelType AS fuletype1, A.transmission AS transmission1, A.noofgears AS noofgears1, B.Body_type AS bodytype2, B.segment AS segment2, B.engine AS engin2, B.displacement AS desplacement2, B.fuelType AS fuletype2, B.transmission AS transmission2, B.noofgears AS noofgears2 FROM models A, models B WHERE A.Mid=" + int.Parse((Modelname.Text).Trim()) + " And B.Mid=" + int.Parse((Modelname2.Text).Trim()), conn); DataSet ds1 = new DataSet(); sda1.Fill(ds1); f2.DataSource = ds1; f2.DataBind(); conn.Close(); conn.Open(); SqlDataAdapter sda2 = new SqlDataAdapter("SELECT A.Peak_Power AS peak_power1, A.Peak_Torque AS Peak_Torque1, A.Milleage_City AS Milleage_City1, B.Peak_Power AS peak_power2, B.Peak_Torque AS Peak_Torque2, B.Milleage_City AS Milleage_City2 FROM models A, models B WHERE A.Mid=" + int.Parse((Modelname.Text).Trim()) + " And B.Mid=" + int.Parse((Modelname2.Text).Trim()), conn); DataSet ds2 = new DataSet(); sda2.Fill(ds2); f3.DataSource = ds2; f3.DataBind(); conn.Close(); conn.Open(); SqlDataAdapter sda3 = new SqlDataAdapter("SELECT A.Length AS Length1, A.Width AS Width1, A.Height AS Height1, A.Ground_Clearance AS Ground_Clearance1, A.Wheelbase AS Wheelbase1, A.Kerb_Weight AS Kerb_Weight1, A.Boot_Space AS Boot_Space1, A.Turning_Radius AS turning_radius1, B.Length AS Length2, B.Width AS Width2, B.Height AS Height2, B.Ground_Clearance AS Ground_Clearance2, B.Wheelbase AS Wheelbase2, B.Kerb_Weight AS Kerb_Weight2, B.Boot_Space AS Boot_Space2, B.Turning_Radius AS turning_radius2 FROM models A, models B WHERE A.Mid=" + int.Parse((Modelname.Text).Trim()) + " And B.Mid=" + int.Parse((Modelname2.Text).Trim()), conn); DataSet ds3 = new DataSet(); sda3.Fill(ds3); f4.DataSource = ds3; f4.DataBind(); conn.Close(); conn.Open(); SqlDataAdapter sda4 = new SqlDataAdapter("SELECT A.AC AS AC1, A.Climate_control AS Climate_control1, A.Central_Locking AS Central_Locking1, A.Cd_Player AS Cd_Player1, A.Power_streering AS Power_streering1, A.Power_Windows AS Power_Windows1, A.Steering_Adjustment AS Steering_Adjustment1, A.Electricity_Adjustment AS Electricity_Adjustment1, A.Steerin_Mounted AS Steerin_Mounted1, B.AC AS AC2, B.Climate_control AS Climate_control2, B.Central_Locking AS Central_Locking2, B.Cd_Player AS Cd_Player2, B.Power_streering AS Power_streering2, B.Power_Windows AS Power_Windows2, B.Steering_Adjustment AS Steering_Adjustment2, B.Electricity_Adjustment AS Electricity_Adjustment2, B.Steerin_Mounted AS Steerin_Mounted2 FROM models A, models B WHERE A.Mid=" + int.Parse((Modelname.Text).Trim()) + " And B.Mid=" + int.Parse((Modelname2.Text).Trim()), conn); DataSet ds4 = new DataSet(); sda4.Fill(ds4); f5.DataSource = ds4; f5.DataBind(); conn.Close(); conn.Open(); SqlDataAdapter sda5 = new SqlDataAdapter("SELECT A.ABS AS ABS1, A.Airbag AS Airbag1, A.Parking_Sensors AS Parking_Sensors1, A.Traction_Control AS Traction_Control1, B.ABS AS ABS2, B.Airbag AS Airbag2, B.Parking_Sensors AS Parking_Sensors2, B.Traction_Control AS Traction_Control2 FROM models A, models B WHERE A.Mid=" + int.Parse((Modelname.Text).Trim()) + " And B.Mid=" + int.Parse((Modelname2.Text).Trim()), conn); DataSet ds5 = new DataSet(); sda5.Fill(ds5); f6.DataSource = ds5; f6.DataBind(); conn.Close(); conn.Open(); SqlDataAdapter sda6 = new SqlDataAdapter("SELECT A.Fuel_Capacity AS Fuel_Capacity1, A.Seating_Capacity AS Seating_Capacity1, B.Fuel_Capacity AS Fuel_Capacity2, B.Seating_Capacity AS Seating_Capacity2 FROM models A, models B WHERE A.Mid=" + int.Parse((Modelname.Text).Trim()) + " And B.Mid=" + int.Parse((Modelname2.Text).Trim()), conn); DataSet ds6 = new DataSet(); sda6.Fill(ds6); f7.DataSource = ds6; f7.DataBind(); conn.Close(); conn.Open(); SqlDataAdapter sda7 = new SqlDataAdapter("SELECT A.Specs_Front AS Specs_Front1, A.Specs_Rear AS Specs_Rear1, B.Specs_Front AS Specs_Front2, B.Specs_Rear AS Specs_Rear2 FROM models A, models B WHERE A.Mid=" + int.Parse((Modelname.Text).Trim()) + " And B.Mid=" + int.Parse((Modelname2.Text).Trim()), conn); DataSet ds7 = new DataSet(); sda7.Fill(ds7); f8.DataSource = ds7; f8.DataBind(); conn.Close(); }
protected void BTN_MakerSignatoryIDSearch_EDIT_Click(object sender, EventArgs e) { if (((TextBox)FormView1.FindControl("TXT_MAKE_SIGNATORY_ID_EDIT")).Text.Trim().Length > 0 || ((TextBox)FormView1.FindControl("TXT_MAKE_SIGNATORY_ID_EDIT")).Text != "") { DataSet ds = new DataSet(); ds = lov.Get_SPDS_SignatorySetup_SPC(((TextBox)FormView1.FindControl("TXT_MAKE_SIGNATORY_ID_EDIT")).Text); if (ds.Tables[0].Rows.Count > 0) { MakerSignatoryID = ds.Tables[0].Rows[0]["ID"].ToString(); ((TextBox)FormView1.FindControl("TXT_MAKE_SIGNATORY_ID_EDIT")).Text = ds.Tables[0].Rows[0]["ID"].ToString(); ((TextBox)FormView1.FindControl("TXT_MakerSignatoryName_EDIT")).Text = ds.Tables[0].Rows[0]["SIGNATORY_NAME"].ToString(); } else { ((TextBox)FormView1.FindControl("TXT_MAKE_SIGNATORY_ID_EDIT")).Text = null; ((TextBox)FormView1.FindControl("TXT_MakerSignatoryName_EDIT")).Text = null; ((TextBox)FormView1.FindControl("TXT_MAKE_SIGNATORY_ID_EDIT")).Focus(); ((RequiredFieldValidator)FormView1.FindControl("REQ_MAKE_SIGNATORY_ID_EDIT")).Validate(); ((TextBox)FormView1.FindControl("TXT_MAKE_SIGNATORY_ID_EDIT")).Focus(); } } else { ((TextBox)FormView1.FindControl("TXT_MAKE_SIGNATORY_ID_EDIT")).Text = null; ((TextBox)FormView1.FindControl("TXT_MakerSignatoryName_EDIT")).Text = null; ((TextBox)FormView1.FindControl("TXT_MAKE_SIGNATORY_ID_EDIT")).Focus(); } }
protected void btn_edit_Click(object sender, EventArgs e) { FormView1.ChangeMode(FormViewMode.Edit); BindFormView(); }
protected void Button1_Click(object sender, EventArgs e) { try { if (Session["pid"] != null && Session["cid"] != null) { SqlConnection con = new SqlConnection(); con.ConnectionString = @"Data Source=DESKTOP-R083DVH\SQLEXPRESS;Initial Catalog=police;Integrated Security=True"; SqlCommand cmd = new SqlCommand(); int cid, prid, pid; cid = Convert.ToInt32(Session["cid"]); prid = Convert.ToInt32(Session["prid"]); pid = Convert.ToInt32(Session["pid"]); cmd.Connection = con; cmd.CommandText = "insert into case1 (cid,prid,cedate,cedetail,pid,psname)values(@cid2,@prid,@cedate,@cedetail,@pid,@psname)"; cmd.Parameters.AddWithValue("@cid2", cid); if (Session["prid"] != null) { cmd.Parameters.AddWithValue("@prid", prid); } else { cmd.Parameters.AddWithValue("@prid", null); } cmd.Parameters.AddWithValue("@pid", pid); cmd.Parameters.AddWithValue("@cedate", DateTime.Now.ToShortDateString()); cmd.Parameters.AddWithValue("@cedetail", TextBox1.Text); cmd.Parameters.AddWithValue("@psname", DropDownList1.Text); con.Open(); cmd.ExecuteNonQuery(); con.Close(); SqlDataAdapter d = new SqlDataAdapter(); cmd.Connection = con; DataSet ds = new DataSet(); cmd.CommandText = "select c.cid,ce.ceid,c.ctype,c.desc1,c.cbuild,c.clocal,c.cstation,pr.prfname,pr.prlname," + "ce.cedetail,ce.cedate,ce.psname from complaint as c, prisoner as pr,case1 as ce where c.cid=@cid" + " and pr.prid=@prid1 and ce.ceid in (select top 1 ceid from case1 order by ceid desc)"; cmd.Parameters.AddWithValue("@cid", cid); cmd.Parameters.AddWithValue("@prid1", prid); d.SelectCommand = cmd; con.Open(); d.Fill(ds); labelcase.Visible = true; FormView1.Visible = true; FormView1.DataSource = ds; FormView1.DataBind(); con.Close(); cmd.CommandText = "update complaint set cstatus=@cstatus where cid=@cid1"; cmd.Parameters.AddWithValue("@cstatus", "Complete"); cmd.Parameters.AddWithValue("@cid1", cid); cmd.Connection = con; con.Open(); cmd.ExecuteNonQuery(); con.Close(); cmd.CommandText = "select prfname,prlname,pstation from prisoner where cid=@cid"; //DataTable dt = new DataTable(); SqlDataAdapter d1 = new SqlDataAdapter(); DataSet ds1 = new DataSet(); d1.SelectCommand = cmd; con.Open(); d1.Fill(ds1); rptTable.DataSource = ds1; rptTable.DataBind(); con.Close(); } else { Response.Write("session has expired"); } }catch (Exception ex) { Response.Write(ex.Message); } }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { TextBox txtInicio = (TextBox)FormView1.FindControl("Hora_IncidenteTextBox0"); txtInicio.Text = DateTime.Now.ToString("hh:mm"); }
protected void Page_Init(object sender, EventArgs e) { table = DynamicDataRouteHandler.GetRequestMetaTable(Context); FormView1.SetMetaTable(table); DetailsDataSource.EntityTypeFilter = table.EntityType.Name; }
public void Display() { FormView1.DataBind(); this.Visible = true; }
protected void GridView1_RowEditing(object sender, EventArgs e) { FormView1.ChangeMode(FormViewMode.ReadOnly); }
protected void Page_Load(object sender, EventArgs e) { Title = table.DisplayName; DetailsDataSource.Include = table.ForeignKeyColumnsNames; string value = Request.QueryString["Id"]; HyperLink2.NavigateUrl = "~/Technology_FilesSet/Insert.aspx?Technology_Instruction_IndexId=" + value; #region roles //edytuj if (!(Roles.IsUserInRole("Technology_Edit") || Roles.IsUserInRole("Admin"))) { DynamicHyperLink EditDynamicHyperLink = (DynamicHyperLink)FormView1.FindControl("EditDynamicHyperLink"); EditDynamicHyperLink.Enabled = false; EditDynamicHyperLink.CssClass = "disabled_link"; EditDynamicHyperLink.Action = ""; } //usun if (!(Roles.IsUserInRole("Technology_Delete") || Roles.IsUserInRole("Admin"))) { LinkButton DeleteLinkButton = (LinkButton)FormView1.FindControl("DeleteLinkButton"); DeleteLinkButton.Enabled = false; DeleteLinkButton.CssClass = "disabled_link"; DeleteLinkButton.OnClientClick = ""; DeleteLinkButton.CommandName = ""; } //dodaj plik if (!(Roles.IsUserInRole("Technology_Insert") || Roles.IsUserInRole("Admin"))) { HyperLink2.Enabled = false; HyperLink2.CssClass = "disabled_link"; } //edytuj plik if (!(Roles.IsUserInRole("Technology_Edit") || Roles.IsUserInRole("Admin"))) { foreach (GridViewRow row in GridViewCustomer_Part_Index_Files.Rows) { if (row.RowType == DataControlRowType.DataRow) { DynamicHyperLink FileEdit = row.FindControl("FileEdit") as DynamicHyperLink; FileEdit.Enabled = false; FileEdit.CssClass = "disabled_link"; FileEdit.Action = ""; } } } //usun plik if (!(Roles.IsUserInRole("Technology_Delete") || Roles.IsUserInRole("Admin"))) { foreach (GridViewRow row in GridViewCustomer_Part_Index_Files.Rows) { if (row.RowType == DataControlRowType.DataRow) { LinkButton FileDelete = row.FindControl("FileDelete") as LinkButton; FileDelete.Enabled = false; FileDelete.CssClass = "disabled_link"; FileDelete.OnClientClick = ""; FileDelete.CommandName = ""; } } } #endregion }
protected void GridView1_RowUpdated(object sender, GridViewUpdatedEventArgs e) { FormView1.DataBind(); }
private void SetEnterOrder(string curControl, string nextControl) { (FormView1.FindControl(curControl) as TextBox).Attributes.Add("onkeyDown", "javascript:if(event.keyCode==13)" + FormView1.FindControl(nextControl).ClientID + ".focus();"); }