Ejemplo n.º 1
0
 public static DataSet GetAlertList(string field, string where)
 {
     return(DataHelper.GetList("Alerttable", field, where));
 }
Ejemplo n.º 2
0
 public static void DeleteAlert(string IDs)
 {
     DataHelper.DeleteByIDs("Alerttable", IDs);
 }
Ejemplo n.º 3
0
 public static void DeleteNote(string IDs)
 {
     DataHelper.DeleteByIDs("NoteTable", IDs);
 }
Ejemplo n.º 4
0
 public static DataSet GetAlertList()
 {
     return(DataHelper.GetAll("Alerttable"));
 }
Ejemplo n.º 5
0
 public static DataSet GetNoteList(string where)
 {
     return(DataHelper.GetListByDesc("NoteTable", where));
 }
Ejemplo n.º 6
0
 public static DataSet GetNoteList(string field, string where)
 {
     return(DataHelper.GetList("NoteTable", field, where));
 }
Ejemplo n.º 7
0
        public static void UpdateVisitNote(string ID, string body, decimal num, string contactor, string contactorType, string contractResult)
        {
            string sql = "Update NoteTable set body='{0}',Num1='{1}',contactor='{3}',contactorType='{4}', contractResult='{5}' where ID={2}";

            DataHelper.ExecuteQuerys(string.Format(sql, new object[] { body, num, ID, contactor, contactorType, contractResult }));
        }
Ejemplo n.º 8
0
 public static DataSet GetNoteList()
 {
     return(DataHelper.GetAll("NoteTable"));
 }
Ejemplo n.º 9
0
        public static void UpdateNote(string ID, string body, string tel, string phoneType, string contactor, string contactorType, string contractResult)
        {
            string sql = "Update NoteTable set body='{0}',Str1='{1}', Str2='{2}',contactor='{4}',contactorType='{5}', contractResult='{6}' where ID={3}";

            DataHelper.ExecuteQuerys(string.Format(sql, new object[] { body, tel, phoneType, ID, contactor, contactorType, contractResult }));
        }
Ejemplo n.º 10
0
        public static void UpdateNote(string ID, string body)
        {
            string sql = "Update NoteTable set body='{0}' where ID={1}";

            DataHelper.ExecuteQuerys(string.Format(sql, body, ID));
        }
Ejemplo n.º 11
0
        public static string GetLatestNoteTime(string companyID, string CaseID)
        {
            string sql = "select max(createon)  from notetable where companyid={0} and caseID={1}";

            return(DataHelper.ExecuteScalar(string.Format(sql, companyID, CaseID)).ToString());
        }
Ejemplo n.º 12
0
        public List <FoodsItems> getFoodsItemInGroup(MODEL.Criteria.reqeMenu req)
        {
            SqlConnection     conn = new SqlConnection(DataHelper.GetConnectionString());
            DataSet           ds   = new DataSet();
            List <FoodsItems> res  = new List <FoodsItems>();

            try
            {
                conn.Open();
                StringBuilder sqlstr = new StringBuilder();
                sqlstr.Append("select menu_id,menu_name,menu_description,menu_picture,menu_price,menu_flag_recommend");
                sqlstr.Append(",isnull(menu_price_S,0) as menu_price_S,isnull(menu_price_M,0) as menu_price_M,isnull(menu_price_L,0) as menu_price_L");
                sqlstr.Append(",menu_content");
                sqlstr.Append(" from tb_Menu");
                sqlstr.Append(" where flag = '1' and menu_activate =  '1'");
                sqlstr.Append(" and restaurant_id = '" + req.restaurantID + "'");
                sqlstr.Append(" and menu_category_lv1 ='" + req.MenuCategoryLV1ID + "'");
                sqlstr.Append(" and menu_category_lv2 ='" + req.MenuCategoryLV2ID + "'");
                //sqlstr.Append(" and restaurant_id = '" + req.restaurantID + "'");
                if (req.recommend == "1")
                {
                    sqlstr.Append(" and menu_flag_recommend = 1");
                }
                else if (req.recommend == "2")
                {
                    sqlstr.Append(" and menu_category_lv2 = 24");
                }
                else
                {
                }
                SqlDataAdapter adp = new SqlDataAdapter(sqlstr.ToString(), conn);
                adp.SelectCommand.CommandType = CommandType.Text;
                adp.Fill(ds);
                DataTable dt = new DataTable();
                dt = ds.Tables[0];
                if (dt.Rows.Count > 0)
                {
                    FoodsItems f;
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        f             = new FoodsItems();
                        f.foodsID     = dt.Rows[i]["menu_id"].ToString().Trim();
                        f.foodsName   = dt.Rows[i]["menu_name"].ToString().Trim();
                        f.content     = dt.Rows[i]["menu_content"].ToString().Trim();
                        f.description = dt.Rows[i]["menu_description"].ToString().Trim();
                        f.images      = DataHelper.PartHost + @"/ImagesFood/" + dt.Rows[i]["menu_picture"].ToString().Trim();//dt.Rows[i]["menu_picture"].ToString().Trim();
                        f.price       = Convert.ToDouble(dt.Rows[i]["menu_price"].ToString().Trim());
                        f.priceS      = Convert.ToDouble(dt.Rows[i]["menu_price_S"].ToString().Trim());
                        f.priceM      = Convert.ToDouble(dt.Rows[i]["menu_price_M"].ToString().Trim());
                        f.priceL      = Convert.ToDouble(dt.Rows[i]["menu_price_L"].ToString().Trim());
                        f.size        = "S";
                        res.Add(f);
                    }
                }
            }
            catch (Exception ex)
            {
                res = null;

                //throw ex;
            }
            finally
            {
                conn.Close();
            }
            return(res);
        }
Ejemplo n.º 13
0
        public eMenuFood getFoodseMenu(MODEL.Criteria.reqeMenu req)
        {
            SqlConnection conn = new SqlConnection(DataHelper.GetConnectionString());
            DataSet       ds   = new DataSet();
            eMenuFood     res  = new eMenuFood();

            try
            {
                conn.Open();
                StringBuilder sqlstr = new StringBuilder();
                sqlstr.Append("select menu.menu_id,LV1.category_lv1_id,LV1.category_lv1_name");
                sqlstr.Append(",LV2.category_lv2_id,LV2.category_lv2_name");
                sqlstr.Append(",menu.menu_name,menu.menu_description,menu.menu_price");
                sqlstr.Append(",menu.menu_picture,menu.menu_flag_recommend");
                sqlstr.Append(" from tb_Menu as menu");
                sqlstr.Append(" inner join tb_Category_LV1 as [LV1] on LV1.category_lv1_id = menu.menu_category_lv1");
                sqlstr.Append(" inner join tb_Category_LV2 as [LV2] on LV2.category_lv2_id = menu.menu_category_lv2");
                sqlstr.Append(" where menu.restaurant_id = '" + req.restaurantID + "'");

                //if (req.recommend == "1")
                //{
                //    sqlstr.Append(" and menu.menu_flag_recommend = '1'");
                //}
                //else if (req.recommend == "2")
                //{
                //    sqlstr.Append(" and LV2.category_lv2_id = 24");
                //}
                //else
                //{

                //}

                SqlDataAdapter adp = new SqlDataAdapter(sqlstr.ToString(), conn);
                adp.SelectCommand.CommandType = CommandType.Text;
                adp.Fill(ds);
                DataTable dt = new DataTable();
                //eMenuFood res = new eMenuFood();
                dt = ds.Tables[0];
                if (dt.Rows.Count > 0)
                {
                    res.ResultOk     = "true";
                    res.ErrorMessage = "";
                    List <eMenuFood>       listeMenu       = new List <eMenuFood>();
                    List <MODEL.FoodGroup> listMasterFoods = new List <MODEL.FoodGroup>();
                    List <MODEL.FoodGroup> listGroupFoods  = new List <MODEL.FoodGroup>();
                    MODEL.FoodGroup        MDrinks         = new FoodGroup();
                    List <FoodsItems>      listFoodsItem;
                    FoodsItems             FoodsItem;
                    FoodGroup MFoods;
                    //DataTable dtCategoryLV1 = new DataTable();
                    //dtCategoryLV1 = getCategoryeMenu(req);
                    //DataTable dtFood = new DataTable();
                    //DataRow[] rowsFoods = dt.Select("");
                    FoodGroup Group;
                    listGroupFoods = getCategoryeMenu(req);
                    foreach (FoodGroup item in listGroupFoods)
                    {
                        Group = new FoodGroup();
                        Group.foodsTypeIDLevel1   = item.foodsTypeIDLevel1;
                        Group.foodsTypeNameLevel1 = item.foodsTypeNameLevel1;
                        Group.foodsTypeIDLevel2   = item.foodsTypeIDLevel2;
                        Group.foodsTypeNameLevel2 = item.foodsTypeNameLevel2;
                        MODEL.Criteria.reqeMenu reqMenu = new MODEL.Criteria.reqeMenu();
                        reqMenu.restaurantID      = req.restaurantID;
                        reqMenu.MenuCategoryLV1ID = Group.foodsTypeIDLevel1;
                        reqMenu.MenuCategoryLV2ID = Group.foodsTypeIDLevel2;
                        reqMenu.recommend         = req.recommend;
                        listFoodsItem             = new List <FoodsItems>();
                        listFoodsItem             = getFoodsItemInGroup(reqMenu);
                        //FoodsItems model;
                        //foreach (FoodsItems itemFoods in listFoodsItem)
                        //{
                        //    model = new FoodsItems();
                        //    model = itemFoods;

                        //}
                        Group.foodsItems = listFoodsItem;
                        listMasterFoods.Add(Group);
                    }
                    res.CountMenu = "";
                    MODEL.Restaurant modelRestaurant = new MODEL.Restaurant();
                    modelRestaurant = svRestaurant.getRestaurant(req.restaurantID);
                    if (modelRestaurant != null)
                    {
                        res.restuarantName  = modelRestaurant.RestaurantName;
                        res.imageRestuarant = modelRestaurant.RestaurantImagePath;
                    }
                    else
                    {
                        res.restuarantName  = "";
                        res.imageRestuarant = "";
                    }

                    res.Data = listMasterFoods;
                    //foreach (DataRow row in rowsFoods)
                    //{
                    //    listFoodsItem = new List<FoodsItems>();
                    //    MFoods = new FoodGroup();
                    //    MFoods.foodsTypeIDLevel1 = row["category_lv1_id"].ToString().Trim();
                    //    MFoods.foodsTypeNameLevel1 = row["category_lv1_name"].ToString().Trim();
                    //    MFoods.foodsTypeIDLevel2 = row["category_lv2_id"].ToString().Trim();
                    //    MFoods.foodsTypeNameLevel2 = row["category_lv2_name"].ToString().Trim();
                    //    FoodsItem = new FoodsItems();
                    //    FoodsItem.foodID = row["menu_id"].ToString().Trim();
                    //    FoodsItem.foodName = row["menu_name"].ToString().Trim();
                    //    FoodsItem.Size = "";
                    //    FoodsItem.Price = row["menu_price"].ToString().Trim();
                    //    FoodsItem.Description = row["menu_description"].ToString().Trim();
                    //    FoodsItem.ImagePath = row["menu_picture"].ToString().Trim();
                    //    listFoodsItem.Add(FoodsItem);
                    //    MFoods.foodsItems = listFoodsItem;
                    //    listMFoods.Add(MFoods);
                    //    //Console.WriteLine("{0}, {1}", row[0], row[1]);
                    //}
                    //res.CountMenu = listMFoods.Count.ToString().Trim();
                    //res.Data = listMFoods;
                    //res.Data.Add(MDrinks);
                }
            }
            catch (Exception ex)
            {
                res.ResultOk     = "false";
                res.ErrorMessage = ex.Message;
                //throw ex;
            }
            finally
            {
                conn.Close();
            }
            return(res);
        }