public void ProcessRequest(HttpContext context)
        {
            SqlConnection conn = new SqlConnection(strcon);
            long          PKID = 0;

            try
            {
                if (context.Request.QueryString["objname"] != null)
                {
                    objname = context.Request.QueryString["objname"].ToString();
                }
                if (context.Request.QueryString["oid"] != null)
                {
                    orderID = long.Parse(context.Request.QueryString["oid"]);
                }
                if (context.Request.QueryString["wrid"] != null)
                {
                    WarehouseID = long.Parse(context.Request.QueryString["wrid"]);
                }
                if (context.Request.QueryString["serialno"] != null)
                {
                    serialno = (context.Request.QueryString["serialno"]).ToString();
                }
                if (context.Request.QueryString["uid"] != null)
                {
                    UserID = Convert.ToInt64(context.Request.QueryString["uid"]);
                }
                if (context.Request.QueryString["page"] != null)
                {
                    page = (context.Request.QueryString["page"]).ToString();
                }
                if (context.Request.QueryString["loc"] != null)
                {
                    LocID = Convert.ToInt64(context.Request.QueryString["loc"]);
                }
                DataSet dsUserDetail = new DataSet();
                dsUserDetail = GetUserDetails(UserID);
                CompanyID    = long.Parse(dsUserDetail.Tables[0].Rows[0]["CompanyID"].ToString());
                CustomerID   = long.Parse(dsUserDetail.Tables[0].Rows[0]["CustomerID"].ToString());

                long PrdID = 0;
                PrdID = GetPrdID(serialno, CompanyID, CustomerID);
                if (PrdID == 0)
                {
                    PrdID = GetPrdIDNew(serialno, CompanyID, CustomerID);
                }
                if (PrdID == 0)
                {
                    PrdID = GetPrdIDNewCode(serialno, CompanyID, CustomerID);
                }
                if (PrdID == 0)
                {
                    string[] prodid = serialno.Split('_');
                    string   batch  = "Batch-" + prodid[1].ToString();
                    PrdID = GetPrdIDNewCodeMarvel(Convert.ToInt64(prodid[0]), CompanyID, CustomerID);
                    if (PrdID > 0)
                    {
                        batchflag = "yes";
                        if (objname == "SalesOrder")
                        {
                            IsBatch = CheckSKUInBatch(orderID.ToString(), "", PrdID, batch);
                        }
                        else
                        {
                            IsBatch = CheckSKUInBatch("", orderID.ToString(), PrdID, batch);
                        }
                    }
                }
                context.Response.ContentType = "text/plain";
                String jsonString = String.Empty;
                jsonString = "{\n";   /*json Loop Start*/
                jsonString = jsonString + "\"result\":[{\n";
                if (PrdID == 0)
                {
                    jsonString = jsonString + "\"status\": \"failed\",\n";
                    jsonString = jsonString + "\"reason\": \"SKU Not Available\"\n";
                }
                else if (IsBatch == 0 && batchflag == "yes")
                {
                    jsonString = jsonString + "\"status\": \"failed\",\n";
                    jsonString = jsonString + "\"reason\": \"SKU Not Available in Batch\"\n";
                }
                else
                {
                    DataTable dtorder = new DataTable();
                    dtorder = CheckSKUInOrder(PrdID, orderID, objname);
                    if (dtorder.Rows.Count > 0)
                    {
                        DataTable dtstock = new DataTable();
                        dtstock = SrNoInStock(serialno, CustomerID, LocID, PrdID);
                        if (dtstock.Rows.Count > 0)
                        {
                            DataTable dtsrno = new DataTable();
                            dtsrno = CheckDuplicateSrNo(serialno, CompanyID, CustomerID, page, objname);
                            if (dtsrno.Rows.Count > 0)
                            {
                                jsonString = jsonString + "\"status\": \"failed\",\n";
                                jsonString = jsonString + "\"reason\": \"Serial number already used\"\n";
                            }
                            else
                            {
                                decimal pkqty = GetPkQty(orderID, objname, PrdID);
                                decimal oqty  = GetOrderQty(orderID, objname, PrdID);
                                if (pkqty >= oqty)
                                {
                                    jsonString = jsonString + "\"status\": \"failed\",\n";
                                    jsonString = jsonString + "\"reason\": \"You have already reached max count\"\n";
                                }
                                else
                                {
                                    iOutboundClient outbound = new iOutboundClient();
                                    string          userName = GetUserID(UserID);
                                    CustomProfile   profile  = CustomProfile.GetProfile(userName);
                                    tPickUpHead     pk       = new tPickUpHead();
                                    pk.ObjectName   = objname;
                                    pk.OID          = orderID;
                                    pk.PickUpDate   = DateTime.Now;
                                    pk.PickUpBy     = UserID;
                                    pk.Remark       = "";
                                    pk.CreatedBy    = UserID;
                                    pk.CreationDate = DateTime.Now;
                                    pk.Status       = getStatus(objname);
                                    pk.CompanyID    = CompanyID;
                                    pk.CustomerID   = CustomerID;
                                    pk.PickUpStatus = true;
                                    PKID            = GetPickUpStatus(orderID, objname, UserID);
                                    if (PKID == 0)
                                    {
                                        PKID = outbound.SavetPickUpHead(pk, profile.DBConnection._constr);
                                    }
                                    if (PKID > 0)
                                    {
                                        int save = SavePickUpDetail(orderID, objname, PKID, PrdID, 1, LocID, serialno);
                                        SaveLottablePickUp(serialno, objname, PKID, PrdID, 1, CompanyID, CustomerID, LocID);
                                        iInboundClient Inbound = new iInboundClient();
                                        string         WorkFlow = "", NextObject = "";
                                        int            count = 0;
                                        long           QCID  = 0;
                                        if (objname == "SalesOrder")
                                        {
                                            WorkFlow   = "Outbound";
                                            NextObject = "QC";
                                        }
                                        if (objname == "Transfer")
                                        {
                                            WorkFlow   = "Transfer";
                                            NextObject = "QCOut";
                                        }
                                        count = GetWorkFlow(profile.Personal.CompanyID, profile.Personal.CustomerId, WorkFlow, NextObject, profile.DBConnection._constr);
                                        if (count == 0)
                                        {
                                            WMSOutbound.tQualityControlHead QCHead = new WMSOutbound.tQualityControlHead();
                                            QCHead.CreatedBy    = profile.Personal.UserID;
                                            QCHead.Creationdate = DateTime.Now;
                                            QCHead.ObjectName   = objname;
                                            QCHead.OID          = PKID;
                                            QCHead.QCDate       = DateTime.Now;
                                            QCHead.QCBy         = profile.Personal.UserID;
                                            QCHead.Remark       = "";

                                            if (objname == "SalesOrder")
                                            {
                                                QCHead.Status = 32;
                                            }
                                            else if (objname == "Transfer")
                                            {
                                                QCHead.Status = 58;
                                            }

                                            QCHead.Company    = profile.Personal.CompanyID;
                                            QCHead.CustomerID = profile.Personal.CustomerId;
                                            QCID = GetQCStatus(PKID, objname, UserID);
                                            if (QCID == 0)
                                            {
                                                QCID = Inbound.SavetQualityControlHead(QCHead, profile.DBConnection._constr);
                                            }
                                            if (QCID > 0)
                                            {
                                                SaveQCDetails(PKID, QCID, PrdID, 1);
                                            }
                                        }
                                        if (save > 0)
                                        {
                                            jsonString = jsonString + "\"status\": \"success\",\n";
                                            jsonString = jsonString + "\"reason\": \"\"\n";
                                        }
                                        else
                                        {
                                            jsonString = jsonString + "\"status\": \"failed\",\n";
                                            jsonString = jsonString + "\"reason\": \"Server error occured\"\n";
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            jsonString = jsonString + "\"status\": \"failed\",\n";
                            jsonString = jsonString + "\"reason\": \"Serial No. not available in Stock OR Location\"\n";
                        }
                    }
                    else
                    {
                        jsonString = jsonString + "\"status\": \"failed\",\n";
                        jsonString = jsonString + "\"reason\": \"SKU Not Available In Order\"\n";
                    }
                }

                jsonString = jsonString + "}]\n";
                jsonString = jsonString + "}\n"; /*json Loop End*/
                context.Response.Write(jsonString);
            }
            catch (Exception ex)
            { Login.Profile.ErrorHandling(ex, "pickup_scan_serial_and_save", "ProcessRequest"); }
            finally
            { }
        }
示例#2
0
        public void ProcessRequest(HttpContext context)
        {
            SqlConnection conn = new SqlConnection(strcon);
            long          PKID = 0;

            try
            {
                if (context.Request.Form["oid"] != null)
                {
                    OrderID = long.Parse(context.Request.Form["oid"]);
                }
                if (context.Request.Form["wrid"] != null)
                {
                    WarehouseID = long.Parse(context.Request.Form["wrid"]);
                }
                if (context.Request.Form["uid"] != null)
                {
                    UserID = long.Parse(context.Request.Form["uid"]);
                }
                if (context.Request.Form["objname"] != null)
                {
                    objname = context.Request.Form["objname"].ToString();
                }

                DataSet dsUserDetail = new DataSet();
                long    CustomerID, CompanyID;
                dsUserDetail = GetUserDetails(UserID);
                CompanyID    = long.Parse(dsUserDetail.Tables[0].Rows[0]["CompanyID"].ToString());
                CustomerID   = long.Parse(dsUserDetail.Tables[0].Rows[0]["CustomerID"].ToString());

                iOutboundClient outbound = new iOutboundClient();
                string          userName = GetUserID(UserID);
                CustomProfile   profile  = CustomProfile.GetProfile(userName);
                tPickUpHead     pk       = new tPickUpHead();
                pk.ObjectName   = objname;
                pk.OID          = OrderID;
                pk.PickUpDate   = DateTime.Now;
                pk.PickUpBy     = UserID;
                pk.Remark       = "";
                pk.CreatedBy    = UserID;
                pk.CreationDate = DateTime.Now;
                string WorkFlow = "", NextObject = "";
                if (objname == "SalesOrder")
                {
                    WorkFlow   = "Outbound";
                    NextObject = "QC";
                }
                if (objname == "Transfer")
                {
                    WorkFlow   = "Transfer";
                    NextObject = "QCOut";
                }
                int count = GetWorkFlow(CompanyID, CustomerID, WorkFlow, NextObject, profile.DBConnection._constr);
                if (objname == "SalesOrder")
                {
                    if (count == 0)
                    {
                        pk.Status = 32;
                    }
                    else
                    {
                        pk.Status = 38;
                    }
                }
                if (objname == "Transfer")
                {
                    if (count == 0)
                    {
                        pk.Status = 58;
                    }
                    else
                    {
                        pk.Status = 57;
                    }
                }
                pk.CompanyID    = CompanyID;
                pk.CustomerID   = CustomerID;
                pk.PickUpStatus = true;
                pk.IsPick       = 1;
                //pk.IsRead = true;
                DataTable dtpkup = new DataTable();
                dtpkup = GetPickUpStatus(OrderID, objname, UserID);
                if (dtpkup.Rows.Count > 0)
                {
                    pk.ID = Convert.ToInt64(dtpkup.Rows[0]["ID"]);
                }
                UpdateRemQtyPKUP(OrderID, objname, CompanyID, CustomerID);
                UpdateStock(OrderID, objname, CompanyID, CustomerID);
                PKID = outbound.SavetPickUpHead(pk, profile.DBConnection._constr);
                context.Response.ContentType = "text/plain";
                String jsonString = String.Empty;
                jsonString = "{\n";   /*json Loop Start*/
                jsonString = jsonString + "\"result\":[{\n";
                if (PKID > 0)
                {
                    jsonString = jsonString + "\"status\": \"success\",\n";
                    jsonString = jsonString + "\"reason\": \"\"\n";
                }
                else
                {
                    jsonString = jsonString + "\"status\": \"failed\",\n";
                    jsonString = jsonString + "\"reason\": \"Server error occured\"\n";
                }
                jsonString = jsonString + "}]\n";
                jsonString = jsonString + "}\n"; /*json Loop End*/
                context.Response.Write(jsonString);
            }
            catch (Exception ex)
            { Login.Profile.ErrorHandling(ex, "update-shiping-list", "GetPickUpStatus"); }
            finally
            { }
        }
示例#3
0
        public void ProcessRequest(HttpContext context)
        {
            SqlConnection conn    = new SqlConnection(strcon);
            long          orderID = long.Parse(context.Request.Form["oid"]);
            long          uid     = long.Parse(context.Request.Form["uid"]);

            objectname = context.Request.Form["objname"].ToString();
            string          WorkFlow = "Outbound";
            string          NextObject = "QC";
            long            sequence = 0, prdID = 0;
            decimal         qty = 0;
            string          lCode = "", batchCode = "";
            string          lot1str = "", lot2str = "", lot3str = "", lot1 = "", lot2 = "", lot3 = "";
            string          prdString, qtystring, loccode, pid, bcode;
            int             rslt     = 0;
            long            pkupID   = 0;
            string          objNM    = "";
            string          userName = GetUserID(uid);
            CustomProfile   profile  = CustomProfile.GetProfile(userName);
            iOutboundClient Outbound = new iOutboundClient();

            /*First Save PickUp List Data in Temparary Table start*/
            List <WMS_SP_PickUpList_Result> pickupLst = new List <WMS_SP_PickUpList_Result>();
            // pickupLst = Outbound.GetPickUpList(orderID.ToString(), "", HttpContext.Current.Session.SessionID, uid.ToString(), "PickUp", profile.DBConnection._constr).ToList();
            //pickupLst = Outbound.GetPickUpList(orderID.ToString(), "", context.Session.SessionID, uid.ToString(), "PickUp", profile.DBConnection._constr).ToList();
            /*First Save PickUp List Data in Temparary Table start*/
            long           wid          = long.Parse(context.Request.Form["wid"]);
            string         putinDetails = context.Request.Form["putinDetails"];
            SqlCommand     cmd1         = new SqlCommand();
            SqlDataAdapter da1          = new SqlDataAdapter();
            DataSet        ds1          = new DataSet();

            cmd1.CommandType = CommandType.Text;
            cmd1.CommandText = "select * from  SplitString('" + putinDetails + "','@')";
            cmd1.Connection  = conn;
            cmd1.Parameters.Clear();
            da1.SelectCommand = cmd1;
            da1.Fill(ds1, "tbl1");
            int cntr1 = 0;

            cntr1 = ds1.Tables[0].Rows.Count;
            if (ds1.Tables[0].Rows.Count > 0)
            {
                for (int p = 0; p <= cntr1 - 1; p++)
                {
                    string myputinstring = "select * from  SplitString('" + ds1.Tables[0].Rows[p]["part"].ToString() + "','|')";
                    ds.Clear();
                    dt.Clear();
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = myputinstring;
                    cmd.Connection  = conn;
                    cmd.Parameters.Clear();
                    da.SelectCommand = cmd;
                    da.Fill(ds, "tbl1");
                    dt = ds.Tables[0];
                    int cntr = dt.Rows.Count;
                    if (cntr > 0)
                    {
                        for (int i = 0; i <= cntr - 1; i++)
                        {
                            //sequence
                            prdString = ds.Tables[0].Rows[i]["part"].ToString().Trim();
                            string[] spltprdString = prdString.Split(':');
                            sequence = long.Parse(spltprdString[1]);
                            i        = i + 1;

                            //qty
                            qtystring = ds.Tables[0].Rows[i]["part"].ToString().Trim();
                            string[] spltqty = qtystring.Split(':');
                            qty = decimal.Parse(spltqty[1]);
                            i   = i + 1;

                            //lcode
                            loccode = ds.Tables[0].Rows[i]["part"].ToString().Trim();
                            string[] lotsplit = loccode.Split(':');
                            lCode = Convert.ToString(lotsplit[1]);
                            i     = i + 1;
                            GetLocationDetails(lCode, wid);
                            /*Get Location Details*/

                            //Prodid
                            pid = ds.Tables[0].Rows[i]["part"].ToString().Trim();
                            string[] lotsplit1 = pid.Split(':');
                            prdID = long.Parse(lotsplit1[1]);
                            i     = i + 1;

                            //batch code
                            bcode = ds.Tables[0].Rows[i]["part"].ToString().Trim();
                            string[] lotsplit2 = bcode.Split(':');
                            batchCode = Convert.ToString(lotsplit2[1]);
                            // i = i + 1;


                            /*Update List Qty Start*/
                            WMS_SP_PickUpList_Result pkupLst = new WMS_SP_PickUpList_Result();
                            pkupLst.Sequence = sequence;
                            pkupLst.LocQty   = qty;
                            // Outbound.UpdatePkupLstLocofSelRow(HttpContext.Current.Session.SessionID, "PickUp", uid.ToString(), pkupLst, profile.DBConnection._constr);
                            //Outbound.UpdatePickUPLstQtyofSelRow(HttpContext.Current.Session.SessionID, "PickUp", uid.ToString(), pkupLst, profile.DBConnection._constr);
                            /*Update List Qty End*/

                            /*Update List Location Details Start*/
                            WMS_SP_PickUpList_Result pkLst = new WMS_SP_PickUpList_Result();
                            pkLst.Sequence         = sequence;
                            pkLst.LocationID       = locationID;
                            pkLst.Code             = lCode;
                            pkLst.SortCode         = sortCode;
                            pkLst.Capacity         = capacity;
                            pkLst.AvailableBalance = avlBlnce;
                            // Outbound.UpdatePkupLstLocofSelRow(HttpContext.Current.Session.SessionID, "PickUp", uid.ToString(), pkLst, profile.DBConnection._constr);
                            //Outbound.UpdatePickUPLstQtyofSelRow(HttpContext.Current.Session.SessionID, "PickUp", uid.ToString(), pkLst, profile.DBConnection._constr);
                            /*Update List Location Details End*/

                            //serial number if avaliable
                            if (cntr >= 6)
                            {
                                i       = i + 1;
                                lot1str = ds.Tables[0].Rows[i]["part"].ToString().Trim();
                                string[] lotsplit4 = lot1str.Split(':');
                                lot1 = lotsplit4[1];
                            }
                            if (cntr >= 7)
                            {
                                i       = i + 1;
                                lot2str = ds.Tables[0].Rows[i]["part"].ToString().Trim();
                                string[] lot2split = lot2str.Split(':');
                                lot2 = lot2split[1];
                            }
                            if (cntr >= 8)
                            {
                                i       = i + 1;
                                lot3str = ds.Tables[0].Rows[i]["part"].ToString().Trim();
                                string[] lot3split = lot3str.Split(':');
                                lot3 = lot3split[1];
                            }

                            //string objNM = "";

                            DataTable dtobjnm = new DataTable();
                            dtobjnm = GetDatatableDetails("select Object as Objectname from tOrderHead where id=" + orderID + " union all select Objectname from tTransferHead where id=" + orderID + "");
                            objNM   = dtobjnm.Rows[0]["ObjectName"].ToString();

                            tPickUpHead ph = new tPickUpHead();
                            //ph.ObjectName = "SalesOrder";
                            ph.ObjectName   = objectname;
                            ph.OID          = orderID;
                            ph.PickUpDate   = DateTime.Now;
                            ph.PickUpBy     = uid;
                            ph.CreatedBy    = uid;
                            ph.CreationDate = DateTime.Now;
                            int countnew = GetWorkFlow(profile.Personal.CompanyID, profile.Personal.CustomerId, WorkFlow, NextObject, profile.DBConnection._constr);
                            if (countnew > 0)
                            {
                                if (objectname == "SalesOrder")
                                {
                                    ph.Status = 38;
                                }
                                else if (objectname == "Transfer")
                                {
                                    ph.Status = 57;
                                }
                            }
                            else
                            {
                                if (objectname == "SalesOrder")
                                {
                                    ph.Status = 32;
                                }
                                else if (objectname == "Transfer")
                                {
                                    ph.Status = 58;
                                }
                            }
                            //if (objectname == "SalesOrder")
                            //{
                            //    ph.Status = 38;
                            //}
                            // else if(objectname == "Transfer")
                            //{
                            //    ph.Status = 57;
                            //}
                            ph.CompanyID    = profile.Personal.CompanyID;
                            ph.CustomerID   = profile.Personal.CustomerId;
                            ph.PickUpStatus = true;
                            // DataTable dtnew = new DataTable();
                            //   dtnew = GetDatatableDetails("select * from tPutInHead where oid=" + orderID + "");
                            //if (objectname == "SalesOrder")
                            //{
                            //    dtnew = GetDatatableDetails("select * from tPickUpHead where oid=" + orderID + " and Status=32");
                            //}
                            //else if (objectname == "Transfer")
                            //{
                            //    dtnew = GetDatatableDetails("select * from tPickUpHead where oid=" + orderID + " and Status=58");
                            //}

                            //if (dtnew.Rows.Count > 0)
                            //{
                            //    pkupID = Convert.ToInt64(dtnew.Rows[0]["id"].ToString());
                            //}
                            //else
                            //{
                            //    pkupID = Outbound.SavetPickUpHead(ph, profile.DBConnection._constr);
                            //}
                            if (pkupID == 0)
                            {
                                pkupID = Outbound.SavetPickUpHead(ph, profile.DBConnection._constr);
                            }
                            if (pkupID > 0)
                            {
                                // rslt = Outbound.FinalSavePickUpDetail(orderID, HttpContext.Current.Session.SessionID, "PickUp", pkupID, uid.ToString(), Convert.ToInt32(ph.Status), profile.DBConnection._constr);
                                rslt = SavePickUpDetail(pkupID, prdID, qty, locationID, orderID, batchCode);
                            }

                            SavePickUpLottable(prdID, batchCode, locationID, qty, profile.Personal.CompanyID, profile.Personal.CustomerId, profile.Personal.UserID, lot1, lot2, lot3, pkupID);
                        }
                    }
                }
            }

            if (pkupID > 0)
            {
                // SaveInSkutransction();
                // INSERT INTO tskutransaction(skuid, batchcode, locationid, transtype, inqty, outqty, closingbalance, companyid, cutomerid, createdby, creationdate, lottable1, lottable2, lottable3)
                //SELECT tpd.Prodid,tpd.batchcode, tpd.locationid, 'Outbound',0,tpd.pickupqty,0,tph.companyid,tph.cutomerid,user,getdate(),
                //FROM tpickupdetail tpd left outer join tpickuphead tph on tpd.pickupid = tph.id
                //WHERE tph.id =
                iInboundClient Inbound = new iInboundClient();
                int            count   = 0;
                long           QCID    = 0;
                if (objectname == "SalesOrder")
                {
                    WorkFlow   = "Outbound";
                    NextObject = "QC";
                }
                if (objectname == "Transfer")
                {
                    WorkFlow   = "Transfer";
                    NextObject = "QCOut";
                }
                count = GetWorkFlow(profile.Personal.CompanyID, profile.Personal.CustomerId, WorkFlow, NextObject, profile.DBConnection._constr);
                if (count == 0)
                {
                    WMSOutbound.tQualityControlHead QCHead = new WMSOutbound.tQualityControlHead();
                    QCHead.CreatedBy    = profile.Personal.UserID;
                    QCHead.Creationdate = DateTime.Now;
                    // QCHead.ObjectName = "SalesOrder";
                    QCHead.ObjectName = objectname;
                    QCHead.OID        = pkupID;
                    QCHead.QCDate     = DateTime.Now;
                    QCHead.QCBy       = profile.Personal.UserID;
                    QCHead.Remark     = "";

                    if (objectname == "SalesOrder")
                    {
                        QCHead.Status = 32;
                    }
                    else if (objectname == "Transfer")
                    {
                        QCHead.Status = 58;
                    }
                    //QCHead.Status = 32;

                    QCHead.Company    = profile.Personal.CompanyID;
                    QCHead.CustomerID = profile.Personal.CustomerId;
                    QCID = Inbound.SavetQualityControlHead(QCHead, profile.DBConnection._constr);
                    if (QCID > 0)
                    {
                        DataSet dsQC = new DataSet();
                        dsQC = GetPickUpCount(pkupID, profile.DBConnection._constr);
                        if (dsQC.Tables[0].Rows.Count > 0)
                        {
                            for (int i = 0; i < dsQC.Tables[0].Rows.Count; i++)
                            {
                                long prodid = Convert.ToInt64(dsQC.Tables[0].Rows[i]["ProdID"]);
                                long qtynew = Convert.ToInt64(dsQC.Tables[0].Rows[i]["PickUpQty"]);
                                long uom    = Convert.ToInt64(dsQC.Tables[0].Rows[i]["UOMID"]);
                                //int RSLT1 = Inbound.FillQCDetail(QCID, PkUpID, profile.DBConnection._constr);
                                int RSLT1 = FillQCDetailNew(QCID, pkupID, prodid, qtynew, uom, profile.DBConnection._constr);
                            }
                        }
                    }
                    //update torderhead table
                    UpdateStatustorderhead(orderID);
                }
            }

            String xmlString = String.Empty;

            context.Response.ContentType = "text/plain";
            String jsonString = String.Empty;

            jsonString = "{\n\"resultlist\": [\n";   /*json Loop Start*/
            if (rslt > 0)
            {
                jsonString = jsonString + "{\n\"status\":\"success\"\n}\n";
            }
            else if (rslt == 0)
            {
                jsonString = jsonString + "{\n\"status\":\"failed\"\n}\n";
            }
            jsonString = jsonString + "]\n}";  /*json Loop End*/
            context.Response.Write(jsonString);
        }