Esempio n. 1
0
        private string updateaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Base.BusinessTaxRate bc = new project.Business.Base.BusinessTaxRate();
                bc.load(jp.getValue("id"));

                collection.Add(new JsonStringValue("SPNo", bc.Entity.SPNo));
                collection.Add(new JsonStringValue("SRVNo", bc.Entity.SRVNo));
                collection.Add(new JsonStringValue("Rate", bc.Entity.Rate.ToString("0.####")));
            }
            catch
            { flag = "2"; }

            collection.Add(new JsonStringValue("type", "update"));
            collection.Add(new JsonStringValue("flag", flag));

            return(collection.ToString());
        }
Esempio n. 2
0
        private string deleteaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Base.BusinessTaxRate bc = new project.Business.Base.BusinessTaxRate();
                bc.load(jp.getValue("id"));

                int r = bc.delete();
                if (r <= 0)
                {
                    flag = "2";
                }
            }
            catch { flag = "2"; }

            collection.Add(new JsonStringValue("type", "delete"));
            collection.Add(new JsonStringValue("flag", flag));
            collection.Add(new JsonStringValue("liststr", createList(jp.getValue("SPNoS"), jp.getValue("SRVNoS"), ParseIntForString(jp.getValue("page")))));

            return(collection.ToString());
        }
Esempio n. 3
0
        private string submitaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Base.BusinessTaxRate bc = new project.Business.Base.BusinessTaxRate();
                if (jp.getValue("tp") == "update")
                {
                    Data      obj = new Data();
                    DataTable dt  = obj.PopulateDataSet("select cnt=COUNT(*) from Mstr_TaxRate " +
                                                        "where SPNo='" + jp.getValue("SPNo") + "' and SRVNo='" + jp.getValue("SRVNo") + "' and RP<>'" + jp.getValue("id") + "'").Tables[0];
                    if (int.Parse(dt.Rows[0]["cnt"].ToString()) > 0)
                    {
                        flag = "3";
                    }
                    else
                    {
                        bc.load(jp.getValue("id"));
                        bc.Entity.SPNo       = jp.getValue("SPNo");
                        bc.Entity.SRVNo      = jp.getValue("SRVNo");
                        bc.Entity.Rate       = ParseDecimalForString(jp.getValue("Rate"));
                        bc.Entity.UpdateUser = user.Entity.UserName;
                        bc.Entity.UpdateDate = GetDate();
                        int r = bc.Save();

                        if (r <= 0)
                        {
                            flag = "2";
                        }
                    }
                }
                else
                {
                    Data      obj = new Data();
                    DataTable dt  = obj.PopulateDataSet("select cnt=COUNT(*) from Mstr_TaxRate where SPNo='" + jp.getValue("SPNo") + "' and SRVNo='" + jp.getValue("SRVNo") + "'").Tables[0];
                    if (int.Parse(dt.Rows[0]["cnt"].ToString()) > 0)
                    {
                        flag = "3";
                    }
                    else
                    {
                        bc.Entity.SPNo       = jp.getValue("SPNo");
                        bc.Entity.SRVNo      = jp.getValue("SRVNo");
                        bc.Entity.Rate       = ParseDecimalForString(jp.getValue("Rate"));
                        bc.Entity.CreateUser = user.Entity.UserName;
                        bc.Entity.CreateDate = GetDate();
                        bc.Entity.UpdateUser = user.Entity.UserName;
                        bc.Entity.UpdateDate = GetDate();
                        int r = bc.Save();
                        if (r <= 0)
                        {
                            flag = "2";
                        }
                    }
                }
            }
            catch { flag = "2"; }


            collection.Add(new JsonStringValue("type", "submit"));
            collection.Add(new JsonStringValue("flag", flag));
            collection.Add(new JsonStringValue("liststr", createList(jp.getValue("SPNoS"), jp.getValue("SRVNoS"), ParseIntForString(jp.getValue("page")))));
            return(collection.ToString());
        }