Example #1
0
        protected void lstItem_ItemCommand(object sender, DataListCommandEventArgs e)
        {
            HtmlInputCheckBox chkList = (HtmlInputCheckBox)e.Item.FindControl("chkList");
            string stParam = string.Empty;
            switch (e.CommandName)
            {
                case "imgItemDelete":
                    Contacts clsContact = new Contacts();
                    clsContact.Delete(chkList.Value);
                    clsContact.CommitAndDispose();

                    LoadList();
                    break;
                case "imgItemEdit":
                    stParam = "?task=" + Common.Encrypt("edit", Session.SessionID) + "&id=" + Common.Encrypt(chkList.Value, Session.SessionID);
                    Response.Redirect("Default.aspx" + stParam);
                    break;
            }
        }
Example #2
0
		private bool Delete()
		{
			bool boRetValue = false;
			string stIDs = "";

			foreach(DataListItem item in lstItem.Items)
			{
				HtmlInputCheckBox chkList = (HtmlInputCheckBox) item.FindControl("chkList");
				if (chkList!=null)
				{
					if (chkList.Checked == true)
					{
						stIDs += chkList.Value + ",";		
						boRetValue = true;
					}
				}
			}
			if (boRetValue)
			{
				Contacts clsContact = new Contacts();
				clsContact.Delete( stIDs.Substring(0,stIDs.Length-1));
				clsContact.CommitAndDispose();
			}

			return boRetValue;
		}
Example #3
0
        protected void lstItem_ItemCommand(object sender, DataListCommandEventArgs e)
        {
            HtmlInputCheckBox chkList = (HtmlInputCheckBox)e.Item.FindControl("chkList");
            string stParam = string.Empty;
            switch (e.CommandName)
            {
                case "imgItemDelete":
                    Contacts clsContact = new Contacts();
                    clsContact.Delete(chkList.Value);
                    clsContact.CommitAndDispose();

                    LoadList();
                    break;
                case "imgItemEdit":
                    stParam = "?task=" + Common.Encrypt("edit", Session.SessionID) + "&id=" + Common.Encrypt(chkList.Value, Session.SessionID);
                    Response.Redirect("Default.aspx" + stParam);
                    break;
                case "imgPrintBilling":
                    ImageButton imgPrintBilling = (ImageButton)e.Item.FindControl("imgPrintBilling");
                    if (DateTime.Parse(imgPrintBilling.ToolTip) != DateTime.MinValue && DateTime.Parse(imgPrintBilling.ToolTip) != Constants.C_DATE_MIN_VALUE)
                    {
                        Billing clsBilling = new Billing();
                        System.Data.DataTable dt = clsBilling.ListBillingDateAsDataTable(CreditType.Individual, long.Parse(chkList.Value), DateTime.Parse(imgPrintBilling.ToolTip));
                        clsBilling.CommitAndDispose();

                        if (dt.Rows.Count > 0)
                        {
                            string newWindowUrl = Constants.ROOT_DIRECTORY_BILLING_WoutG + "/" + dt.Rows[0]["BillingFile"].ToString();
                            string javaScript = "window.open('" + newWindowUrl + "','_blank');";
                            System.Web.UI.ScriptManager.RegisterClientScriptBlock(this.lstItem, this.lstItem.GetType(), "openwindow", javaScript, true);
                        }
                    }
                    else
                    {
                        string javaScript = "window.alert('Sorry there is no billing file to print.');";
                        System.Web.UI.ScriptManager.RegisterClientScriptBlock(this.lstItem, this.lstItem.GetType(), "openwindow", javaScript, true);
                    }
                    break;
                case "imgUpdateCardType":
                    stParam = "?task=" + Common.Encrypt("changecardtype", Session.SessionID) + "&id=" + Common.Encrypt(chkList.Value, Session.SessionID);
                    Response.Redirect("Default.aspx" + stParam);
                    break;
            }
        }