Beispiel #1
0
        protected void btnClick_btnAddVehicleMaintenanceCost(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                int checkvehicleno;
                checkvehicleno = Convert.ToInt32(dpVehicleNo.SelectedItem.Value);
                if (checkvehicleno != 0)
                {
                    transportdata   = new TransportData();
                    transport       = new Transports();
                    transport.ID    = 0;
                    transport.TM_Id = Convert.ToInt32(dpVehicleNo.SelectedItem.Value);


                    transport.pucdate    = string.IsNullOrEmpty(txtPucStartDate.Text.ToString()) ? string.Empty : (Convert.ToDateTime(txtPucStartDate.Text)).ToString("dd-MM-yyyy");
                    transport.pucenddate = string.IsNullOrEmpty(txtPUCEndDate.Text.ToString()) ? string.Empty : (Convert.ToDateTime(txtPUCEndDate.Text)).ToString("dd-MM-yyyy");

                    transport.pucamt = string.IsNullOrEmpty(txtPUCAmt.Text.ToString()) ? 0 : Convert.ToDouble(txtPUCAmt.Text);



                    transport.CreatedBy = GlobalInfo.Userid;
                    if (dpIsActive.SelectedItem.Value == "1")
                    {
                        transport.IsActive = true;
                    }
                    else if (dpIsActive.SelectedItem.Value == "2")
                    {
                        transport.IsActive = false;
                    }
                    else if (dpIsActive.SelectedItem.Value == "0")
                    {
                        transport.IsActive = true;
                    }

                    transport.Createddate  = DateTime.Now.ToString("dd-MM-yyyy");
                    transport.ModifiedBy   = GlobalInfo.Userid;
                    transport.ModifiedDate = DateTime.Now.ToString("dd-MM-yyyy");
                    transport.flag         = "Insert";
                    int Result = 0;

                    Result = transportdata.AddVehiclePUCDetailsInfo(transport);
                    if (Result > 0)
                    {
                        divDanger.Visible   = false;
                        divwarning.Visible  = false;
                        divSusccess.Visible = true;
                        lblSuccess.Text     = "PUC Maintenance Added  Successfully";

                        ClearTextBox();
                        BindVehicleOperationInfo();
                        pnlError.Update();
                        upMain.Update();
                        uprouteList.Update();
                    }
                    else
                    {
                        divDanger.Visible   = false;
                        divwarning.Visible  = true;
                        divSusccess.Visible = false;
                        lblwarning.Text     = "Please Contact to Site Admin";
                        pnlError.Update();
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage",
                                                        "alert('Please select Vehicle Number!');", true);
                }
            }
        }
Beispiel #2
0
        public void DeleteMapbyID(int ID)
        {
            transportdata = new TransportData();
            transport     = new Transports();
            transport.ID  = Convert.ToInt32(ID);


            transport.TM_Id = 0;



            transport.TM_Id = Convert.ToInt32(dpVehicleNo.SelectedItem.Value);

            transport.pucdate    = (Convert.ToDateTime(txtPucStartDate.Text)).ToString("dd-MM-yyyy");
            transport.pucenddate = (Convert.ToDateTime(txtPUCEndDate.Text)).ToString("dd-MM-yyyy");


            transport.pucamt = Convert.ToDouble(txtPUCAmt.Text);



            transport.CreatedBy = GlobalInfo.Userid;
            dpIsActive.ClearSelection();
            if (DS.Tables[0].Rows[0]["IsActive"].ToString() == "True")
            {
                dpIsActive.Items.FindByValue("1").Selected = true;
            }
            if (DS.Tables[0].Rows[0]["IsActive"].ToString() == "False")
            {
                dpIsActive.Items.FindByValue("2").Selected = true;
            }

            //DateTime time = DateTime.Parse(string.Format("{0}:{1}:{2} {3}", TimeSelector1.Hour, TimeSelector1.Minute, TimeSelector1.Second, TimeSelector1.AmPm));
            ////product.IsActive = true;
            //time.ToString();
            transport.Createddate  = DateTime.Now.ToString("dd-MM-yyyy");
            transport.ModifiedBy   = GlobalInfo.Userid;
            transport.ModifiedDate = DateTime.Now.ToString("dd-MM-yyyy");
            transport.flag         = "Delete";
            int Result = 0;

            Result = transportdata.AddVehiclePUCDetailsInfo(transport);
            if (Result > 0)
            {
                divDanger.Visible   = false;
                divwarning.Visible  = false;
                divSusccess.Visible = true;
                lblSuccess.Text     = "PUC Maintenance Deleted  Successfully";

                ClearTextBox();
                BindVehicleOperationInfo();
                pnlError.Update();
                upMain.Update();
                uprouteList.Update();
            }
            else
            {
                divDanger.Visible   = false;
                divwarning.Visible  = true;
                divSusccess.Visible = false;
                lblwarning.Text     = "Please Contact to Site Admin";
                pnlError.Update();
            }
        }