예제 #1
0
        protected void grdModel_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int rowIndex = int.Parse(e.CommandArgument.ToString());
            Session.Add("rowIndex", rowIndex);
            ManageModel ModelObj = new ManageModel();
            DataTable dt = ModelObj.getAModel(ConfigurationManager.ConnectionStrings["MVSSqlDev2008ConnectionString"].ConnectionString, rowIndex);

            if (dt.Rows.Count > 0)
            {
                DataRow dr = dt.Rows[0];
                txtModelName.Value = DBUtility.readDBString(dr, "Model_Name");
                lstManufacturerName.Value = DBUtility.readDBString(dr, "Manufacturer_Name");
                lstVehicleType.Value = DBUtility.readDBString(dr, "VehicleType_Name");
                if (dr["Disable"] != null && !dr.IsNull("Disable"))
                {
                    chkBoxModelDisable.Checked = Convert.ToBoolean(dr["Disable"]);
                }
            }
        }
예제 #2
0
        protected void btnSaveModel_ServerClick(object sender, EventArgs e)
        {
            ModelObject obj = new ModelObject();

            obj.Model_Name = txtModelName.Value;
            obj.Vehicle_Type = lstVehicleType.Value;
            obj.Manufacturer_Name = lstManufacturerName.Value;
            obj.Disable = chkBoxModelDisable.Checked;

            ManageModel modelObj = new ManageModel();

            bool success = modelObj.insert(obj, ConfigurationManager.ConnectionStrings["MVSSqlDev2008ConnectionString"].ConnectionString);

            if (success)
            {
                divSuccess.Visible = true;
            }
            else
                divFailure.Visible = true;
        }
예제 #3
0
        protected void btnSaveModel_ServerClick(object sender, EventArgs e)
        {
            ModelObject obj = new ModelObject();

            obj.Manufacturer_Name = lstManufacturerName.Value;
            obj.Model_Name = txtModelName.Value;
            obj.Vehicle_Type = lstVehicleType.Value;
            obj.Disable = chkBoxModelDisable.Checked;

            ManageModel ModelObj = new ManageModel();

            bool success = ModelObj.updateAModel(ConfigurationManager.ConnectionStrings["MVSSqlDev2008ConnectionString"].ConnectionString, obj, Convert.ToInt32(Session["rowIndex"]));

            if (success)
            {
                divSuccess.Visible = true;
            }
            else
                divFailure.Visible = true;

            Session.Remove("rowIndex");
        }
        private void bindLstModel()
        {
            ManageModel manageModel = new ManageModel();

            var lstModel = manageModel.getModelList(ConfigurationManager.ConnectionStrings["MVSSqlDev2008ConnectionString"].ConnectionString);
            lstVehicleModelName.DataSource = lstModel;
            lstVehicleModelName.DataTextField = "Model_Name";
            lstVehicleModelName.DataValueField = "Model_Name";
            lstVehicleModelName.DataBind();
        }
예제 #5
0
 protected void grdModel_Load(object sender, EventArgs e)
 {
     ManageModel ModelObj = new ManageModel();
     grdModel.DataSource = ModelObj.getModelInfo(ConfigurationManager.ConnectionStrings["MVSSqlDev2008ConnectionString"].ConnectionString);
     grdModel.DataBind();
 }