Exemple #1
0
    public string UpdateItem(ItemToDB obj)
    {
        _cnn.Open();
        string ItemId = FindRahroDuplicateItem(obj);

        if (ItemId != "null")
        {
            return(new JavaScriptSerializer().Serialize(GetRahroDuplicateItem(ItemId)));
        }
        var up = new SqlCommand("UPDATE [dbo].[depo] " +
                                "SET [item] = " + obj.ItemId + " " +
                                ",[darage] = " + obj.Darage + " " +
                                ",[gol] = " + obj.GolId + " " +
                                ",[tedad] = " + obj.Tedad + " " +
                                ",[shelf] = N'" + obj.Shelf + "' " +
                                ",[basket] = N'" + obj.Basket + "' " +
                                ",[arr] = " + obj.ArrangeId + " " +
                                ",[darb] = " + Convert.ToInt32(obj.Darb) + "" +
                                ",[abgoriz] = '" + obj.Abgoriz.ToString().ToLower() + "' " +
                                ",[antibacterial] = '" + obj.AntiBacterial.ToString().ToLower() + "' " +
                                " WHERE id = " + obj.Id + " " +
                                " delete from depo where tedad = 0 ", _cnn);

        up.ExecuteNonQuery();
        _cnn.Close();
        return("");
    }
Exemple #2
0
    public void SaveItem(ItemToDB obj)
    {
        _cnn.Open();
        var ins = new SqlCommand("insert into Decor_Personel (per_id,item_id,flower_id,grade,count,tarikh)values" +
                                 "(" + obj.PerId + "," + obj.ItemId + "," + obj.GolId + "," + obj.Darage + "," + obj.Tedad + ",'" + obj.Tarikh + "')", _cnn);

        ins.ExecuteNonQuery();
        _cnn.Close();
    }
Exemple #3
0
    public void SaveRecordPer(ItemToDB obj)
    {
        _cnn.Open();
        var ins = new SqlCommand("if(select count(perid) from Decor_time where perid=" + obj.PerId + " and tarikh='" + obj.Tarikh + "') = 0 begin insert into Decor_time (perid,rectime,tarikh)values" +
                                 "(" + obj.PerId + "," + obj.Tedad + ",'" + obj.Tarikh + "') end", _cnn);

        ins.ExecuteNonQuery();
        _cnn.Close();
    }
Exemple #4
0
    public void UpdateDecorTime(ItemToDB obj)
    {
        _cnn.Open();

        var up = new SqlCommand("UPDATE Decor_time " +
                                "SET [perid] = " + obj.PerId + " " +
                                ",[rectime] =" + obj.Tedad + "" +
                                "WHERE id = " + obj.Id + " " +
                                "  ", _cnn);

        up.ExecuteNonQuery();
        _cnn.Close();
    }
Exemple #5
0
    public void UpdateItem(ItemToDB obj)
    {
        _cnn.Open();

        var up = new SqlCommand("UPDATE Decor_Personel " +
                                "SET [per_id] = " + obj.PerId + " " +
                                ",[item_id] = " + obj.ItemId + " " +
                                ",[flower_id] = " + obj.GolId + " " +
                                ",[grade] = " + obj.Darage + " " +
                                ",[count] =" + obj.Tedad + "" +
                                "WHERE id = " + obj.Id + " " +
                                "  ", _cnn);

        up.ExecuteNonQuery();
        _cnn.Close();
    }
Exemple #6
0
    private string FindRahroDuplicateItem(ItemToDB obj)
    {
        var checkDup = new SqlCommand("if (select id from depo where item = " + obj.ItemId + " and darage = " + obj.Darage + " and" +
                                      " gol = " + obj.GolId + " and darb = " + Convert.ToInt32(obj.Darb) + " and arr = " + obj.ArrangeId + " " +
                                      "and abgoriz = " + (obj.Abgoriz ? 1 : 0) + " and antibacterial = " + (obj.AntiBacterial ? 1 : 0) + " and" +
                                      " shelf = '" + obj.Shelf + "' and basket = '" + obj.Basket + "') > 0 " +
                                      " begin " +
                                      "select id from depo where item = " + obj.ItemId + " and darage = " + obj.Darage + " and " +
                                      "gol = " + obj.GolId + " and darb = " + Convert.ToInt32(obj.Darb) + " and arr = " + obj.ArrangeId + " " +
                                      "and abgoriz = " + (obj.Abgoriz ? 1 : 0) + " and antibacterial = " + (obj.AntiBacterial ? 1 : 0) + " and " +
                                      " shelf = '" + obj.Shelf + "' and basket = '" + obj.Basket + "' " +
                                      "end  " +
                                      "else begin select 'null' end", _cnn);

        return(checkDup.ExecuteScalar().ToString());
    }
Exemple #7
0
    public string SaveItem(ItemToDB obj)
    {
        _cnn.Open();
        string ItemId = FindRahroDuplicateItem(obj);

        if (ItemId != "null")
        {
            return(new JavaScriptSerializer().Serialize(GetRahroDuplicateItem(ItemId)));
        }
        var ins = new SqlCommand("insert into depo (item,darage,gol,tedad,shelf,basket,arr,darb,abgoriz,antibacterial)values" +
                                 "(" + obj.ItemId + "," + obj.Darage + "," + obj.GolId + "," + obj.Tedad + ",N'" + obj.Shelf + "'," +
                                 "N'" + obj.Basket + "'," + obj.ArrangeId + "," + Convert.ToInt32(obj.Darb) + " " +
                                 ", '" + obj.Abgoriz.ToString().ToLower() + "' , '" + obj.AntiBacterial.ToString().ToLower() + "')", _cnn);

        ins.ExecuteNonQuery();
        _cnn.Close();
        return("");
    }