Exemplo n.º 1
0
        public void GetMaxNo()
        {
            string message = string.Empty;

            try
            {
                string    record = this.Request["record"];
                Hashtable ht     = JavaScriptConvert.DeserializeObject <Hashtable>(record);

                BaseBll bll = new BaseBll();

                if (ht["field"].ToString().Equals(string.Empty))
                {
                    message = "{status:'success',msg:''}";
                }
                else
                {
                    int?list = bll.GetMaxNo(ht["tablename"].ToString(), ht["field"].ToString());

                    string sMax = string.Empty;

                    if (!list.HasValue)
                    {
                        sMax = "1";
                    }
                    else
                    {
                        sMax = Convert.ToString(list + 1);
                    }

                    message = "{status:'success',msg:'" + sMax + "'}";
                }
            }
            catch (Exception ex)
            {
                message = "{status:'fail',msg:''}";;
            }
            Response.Output.Write(message);
        }