public MovingData StickerList(MovingReq Req)
        {
            MovingData SM = new MovingData();

            try
            {
                if (Req.UserId == "" || Req.UserId == null)
                {
                    SM.Status  = "Failure";
                    SM.Message = "Invalid UserId";
                }
                else
                {
                    query     = "Sp_MovingWebApi";
                    dbcommand = new SqlCommand(query, conn);
                    dbcommand.Connection.Open();
                    dbcommand.CommandType = CommandType.StoredProcedure;
                    dbcommand.Parameters.AddWithValue("@QueryType", "GetMovingList");
                    dbcommand.Parameters.AddWithValue("@StickerId", Req.StickerNo);
                    dbcommand.Parameters.AddWithValue("@UserId", Req.UserId);
                    SqlDataAdapter da = new SqlDataAdapter(dbcommand);
                    DataTable      dt = new DataTable();
                    da.Fill(dt);

                    if (dt.Rows[0]["value"].ToString() != "2")
                    {
                        if (dt != null && dt.Rows.Count > 0)
                        {
                            List <MovingListData> StillageSticker = new List <MovingListData>();
                            foreach (DataRow row in dt.Rows)
                            {
                                MovingListData SS = new MovingListData();
                                SS.StickerID           = row["StickerID"].ToString();
                                SS.StandardQty         = Convert.ToDecimal(row["StandardQty"]);
                                SS.ItemId              = row["ItemId"].ToString();
                                SS.Description         = row["Description"].ToString();
                                SS.ItemStdQty          = Convert.ToDecimal(row["ItemStdQty"]);
                                SS.AssignedLocation    = row["AssignedLocation"].ToString();
                                SS.IsMovedFromProdLine = Convert.ToByte(row["IsMovedFromProdLine"]);
                                StillageSticker.Add(SS);
                            }

                            SM.Status       = "Success";
                            SM.Message      = "Data retrived successfully";
                            SM.StillageList = StillageSticker;
                        }
                        else
                        {
                            SM.Status  = "Failure";
                            SM.Message = "No Stillage is assigned to this user.";
                            return(SM);
                        }
                    }
                    else
                    {
                        SM.Status  = "Failure";
                        SM.Message = "This Stillage Does Not Exist";
                        return(SM);
                    }
                }
            }
            catch (Exception Ex)
            {
                SM.Status  = "Failure";
                SM.Message = Ex.Message;
            }
            finally
            {
                dbcommand.Connection.Close();
            }
            return(SM);
        }
        public ItemMovingResponse StillageMoving(MovingReq movingReq)
        {
            ItemMovingResponse res = new ItemMovingResponse();

            try
            {
                if (movingReq.StickerNo == "" || movingReq.StickerNo == null)
                {
                    res.Status  = "Failure";
                    res.Message = "Enter StickerNo";
                    return(res);
                }
                if (movingReq.UserId == "" || movingReq.UserId == null)
                {
                    res.Status  = "Failure";
                    res.Message = "Invalid UserId";
                    return(res);
                }


                query     = "Sp_MovingWebApi";
                dbcommand = new SqlCommand(query, conn);
                dbcommand.Connection.Open();
                dbcommand.CommandType = CommandType.StoredProcedure;
                dbcommand.Parameters.AddWithValue("@QueryType", "GetMovingData");
                dbcommand.Parameters.AddWithValue("@StickerId", movingReq.StickerNo);
                dbcommand.Parameters.AddWithValue("@UserID", movingReq.UserId);
                dbcommand.CommandTimeout = 0;
                SqlDataAdapter da = new SqlDataAdapter(dbcommand);
                DataSet        ds = new DataSet();
                da.Fill(ds);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["value"].ToString() != "2")
                    {
                        if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                        {
                            List <AisleList> AisleList = new List <AisleList>();
                            foreach (DataRow row in ds.Tables[1].Rows)
                            {
                                AisleList A = new AisleList();
                                A.name = row["name"].ToString();
                                A.id   = row["id"].ToString();
                                AisleList.Add(A);
                            }
                            res.AisleList = AisleList;

                            //List<BinList> BinList = new List<BinList>();
                            //foreach (DataRow row in ds.Tables[3].Rows)
                            //{
                            //    BinList A = new BinList();
                            //    A.name = row["name"].ToString();
                            //    A.id = row["id"].ToString();
                            //    BinList.Add(A);
                            //}
                            //res.BinList = BinList;

                            //List<RackList> RackList = new List<RackList>();
                            //foreach (DataRow row in ds.Tables[2].Rows)
                            //{
                            //    RackList A = new RackList();
                            //    A.name = row["name"].ToString();
                            //    A.id = row["id"].ToString();
                            //    RackList.Add(A);
                            //}
                            //res.RackList = RackList;

                            List <ZoneList> ZoneList = new List <ZoneList>();
                            foreach (DataRow row in ds.Tables[2].Rows)
                            {
                                ZoneList A = new ZoneList();
                                A.name = row["name"].ToString();
                                A.id   = row["id"].ToString();
                                ZoneList.Add(A);
                            }
                            res.ZoneList = ZoneList;
                            if (ds != null && ds.Tables[3].Rows.Count > 0)
                            {
                                res.AssignedAisleId   = Convert.ToString(ds.Tables[3].Rows[0]["AssignedAisleId"]);
                                res.AssignedBinId     = Convert.ToString(ds.Tables[3].Rows[0]["AssignedBinId"]);
                                res.AssignedRackId    = Convert.ToString(ds.Tables[3].Rows[0]["AssignedRackId"]);
                                res.AssignedAisleName = Convert.ToString(ds.Tables[3].Rows[0]["AssignedAisleName"]);
                                res.AssignedBinName   = Convert.ToString(ds.Tables[3].Rows[0]["AssignedBinName"]);
                                res.AssignedRackName  = Convert.ToString(ds.Tables[3].Rows[0]["AssignedRackName"]);
                                res.AssignedZoneName  = Convert.ToString(ds.Tables[3].Rows[0]["ZoneName"]);
                                res.AssignedZoneId    = Convert.ToString(ds.Tables[3].Rows[0]["ZONEID"]);
                            }
                            else
                            {
                                res.AssignedAisleId = "";
                                res.AssignedBinId   = "";
                                res.AssignedRackId  = "";
                            }

                            res.WareHouseID          = ds.Tables[0].Rows[0]["WareHouseID"].ToString();
                            res.StickerID            = ds.Tables[0].Rows[0]["StickerID"].ToString();
                            res.StandardQty          = Convert.ToDecimal(ds.Tables[0].Rows[0]["StandardQty"]);
                            res.ItemId               = ds.Tables[0].Rows[0]["ItemId"].ToString();
                            res.Description          = ds.Tables[0].Rows[0]["Description"].ToString();
                            res.ItemStdQty           = Convert.ToDecimal(ds.Tables[0].Rows[0]["ItemStdQty"]);
                            res.AssignedLocation     = ds.Tables[0].Rows[0]["AssignedLocation"].ToString();
                            res.IsMovedFromProdLine  = Convert.ToByte(ds.Tables[0].Rows[0]["IsMovedFromProdLine"]);
                            res.StillageLocationName = Convert.ToString(ds.Tables[0].Rows[0]["StillageLocationName"]);
                            res.IsAssignTransfer     = Convert.ToByte(ds.Tables[0].Rows[0]["IsAssignTransfer"]);
                            if (res.StillageLocationName == "Production Line")
                            {
                                res.LoadingAreaId = res.LoadingAreaId = Convert.ToString(ds.Tables[4].Rows[0]["ZONEID"]);
                            }
                            else
                            {
                                res.LoadingAreaId = "";
                            }



                            res.Status  = "Success";
                            res.Message = "Data retrived successfully";
                        }
                        else
                        {
                            res.Status  = "Failure";
                            res.Message = "Invalid Sticker Number.";
                        }
                    }
                    else
                    {
                        res.Status  = "Failure";
                        res.Message = "This Stillage Does not Exist";
                        return(res);
                    }
                }
                else
                {
                    res.Status  = "Failure";
                    res.Message = "This stillage is assigned to another user";
                }
            }
            catch (Exception ex)
            {
                res.Status  = "Failure";
                res.Message = ex.Message;
            }
            finally
            {
                dbcommand.Connection.Close();
            }
            return(res);
        }