Exemplo n.º 1
0
 protected void grdMain_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "cmdEdit")
     {
         Response.Redirect("TyreSizeMaster.aspx?TyresizeID=" + Convert.ToString(e.CommandArgument) + "");
     }
     else if (e.CommandName == "cmddelete")
     {
         TyreSizeDAL DAL    = new TyreSizeDAL();
         Int64       Result = DAL.Delete(Convert.ToInt64(e.CommandArgument));
         if (Result > 0)
         {
             BindGrid();
             ScriptManager.RegisterStartupScript(this, this.GetType(), "alertstrMsg", "PassMessage('Record Deleted Successfully.')", true);
         }
         else if (Result == -2)
         {
             ScriptManager.RegisterStartupScript(this, this.GetType(), "alertstrMsg", "PassMessageError('Record in Use.')", true);
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, this.GetType(), "alertstrMsg", "PassMessageError('Record Not Deleted.')", true);
         }
     }
 }
Exemplo n.º 2
0
        public void BindGrid()
        {
            TyreSizeDAL DAL = new TyreSizeDAL();
            var         Lst = DAL.SelectList(txttyresize.Text.Trim());

            if (Lst != null && Lst.Count > 0)
            {
                grdMain.DataSource = Lst;
                grdMain.DataBind();

                int startRowOnPage = (grdMain.PageIndex * grdMain.PageSize) + 1;
                int lastRowOnPage  = startRowOnPage + grdMain.Rows.Count - 1;
                lblcontant.Text = "Showing " + startRowOnPage.ToString() + " - " + lastRowOnPage.ToString() + " of " + Lst.Count.ToString();

                lblTotalRecord.Text = "T. Record(s): " + Lst.Count;
                lblcontant.Visible  = true;
                divpaging.Visible   = true;
            }
            else
            {
                grdMain.DataSource = null;
                grdMain.DataBind();
                lblTotalRecord.Text = "T. Record(s): 0 ";
                lblcontant.Visible  = false;
                divpaging.Visible   = false;
            }
        }
Exemplo n.º 3
0
        public void Populate(Int64 TyresizeId)
        {
            TyreSizeDAL DAL = new TyreSizeDAL();
            var         objTyreSizeMaster = DAL.SelectByID(TyresizeId);

            if (objTyreSizeMaster != null)
            {
                txttyresize.Text = Convert.ToString(objTyreSizeMaster.TyreSize);
            }
        }
Exemplo n.º 4
0
        private void RecordCount()
        {
            TyreSizeDAL DAL         = new TyreSizeDAL();
            var         lstGridData = DAL.Count();

            if (lstGridData != null && lstGridData.Count > 0)
            {
                lblTotalRecord.Text = "T. Record (s): " + lstGridData.Count;
            }
            else
            {
                lblTotalRecord.Text = "T. Record (s): 0 ";
            }
        }
Exemplo n.º 5
0
        protected void lnkbtnSave_Click(object sender, EventArgs e)
        {
            Int64       Result = 0;
            TyreSizeDAL DAL    = new TyreSizeDAL();

            if (string.IsNullOrEmpty(hidTyresizeIdno.Value) == false)
            {
                Result = DAL.Update(Convert.ToInt64(hidTyresizeIdno.Value), txttyresize.Text.Trim());
            }
            else
            {
                Result = DAL.Save(txttyresize.Text.Trim());
            }

            string strMsg = "";

            if (Result > 0)
            {
                if (string.IsNullOrEmpty(hidTyresizeIdno.Value) == false)
                {
                    ShowMessage("Record updated successfully.");
                }
                else
                {
                    ShowMessage("Record saved successfully.");
                }
                this.ClearControls();
            }
            else if (Result < 0)
            {
                ShowMessageErr("Record already exists.");
            }
            else
            {
                if (string.IsNullOrEmpty(hidTyresizeIdno.Value) == false)
                {
                    ShowMessageErr("Record not updated.");
                }
                else
                {
                    ShowMessageErr("Record not saved.");
                }
            }
            //ddltype.Focus();
        }
Exemplo n.º 6
0
 protected void grdMain_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         LinkButton imgBtnDelete = (LinkButton)e.Row.FindControl("lnkbtnDelete");
         string     TYresizeIdno = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "TyreSize_Idno"));
         if (TYresizeIdno != "")
         {
             TyreSizeDAL DAL = new TyreSizeDAL();
             //var ItemExist = ObjDAL.SelectSearch(Guid.Parse(Convert.ToString(MisIdno)));
             //if (ItemExist != null && ItemExist > 0)
             //{
             //    imgBtnDelete.Visible = false;
             //}
             //else
             //{
             //    imgBtnDelete.Visible = true;
             //}
         }
     }
 }