Пример #1
0
        public view_Budget_transfer_detail GETDETAIL(string strCriteria)
        {
            view_Budget_transfer_detail result = null;
            var     strMessage = string.Empty;
            DataSet ds         = null;

            if (SP_BUDGET_TRANSFER_DETAIL_SEL(strCriteria, ref ds, ref strMessage))
            {
                result = Helper.ToClassInstanceCollection <view_Budget_transfer_detail>(ds.Tables[0]).FirstOrDefault();
            }
            return(result);
        }
        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType.Equals(DataControlRowType.Header))
            {
                for (int iCol = 0; iCol < e.Row.Cells.Count; iCol++)
                {
                    e.Row.Cells[iCol].Attributes.Add("class", "table_h");
                    e.Row.Cells[iCol].Wrap = false;
                }

                ImageButton imgAdd = (ImageButton)e.Row.FindControl("imgAdd");
                imgAdd.ImageUrl = ((DataSet)Application["xmlconfig"]).Tables["imgGridAdd"].Rows[0]["img"].ToString();
                imgAdd.Attributes.Add("title", ((DataSet)Application["xmlconfig"]).Tables["imgGridAdd"].Rows[0]["title"].ToString());
                ViewState["TotalAmount"] = 0;
            }
            else if (e.Row.RowType.Equals(DataControlRowType.DataRow) || e.Row.RowState.Equals(DataControlRowState.Alternate))
            {
                if (!this.bIsGridDetailEmpty)
                {
                    #region Set datagrid row color
                    string strEvenColor, strOddColor, strMouseOverColor;
                    strEvenColor      = ((DataSet)Application["xmlconfig"]).Tables["colorDataGridRow"].Rows[0]["Even"].ToString();
                    strOddColor       = ((DataSet)Application["xmlconfig"]).Tables["colorDataGridRow"].Rows[0]["Odd"].ToString();
                    strMouseOverColor = ((DataSet)Application["xmlconfig"]).Tables["colorDataGridRow"].Rows[0]["MouseOver"].ToString();

                    e.Row.Style.Add("valign", "top");
                    e.Row.Style.Add("cursor", "hand");
                    e.Row.Attributes.Add("onMouseOver", "this.style.backgroundColor='" + strMouseOverColor + "'");

                    if (e.Row.RowState.Equals(DataControlRowState.Alternate))
                    {
                        e.Row.Attributes.Add("bgcolor", strOddColor);
                        e.Row.Attributes.Add("onMouseOut", "this.style.backgroundColor='" + strOddColor + "'");
                    }
                    else
                    {
                        e.Row.Attributes.Add("bgcolor", strEvenColor);
                        e.Row.Attributes.Add("onMouseOut", "this.style.backgroundColor='" + strEvenColor + "'");
                    }
                    #endregion
                    view_Budget_transfer_detail dv = (view_Budget_transfer_detail)e.Row.DataItem;
                    Label lblNo = (Label)e.Row.FindControl("lblNo");
                    int   nNo   = (GridView1.PageSize * GridView1.PageIndex) + e.Row.RowIndex + 1;
                    lblNo.Text = nNo.ToString();


                    #region set ImageView
                    ImageButton imgView = (ImageButton)e.Row.FindControl("imgView");
                    imgView.Attributes.Add("onclick", "OpenPopUp('1000px','400px','96%','แสดงข้อมูลรายการโอนเงิน','budget_transfer_detail_control.aspx?mode=view&budget_transfer_doc=" + dv.budget_transfer_doc +
                                           "&budget_transfer_detail_id=" + dv.budget_transfer_detail_id.ToString() +
                                           "&year=" + dv.budget_transfer_year +
                                           "&budget_type=" + this.BudgetType + "','1');return false;");
                    imgView.ImageUrl = ((DataSet)Application["xmlconfig"]).Tables["imgView"].Rows[0]["img"].ToString();
                    imgView.Attributes.Add("title", ((DataSet)Application["xmlconfig"]).Tables["imgView"].Rows[0]["title"].ToString());
                    #endregion

                    #region set Image Edit & Delete

                    ImageButton imgEdit = (ImageButton)e.Row.FindControl("imgEdit");
                    imgEdit.Attributes.Add("onclick", "OpenPopUp('1000px','400px','96%','แก้ไขข้อมูลรายการโอนเงิน','budget_transfer_detail_control.aspx?mode=edit&budget_transfer_doc=" + dv.budget_transfer_doc +
                                           "&budget_transfer_detail_id=" + dv.budget_transfer_detail_id.ToString() +
                                           "&year=" + dv.budget_transfer_year +
                                           "&budget_type=" + this.BudgetType + "','1');return false;");
                    imgEdit.ImageUrl = ((DataSet)Application["xmlconfig"]).Tables["imgEdit"].Rows[0]["img"].ToString();
                    imgEdit.Attributes.Add("title", ((DataSet)Application["xmlconfig"]).Tables["imgEdit"].Rows[0]["title"].ToString());

                    ImageButton imgDelete = (ImageButton)e.Row.FindControl("imgDelete");
                    imgDelete.ImageUrl = ((DataSet)Application["xmlconfig"]).Tables["imgDelete"].Rows[0]["img"].ToString();
                    imgDelete.Attributes.Add("title", ((DataSet)Application["xmlconfig"]).Tables["imgDelete"].Rows[0]["title"].ToString());
                    imgDelete.Attributes.Add("onclick", "return confirm(\"คุณต้องการลบข้อมูลนี้หรือไม่ ?\");");
                    //imgDelete.Visible = IsUserDelete;
                    #endregion

                    ViewState["TotalAmount"] = Helper.CDbl(ViewState["TotalAmount"]) +
                                               Helper.CDbl(dv.budget_transfer_detail_amount);
                }
            }
            else if (e.Row.RowType.Equals(DataControlRowType.Footer))
            {
                AwNumeric txttransfer_amount = (AwNumeric)e.Row.FindControl("txttransfer_amount");
                txttransfer_amount.Value = Helper.CDbl(ViewState["TotalAmount"]);
            }
        }