public void BindLicenseKey() { int rowcount = ucCustomPagerItems.isCountRecord; string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } DataTable dt = BLL_Infra_LicenseKey.LicenseKeySearch(UDFLib.ConvertIntegerToNull(DDLVessel.SelectedValue) , UDFLib.ConvertIntegerToNull(optStatus.SelectedValue), txtfilter.Text != "" ? txtfilter.Text : null , sortbycoloumn, sortdirection, ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount); if (ucCustomPagerItems.isCountRecord == 1) { ucCustomPagerItems.CountTotalRec = rowcount.ToString(); ucCustomPagerItems.BuildPager(); } if (dt.Rows.Count > 0) { gvLicenseKey.DataSource = dt; gvLicenseKey.DataBind(); } else { gvLicenseKey.DataSource = dt; gvLicenseKey.DataBind(); } }
protected void btnGenerateKey_Click(object sender, EventArgs e) { string Passphrase = "JiBEShip"; foreach (GridViewRow row in gvLicenseKey.Rows) { if (((CheckBox)row.FindControl("chkStatus")).Checked == true && ((CheckBox)row.FindControl("chkStatus")).Enabled == true) { Label lblAutorizedKey = (Label)row.FindControl("lblAutorizedKey"); string LicenseKey = DES_Encrypt_Decrypt.EncryptString(lblAutorizedKey.Text, Passphrase); int retval = BLL_Infra_LicenseKey.UpdateLicenseKey(Convert.ToInt32(((Label)row.FindControl("lblID")).Text) , Convert.ToInt32(((Label)row.FindControl("lblVesselID")).Text), LicenseKey, Convert.ToInt32(Session["UserID"].ToString())); } } BindLicenseKey(); }