Exemple #1
0
    public void SetInitialRowTower()
    {
        try
        {
            DataTable dtTable = new DataTable();
            DataRow   dr;
            dtTable.Columns.Add("#", typeof(int));
            dtTable.Columns.Add("CHK", typeof(bool));
            dtTable.Columns.Add("Status", typeof(String));
            dtTable.Columns.Add("UnitNo", typeof(String));
            dtTable.Columns.Add("ExpenseHdId", typeof(string));
            dtTable.Columns.Add("Amount", typeof(String));

            dr = dtTable.NewRow();

            dr["#"]           = 0;
            dr["CHK"]         = 0;
            dr["Status"]      = string.Empty;
            dr["UnitNo"]      = string.Empty;
            dr["ExpenseHdId"] = "";
            dr["Amount"]      = 0.00;

            dtTable.Rows.Add(dr);
            ViewState["CurrentTable"] = dtTable;
            GrdRateDtls.DataSource    = dtTable;
            GrdRateDtls.DataBind();
        }
        catch (Exception ex) { throw new Exception(ex.Message); }
    }
Exemple #2
0
    protected void GrdRateDtls_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            if (ViewState["CurrentTable"] != null)
            {
                int       id = e.RowIndex;
                DataTable dt = (DataTable)ViewState["CurrentTable"];

                dt.Rows.RemoveAt(id);

                if (dt.Rows.Count > 0)
                {
                    GrdRateDtls.DataSource    = dt;
                    ViewState["CurrentTable"] = dt;
                    GrdRateDtls.DataBind();
                }
                else
                {
                    SetInitialRowTower();
                }
            }
        }
        catch (Exception)
        {
            throw;
        }
    }
Exemple #3
0
    protected void GrdReport_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            switch (e.CommandName)
            {
            case ("Select"):
            {
                if (Convert.ToInt32(e.CommandArgument) != 0)
                {
                    ViewState["EditID"] = Convert.ToInt32(e.CommandArgument);
                    DS = Obj_PM.GetPropertyToEdit(Convert.ToInt32(e.CommandArgument), out StrError);

                    if (DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0)
                    {
                        txtPCNo.Text                 = DS.Tables[0].Rows[0]["PMNo"].ToString();
                        txtFromDate.Text             = DS.Tables[0].Rows[0]["PMDate"].ToString();
                        ddlProjectName.SelectedValue = DS.Tables[0].Rows[0]["PropertyId"].ToString();
                        ddlProjectName_SelectedIndexChanged(sender, e);
                        ddlPartyName.SelectedValue = DS.Tables[0].Rows[0]["PartyId"].ToString();
                        // txtMaintenanceType.Text = DS.Tables[0].Rows[0]["MaintenaceType"].ToString();
                        if (DS.Tables.Count > 0 && DS.Tables[1].Rows.Count > 0)
                        {
                            GrdRateDtls.DataSource = DS.Tables[1];
                            GrdRateDtls.DataBind();
                            ViewState["CurrentTable"] = DS.Tables[1];
                        }
                        else
                        {
                            SetInitialRowTower();
                        }
                        if (!FlagEdit)
                        {
                            BtnUpdate.Visible = true;
                        }
                        BtnSave.Visible = false;
                    }
                    else
                    {
                        // Makefromempty();
                    }
                }

                break;
            }
            }
        }
        catch (Exception ex)
        {
            Obj_Comm.ShowPopUpMsg("Please try after Some Time..!", this.Page);
        }
    }
Exemple #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            DataSet DST = new DataSet();

            if (!string.IsNullOrEmpty(Request.QueryString["PropertyMaintenaceId"]))
            {
                FillCombo();

                int ProMaintId = Convert.ToInt32(Request.QueryString["PropertyMaintenaceId"]);
                {
                    DST = Obj_PM.GetPropertyToEdit(ProMaintId, out StrError);

                    if (DST.Tables.Count > 0 && DST.Tables[0].Rows.Count > 0)
                    {
                        txtPCNo.Text                 = DST.Tables[0].Rows[0]["PMNo"].ToString();
                        txtFromDate.Text             = DST.Tables[0].Rows[0]["PMDate"].ToString();
                        ddlProjectName.SelectedValue = DST.Tables[0].Rows[0]["PropertyId"].ToString();
                        ddlProjectName_SelectedIndexChanged(sender, e);
                        ddlPartyName.SelectedValue = DST.Tables[0].Rows[0]["PartyId"].ToString();
                        // txtMaintenanceType.Text = DS.Tables[0].Rows[0]["MaintenaceType"].ToString();
                        if (DST.Tables.Count > 0 && DST.Tables[1].Rows.Count > 0)
                        {
                            GrdRateDtls.DataSource = DST.Tables[1];
                            GrdRateDtls.DataBind();
                            ViewState["CurrentTable"] = DST.Tables[1];
                        }
                        else
                        {
                            SetInitialRowTower();
                        }
                        if (!FlagEdit)
                        {
                            BtnUpdate.Visible = true;
                        }
                        BtnSave.Visible = false;
                    }
                    else
                    {
                        // Make
                    }
                }
            }
            else
            {
                MakeEmptyForm();
            }
        }
    }
Exemple #5
0
    protected void ImgAddRrowButton_Click(object sender, ImageClickEventArgs e)
    {
        bool DupFlag = false;
        int  k = 0, chkcount = 0;
        int  rowIndex = 0;

        if (Convert.ToInt32(ddlProjectName.SelectedValue) > 0)
        {
            if (ViewState["CurrentTable"] != null)
            {
                DataTable dtCurrentTable = (DataTable)ViewState["CurrentTable"];
                DataTable DTTEMP         = dtCurrentTable.Clone();
                DataRow   dtTableRow     = null;
                #region

                if (GrdRateDtls.Rows[0].Cells[1].Text.Equals(" ") || string.IsNullOrEmpty(GrdRateDtls.Rows[0].Cells[1].Text))
                {
                    dtCurrentTable.Rows.RemoveAt(0);
                }

                for (int i = 0; i < GrdRateDtls.Rows.Count; i++)
                {
                    TextBox txtTaskType           = (TextBox)GrdRateDtls.Rows[i].Cells[2].FindControl("txtTaskType");
                    TextBox txtTaskDtls           = (TextBox)GrdRateDtls.Rows[i].Cells[3].FindControl("txtTaskDtls");
                    TextBox txtRate               = (TextBox)GrdRateDtls.Rows[i].Cells[4].FindControl("txtRate");
                    TextBox txtTotalAreaQty       = (TextBox)GrdRateDtls.Rows[i].Cells[5].FindControl("txtTotalAreaQty");
                    TextBox txtAssignTotalAreaQty = (TextBox)GrdRateDtls.Rows[i].Cells[6].FindControl("txtAssignTotalAreaQty");
                    TextBox txtAllotAmt           = (TextBox)GrdRateDtls.Rows[i].Cells[7].FindControl("txtAllotAmt");
                    TextBox txtRemark             = (TextBox)GrdRateDtls.Rows[i].Cells[8].FindControl("txtRemark");

                    dtTableRow = DTTEMP.NewRow();
                    //dtTableRow["#"] = LblEntryId.Text;
                    dtTableRow["TaskType"]           = txtTaskType.Text;
                    dtTableRow["TaskDetails"]        = txtTaskDtls.Text;
                    dtTableRow["Rate"]               = txtRate.Text;
                    dtTableRow["TotalAreaQty"]       = txtTotalAreaQty.Text;
                    dtTableRow["AssignTotalAreaQty"] = txtAssignTotalAreaQty.Text;
                    dtTableRow["AllotedAmt"]         = txtAllotAmt.Text;
                    dtTableRow["Remark"]             = txtRemark.Text;
                    rowIndex++;
                    DTTEMP.Rows.Add(dtTableRow);
                }
                if (DTTEMP.Rows.Count > 0)
                {
                    dtCurrentTable = DTTEMP;
                }
                dtTableRow = null;
                #endregion

                if (dtCurrentTable.Rows.Count > 0)
                {
                    dtTableRow = dtCurrentTable.NewRow();

                    dtTableRow["#"] = 0;

                    dtTableRow["TaskType"]           = "";
                    dtTableRow["TaskDetails"]        = "";
                    dtTableRow["Rate"]               = 0;
                    dtTableRow["TotalAreaQty"]       = 0;
                    dtTableRow["AssignTotalAreaQty"] = 0;
                    dtTableRow["AllotedAmt"]         = 0;
                    dtTableRow["Remark"]             = "";

                    dtCurrentTable.Rows.Add(dtTableRow);
                    ViewState["CurrentTable"] = dtCurrentTable;
                    GrdRateDtls.DataSource    = dtCurrentTable;
                    GrdRateDtls.DataBind();

                    // Makecontrolempty();
                }
            }
        }
    }
Exemple #6
0
    protected void ImgAddRrow_Click(object sender, ImageClickEventArgs e)
    {
        int rowIndex = 0;

        if (Convert.ToInt32(ddlProjectName.SelectedValue) > 0)
        {
            if (ViewState["CurrentTable"] != null)
            {
                DataTable dtCurrentTable = (DataTable)ViewState["CurrentTable"];
                DataTable DTTEMP         = dtCurrentTable.Clone();
                DataRow   dtTableRow     = null;
                #region

                if (GrdRateDtls.Rows[0].Cells[1].Text.Equals("&nbsp;") || string.IsNullOrEmpty(GrdRateDtls.Rows[0].Cells[1].Text))
                {
                    dtCurrentTable.Rows.RemoveAt(0);
                }

                for (int i = 0; i < GrdRateDtls.Rows.Count; i++)
                {
                    CheckBox     checkAll      = (CheckBox)GrdRateDtls.Rows[i].Cells[1].FindControl("ChkAllocate");
                    TextBox      txtUnitNo     = (TextBox)GrdRateDtls.Rows[i].Cells[3].FindControl("txtUnitNo");
                    DropDownList GrdddlExpense = (DropDownList)GrdRateDtls.Rows[i].Cells[4].FindControl("GrdddlExpense");
                    TextBox      txtAmount     = (TextBox)GrdRateDtls.Rows[i].Cells[5].FindControl("txtAmount");


                    dtTableRow = DTTEMP.NewRow();

                    dtTableRow["CHK"] = checkAll.Checked;
                    //dtTableRow["#"] = LblEntryId.Text;
                    dtTableRow["UnitNo"]      = txtUnitNo.Text;
                    dtTableRow["ExpenseHdId"] = Convert.ToInt32(GrdddlExpense.SelectedValue);
                    dtTableRow["Amount"]      = txtAmount.Text;

                    rowIndex++;
                    DTTEMP.Rows.Add(dtTableRow);
                }
                if (DTTEMP.Rows.Count > 0)
                {
                    dtCurrentTable = DTTEMP;
                }
                dtTableRow = null;
                #endregion

                if (dtCurrentTable.Rows.Count > 0)
                {
                    dtTableRow = dtCurrentTable.NewRow();

                    dtTableRow["#"]           = 0;
                    dtTableRow["CHK"]         = false;
                    dtTableRow["UnitNo"]      = 0;
                    dtTableRow["ExpenseHdId"] = 0;
                    dtTableRow["Amount"]      = 0;

                    dtCurrentTable.Rows.Add(dtTableRow);
                    ViewState["CurrentTable"] = dtCurrentTable;
                    GrdRateDtls.DataSource    = dtCurrentTable;
                    GrdRateDtls.DataBind();

                    // Makecontrolempty();
                }
            }
        }
    }