Beispiel #1
0
 private void Update()
 {
     if (isChkListSingle() == true)
     {
         AccountGJournalsStatus status = GetStatus();
         if (status == AccountGJournalsStatus.Open)
         {
             string stID = GetFirstID();
             if (stID != null)
             {
                 string stParam = "?task=" + Common.Encrypt("edit", Session.SessionID) + "&GJournalid=" + Common.Encrypt(stID, Session.SessionID);
                 Response.Redirect("Default.aspx" + stParam);
             }
         }
         else
         {
             string stScript = "<Script>";
             stScript += "window.alert('Sorry you cannot update a " + status.ToString("G") + " Record. Please select another record to update.')";
             stScript += "</Script>";
             Response.Write(stScript);
         }
     }
     else
     {
         string stScript = "<Script>";
         stScript += "window.alert('Cannot update more than one record. Please select at least one record to update.')";
         stScript += "</Script>";
         Response.Write(stScript);
     }
 }
Beispiel #2
0
        private void lstItem_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Header)
            {
                LoadSortFieldOptions(e);
            }
            else if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataRowView dr = (DataRowView)e.Item.DataItem;

                HtmlInputCheckBox chkList = (HtmlInputCheckBox)e.Item.FindControl("chkList");
                chkList.Value = dr["GJournalID"].ToString();

                AccountGJournalsStatus status = (AccountGJournalsStatus)Enum.Parse(typeof(AccountGJournalsStatus), dr["Status"].ToString());
                if (status == AccountGJournalsStatus.Cancelled || status == AccountGJournalsStatus.Posted)
                {
                    chkList.Attributes.Add("disabled", "false");
                }

                HyperLink lnkParticulars = (HyperLink)e.Item.FindControl("lnkParticulars");
                lnkParticulars.Text = dr["Particulars"].ToString();
                string stParam = "?task=" + Common.Encrypt("details", Session.SessionID) + "&GJournalid=" + Common.Encrypt(chkList.Value.ToString(), Session.SessionID);
                lnkParticulars.NavigateUrl = "Default.aspx" + stParam;

                Label lblTotalDebitAmount = (Label)e.Item.FindControl("lblTotalDebitAmount");
                lblTotalDebitAmount.Text = Convert.ToDecimal(dr["TotalDebitAmount"].ToString()).ToString("#,##0.#0");

                Label lblTotalCreditAmount = (Label)e.Item.FindControl("lblTotalCreditAmount");
                lblTotalCreditAmount.Text = Convert.ToDecimal(dr["TotalCreditAmount"].ToString()).ToString("#,##0.#0");

                Label lblStatus = (Label)e.Item.FindControl("lblStatus");
                lblStatus.Text = status.ToString("G");

                //For anchor
//				HtmlGenericControl divExpCollAsst = (HtmlGenericControl) e.Item.FindControl("divExpCollAsst");

//				HtmlAnchor anchorDown = (HtmlAnchor) e.Item.FindControl("anchorDown");
//				anchorDown.HRef = "javascript:ToggleDiv('" +  divExpCollAsst.ClientID + "')";
            }
        }