public ActionResult UpdateKit(tbl_kit kitUpdate)
        {
            db.Database.ExecuteSqlCommand("UPDATE cmps411.tbl_kit SET kitID={0},description={1},filePath={2}, " +
                                          "descKitItem_1={4}, partNoKitItem_1={5}, " +
                                          "descKitItem_2={6}, partNoKitItem_2={7}, " +
                                          "descKitItem_3={8}, partNoKitItem_3={9}, " +
                                          "descKitItem_4={10}, partNoKitItem_4={11}, " +
                                          "descKitItem_5={12}, partNoKitItem_5={13}, " +
                                          "descKitItem_6='', partNoKitItem_6='', " +   //not used
                                          "descKitItem_7='', partNoKitItem_7='', " +   //not used
                                          "descKitItem_8='', partNoKitItem_8='', " +   //not used
                                          "descKitItem_9='', partNoKitItem_9='', " +   //not used
                                          "descKitItem_10='', partNoKitItem_10='', " + //not used

                                          "infoPackage={24}, mechDrawing={25}, priceSheet={26} " +

                                          "WHERE id={3}",

                                          kitUpdate.kitID, kitUpdate.description, kitUpdate.filePath, kitUpdate.id,
                                          kitUpdate.descKitItem_1, kitUpdate.partNoKitItem_1,
                                          kitUpdate.descKitItem_2, kitUpdate.partNoKitItem_2,
                                          kitUpdate.descKitItem_3, kitUpdate.partNoKitItem_3,
                                          kitUpdate.descKitItem_4, kitUpdate.partNoKitItem_4,
                                          kitUpdate.descKitItem_5, kitUpdate.partNoKitItem_5,
                                          kitUpdate.descKitItem_6, kitUpdate.partNoKitItem_6,   //not used
                                          kitUpdate.descKitItem_7, kitUpdate.partNoKitItem_7,   //not used
                                          kitUpdate.descKitItem_8, kitUpdate.partNoKitItem_8,   //not used
                                          kitUpdate.descKitItem_9, kitUpdate.partNoKitItem_9,   //not used
                                          kitUpdate.descKitItem_10, kitUpdate.partNoKitItem_10, //not used
                                          kitUpdate.infoPackage, kitUpdate.mechDrawing, kitUpdate.priceSheet);

            return(RedirectToAction("Index"));
        }
        public ActionResult AddKit(tbl_kit kitAdd)
        {
            db.Database.ExecuteSqlCommand("Insert into cmps411.tbl_kit Values ({0},{1},{2}," +
                                          "{3},{4}," +
                                          "{5},{6}," +
                                          "{7},{8}," +
                                          "{9},{10}," +
                                          "{11}, {12}," +
                                          "'', '', " + //not used
                                          "'', '', " + //not used
                                          "'', ''," +  //not used
                                          "'', ''," +  //not used
                                          "'', ''," +  //not used
                                          "{23},{24},{25})",

                                          kitAdd.kitID, kitAdd.description, kitAdd.filePath,
                                          kitAdd.descKitItem_1, kitAdd.partNoKitItem_1,
                                          kitAdd.descKitItem_2, kitAdd.partNoKitItem_2,
                                          kitAdd.descKitItem_3, kitAdd.partNoKitItem_3,
                                          kitAdd.descKitItem_4, kitAdd.partNoKitItem_4,
                                          kitAdd.descKitItem_5, kitAdd.partNoKitItem_5,
                                          kitAdd.descKitItem_6, kitAdd.partNoKitItem_6,
                                          kitAdd.descKitItem_7, kitAdd.partNoKitItem_7,
                                          kitAdd.descKitItem_8, kitAdd.partNoKitItem_8,
                                          kitAdd.descKitItem_9, kitAdd.partNoKitItem_9,
                                          kitAdd.descKitItem_10, kitAdd.partNoKitItem_10,
                                          kitAdd.infoPackage, kitAdd.mechDrawing, kitAdd.priceSheet);

            return(new EmptyResult());
        }
Пример #3
0
        public ActionResult DeleteKit(tbl_kit kitDelete)
        {
            tbl_kit tbl_kit = db.tbl_kit.Find(kitDelete.id);

            db.tbl_kit.Remove(tbl_kit);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public void GetKitInfoByKitID(string kitID)
        {
            string         cs       = ConfigurationManager.ConnectionStrings["allpax_sale_minerEntities"].ConnectionString;
            List <tbl_kit> KitInfos = new List <tbl_kit>();

            using (SqlConnection con = new SqlConnection(cs))
            {
                // begin empty and build custEqpmtWkitsAvlbl and custEqpmtWkitsInstld tables
                //this is handled by a stored procedure on the sql server named dbo.bldSalesOppsTables
                con.Open();
                //SqlCommand sqlcomm1 = new SqlCommand("dbo.bldSalesOppsTables", con);
                //sqlcomm1.CommandType = System.Data.CommandType.StoredProcedure;
                //sqlcomm1.ExecuteNonQuery();
                //end empty and build custEqpmtWkitsAvlbl and custEqpmtWkitsInstld tables

                SqlCommand cmd = new SqlCommand("spGetKitInfoByKitID", con);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlParameter param = new SqlParameter()
                {
                    ParameterName = "@kitID",
                    Value         = kitID
                };
                cmd.Parameters.Add(param);
                //con.Open();
                SqlDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    tbl_kit KitInfo = new tbl_kit();

                    KitInfo.kitID           = rdr["kitID"].ToString();
                    KitInfo.description     = rdr["description"].ToString();
                    KitInfo.filePath        = rdr["filePath"].ToString();
                    KitInfo.descKitItem_1   = rdr["descKitItem_1"].ToString();
                    KitInfo.partNoKitItem_1 = rdr["partNoKitItem_1"].ToString();
                    KitInfo.descKitItem_2   = rdr["descKitItem_2"].ToString();
                    KitInfo.partNoKitItem_2 = rdr["partNoKitItem_2"].ToString();
                    KitInfo.descKitItem_3   = rdr["descKitItem_3"].ToString();
                    KitInfo.partNoKitItem_3 = rdr["partNoKitItem_3"].ToString();
                    KitInfo.descKitItem_4   = rdr["descKitItem_4"].ToString();
                    KitInfo.partNoKitItem_4 = rdr["partNoKitItem_4"].ToString();
                    KitInfo.descKitItem_5   = rdr["descKitItem_5"].ToString();
                    KitInfo.partNoKitItem_5 = rdr["partNoKitItem_5"].ToString();

                    KitInfo.infoPackage = rdr["infoPackage"].ToString();
                    KitInfo.mechDrawing = rdr["mechDrawing"].ToString();
                    KitInfo.priceSheet  = rdr["priceSheet"].ToString();

                    KitInfos.Add(KitInfo);
                }
            }
            JavaScriptSerializer js = new JavaScriptSerializer();

            Context.Response.Write(js.Serialize(KitInfos));
        }
Пример #5
0
        public ActionResult UpdateKit(tbl_kit kitUpdate)
        {
            using (allpax_sale_minerEntities entities = new allpax_sale_minerEntities())
            {
                tbl_kit updatedKit = (from c in entities.tbl_kit
                                      where c.id == kitUpdate.id
                                      select c).FirstOrDefault();
                updatedKit.kitID       = kitUpdate.kitID;
                updatedKit.description = kitUpdate.description;
                updatedKit.filePath    = kitUpdate.filePath;

                entities.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }
Пример #6
0
        public ActionResult AddKit(tbl_kit kitAdd)
        {
            using (allpax_sale_minerEntities entities = new allpax_sale_minerEntities())
            {
                entities.tbl_kit.Add(new tbl_kit
                {
                    kitID       = kitAdd.kitID,
                    description = kitAdd.description,
                    filePath    = kitAdd.filePath,
                });


                entities.SaveChanges();
            }

            return(new EmptyResult());
        }
 public ActionResult DeleteKit(tbl_kit kitDelete)
 {
     db.Database.ExecuteSqlCommand("DELETE FROM cmps411.tbl_kit WHERE id=({0})", kitDelete.id);
     return(RedirectToAction("Index"));
 }