Esempio n. 1
0
        protected void grdMain_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string strMsg = string.Empty;

            if (e.CommandName == "cmdedit")
            {
                Response.Redirect("ChlnBooking.aspx?q=" + e.CommandArgument, true);
            }
            else if (e.CommandName == "cmddelete")
            {
                Int64          UserIdno = Convert.ToInt64(Session["UserIdno"]);
                ChlnBookingDAL obj      = new ChlnBookingDAL();
                Int32          intValue = obj.Delete(Convert.ToInt32(e.CommandArgument), UserIdno, ApplicationFunction.ConnectionString(), ddlGrtype.SelectedValue);
                obj = null;
                if (intValue > 0)
                {
                    this.BindGrid();
                    strMsg = "Record deleted successfully.";
                    txtReceiptNo.Focus();
                }
                else
                {
                    if (intValue == -1)
                    {
                        strMsg = "Record can not be deleted. It is in use.";
                    }
                    else
                    {
                        strMsg = "Record not deleted.";
                    }
                }
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alertstrMsg", "PassMessage('" + strMsg + "')", true);
            }
            if (e.CommandName == "cmdAddTruckLoc")
            {
                Int64 iChlnId = 0;
                hidChlnidno.Value = e.CommandArgument.ToString();
                if (hidChlnidno.Value != "")
                {
                    iChlnId = Convert.ToInt64(e.CommandArgument.ToString());
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop1", "PopUpTrackTruck()", true);
                    //Show challan details
                    PopulateChallanHead(iChlnId);
                    PopulateTruckLocation(iChlnId);
                }
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop1", "PopUpTrackTruck()", true);
            }
        }
Esempio n. 2
0
        protected void grdMain_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string strMsg = string.Empty;

            if (e.CommandName == "cmdedit")
            {
                Response.Redirect("ChlnBookingCrsng.aspx?q=" + e.CommandArgument, true);
            }
            if (e.CommandName == "cmddelete")
            {
                Int64          UserIdno = Convert.ToInt64(Session["UserIdno"]);
                ChlnBookingDAL obj      = new ChlnBookingDAL();
                Int32          intValue = obj.Delete(Convert.ToInt32(e.CommandArgument), UserIdno, ApplicationFunction.ConnectionString(), "GR");
                obj = null;
                if (intValue > 0)
                {
                    this.BindGrid();
                    strMsg = "Record deleted successfully.";
                    txtReceiptNo.Focus();
                }
                else
                {
                    if (intValue == -1)
                    {
                        strMsg = "Record can not be deleted. It is in use.";
                    }
                    else
                    {
                        strMsg = "Record not deleted.";
                    }
                }
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alertstrMsg", "PassMessage('" + strMsg + "')", true);
            }
            //else if (e.CommandName == "cmdstatus")
            //{
            //    int intCityIdno = 0;
            //    bool bStatus = false;
            //    string[] strStatus = Convert.ToString(e.CommandArgument).Split(new char[] { '_' });
            //    if (strStatus.Length > 1)
            //    {
            //        intCityIdno = Convert.ToInt32(strStatus[0]);
            //        if (Convert.ToBoolean(strStatus[1]) == true)
            //            bStatus = false;
            //        else
            //            bStatus = true;
            //        CityMastDAL objclsCityMaster = new CityMastDAL();
            //        int value = objclsCityMaster.UpdateStatus(intCityIdno, bStatus);
            //        objclsCityMaster = null;
            //        if (value > 0)
            //        {
            //            this.BindGrid();
            //            strMsg = "Status updated successfully.";
            //            drpState.Focus();
            //        }
            //        else
            //        {
            //            strMsg = "Status not updated.";
            //        }
            //        ScriptManager.RegisterStartupScript(this, this.GetType(), "alertstrMsg", "PassMessage('" + strMsg + "')", true);
            //    }
            //}
            //drpState.Focus();
        }