コード例 #1
0
 public DataTable GetVehicleTypes(VehicleType_ML ml)
 {
     try
     {
         var DataDic = new Dictionary<string, object>();
         return new DBAccessController().RetriveRecordsWithPara(StoredProcedures.sp_GetVehicleTypes, DataDic);
     }
     catch
     {
         throw;
     }
 }
コード例 #2
0
        protected void btnUpdate_ServerClick(object sender, EventArgs e)
        {
            try
            {
                var ml = new VehicleType_ML(gridVehicleTypes.GetSelectedFieldValues("VehicleTypeID")[0].ToString(), txtName.Text);
                new VehicleType_BL().UpdateVehicletype(ml);
                GetVehicleTypes();
            }
            catch (Exception)
            {

                throw;
            }
        }
コード例 #3
0
        private void BindModels()
        {
            try
            {
                var ml = new VehicleType_ML();
                ddlModel.DataTextField = "Model";
                ddlModel.DataValueField = "Model";
                ddlModel.DataSource = new Policy_BL().GetAllModels();
                ddlModel.DataBind();
            }
            catch (Exception)
            {

                throw;
            }
        }
コード例 #4
0
        private void BindTypes()
        {
            try
            {
                var ml = new VehicleType_ML();
                ddlType.DataTextField = "VehicleTypeName";
                ddlType.DataValueField = "VehicleTypeID";
                ddlType.DataSource = new VehicleType_BL().GetVehicleTypes(ml);
                ddlType.DataBind();
            }
            catch (Exception)
            {

                throw;
            }
        }
コード例 #5
0
 public bool DeleteVehicletype(VehicleType_ML ml)
 {
     try
     {
         var DataDic = new Dictionary<string, object>
         {
             {"@Id", ml.VehicleTypeID}
         };
         return new DBAccessController().DeleteRecord(StoredProcedures.sp_RemoveVehicleType, DataDic);
     }
     catch (Exception)
     {
         
         throw;
     }
 }
コード例 #6
0
        protected void btnSave_ServerClick(object sender, EventArgs e)
        {
            try
            {
                var ml = new VehicleType_ML()
                {
                    VehicleType = txtName.Text
                };
                new VehicleType_BL().AddVehicletype(ml);
                GetVehicleTypes();
            }
            catch (Exception)
            {

                throw;
            }
        }
コード例 #7
0
        private void GetVehicleTypes()
        {
            try
            {
                var ml = new VehicleType_ML()
                {

                };
                gridVehicleTypes.DataSource = new VehicleType_BL().GetVehicleTypes(ml);
                gridVehicleTypes.DataBind();
            }
            catch (Exception)
            {

                throw;
            }
        }
コード例 #8
0
        public bool UpdateVehicletype(VehicleType_ML ml)
        {
            try
            {
                var DataDic = new Dictionary<string, object>
                {
                    {"@Id", ml.VehicleTypeID},
                    {"@VehicleTypeName", ml.VehicleType}
                };

                return new DBAccessController().InsertRecord(StoredProcedures.sp_UpdateVehicleType, DataDic);
            }
            catch (Exception)
            {
                
                throw;
            }
        }
コード例 #9
0
        public DataTable GetVehicleTypes(VehicleType_ML ml)
        {
            DataTable dt = new DataTable();

            try
            {
                con = new SqlConnection(connectionString);
                con.Open();

                cmd = new SqlCommand("[sp_GetVehicleTypes]", con) { CommandType = CommandType.StoredProcedure };
                adp = new SqlDataAdapter(cmd);
                adp.Fill(dt);
                return dt;
            }
            catch (SqlException ex)
            {
                return dt;
            }
            finally
            {
                con.Close();
                con.Dispose();
            }
        }
コード例 #10
0
        protected void btnDelete_ServerClick(object sender, EventArgs e)
        {
            try
            {
                if (gridVehicleTypes.Selection.Count > 0)
                {
                    var ml = new VehicleType_ML()
                    {
                        VehicleTypeID = (Int32)gridVehicleTypes.GetSelectedFieldValues("VehicleTypeID")[0]
                    };
                    new VehicleType_BL().DeleteVehicletype(ml);
                    GetVehicleTypes();
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "script", "<script type='text/javascript'>$( document ).ready(function() { $('#SelectErrorModal').modal('show')});</script>", false);
                }
                
            }
            catch (Exception)
            {

                throw;
            }
        }