public LoadingPlan UpdateLoadingplanscanstatus(NewLoadingPlanReq LPR)
        {
            LoadingPlan SS1 = new LoadingPlan();

            try
            {
                if (LPR.LPID == "0")
                {
                    SS1.Status  = "Failure";
                    SS1.Message = "Invalid ID";
                }
                if (LPR.UserId == "0")
                {
                    SS1.Status  = "Failure";
                    SS1.Message = "Invalid UserId";
                }
                query     = "Sp_NewLoadingPlanWebApi";
                dbcommand = new SqlCommand(query, conn);
                dbcommand.Connection.Open();
                dbcommand.CommandType = CommandType.StoredProcedure;
                dbcommand.Parameters.AddWithValue("@QueryType", "UpdatePendingFlag");
                dbcommand.Parameters.AddWithValue("@TLPHID", LPR.LPID);
                dbcommand.Parameters.AddWithValue("@UserId", LPR.UserId);

                dbcommand.CommandTimeout = 0;
                SqlDataAdapter da = new SqlDataAdapter(dbcommand);
                DataSet        dt = new DataSet();
                da.Fill(dt);
                if (dt != null && dt.Tables[0].Rows.Count > 0)
                {
                    if (dt.Tables[0].Rows[0]["result"].ToString() == "1")
                    {
                        SS1.Status  = "Success";
                        SS1.Message = "Successfull move to ongoing to pending";
                    }

                    else
                    {
                        SS1.Status  = "Failure";
                        SS1.Message = "Sorry Invalid loading plan no.";
                    }
                }
                else
                {
                    SS1.Status  = "Failure";
                    SS1.Message = "Sorry Invalid loading plan no.";
                }
            }
            catch (Exception Ex)
            {
                SS1.Status  = "Failure";
                SS1.Message = Ex.Message;
            }
            finally
            {
                dbcommand.Connection.Close();
            }
            return(SS1);
        }
        public LoadingPlan ReopenLoadingPlan(REopen SR)
        {
            LoadingPlan SS = new LoadingPlan();

            try
            {
                if (SR.TLPHID == 0)
                {
                    SS.Status  = "Failure";
                    SS.Message = "Enter Sticker ID";
                }
                if (SR.UserId == "")
                {
                    SS.Status  = "Failure";
                    SS.Message = "Invalid UserId";
                }
                query     = "Sp_NewLoadingPlan";
                dbcommand = new SqlCommand(query, conn);
                dbcommand.Connection.Open();
                dbcommand.CommandType = CommandType.StoredProcedure;
                dbcommand.Parameters.AddWithValue("@QueryType", "ReopenLoadingPlan");
                dbcommand.Parameters.AddWithValue("@TLPHID", SR.TLPHID);
                dbcommand.Parameters.AddWithValue("@UserID", SR.UserId);
                dbcommand.CommandTimeout = 0;
                SqlDataAdapter da = new SqlDataAdapter(dbcommand);
                DataSet        dt = new DataSet();
                da.Fill(dt);
                if (dt != null && dt.Tables[0].Rows.Count > 0)
                {
                    SS.Status  = "Success";
                    SS.Message = "Loading plan reopened successfully";
                }
                else
                {
                    SS.Status  = "Failure";
                    SS.Message = "Invalid loading plan no";
                }
            }
            catch (Exception Ex)
            {
                SS.Status  = "Failure";
                SS.Message = Ex.Message;
            }
            finally
            {
                dbcommand.Connection.Close();
            }
            return(SS);
        }
示例#3
0
        public LoadingPlan ScanLookUpStillage(StickerReq SR)
        {
            LoadingPlan SS = new LoadingPlan();

            try
            {
                if (SR.StickerNo == "")
                {
                    SS.Status  = "Failure";
                    SS.Message = "Enter Sticker ID";
                }
                if (SR.UserId == 0)
                {
                    SS.Status  = "Failure";
                    SS.Message = "Invalid UserId";
                }
                query     = "Sp_LadingPlanWebApi";
                dbcommand = new SqlCommand(query, conn);
                dbcommand.Connection.Open();
                dbcommand.CommandType = CommandType.StoredProcedure;
                dbcommand.Parameters.AddWithValue("@QueryType", "GetLoadingPlan");
                dbcommand.Parameters.AddWithValue("@StickerId", SR.StickerNo);
                dbcommand.Parameters.AddWithValue("@AssignedUser", SR.UserId);

                dbcommand.CommandTimeout = 0;
                SqlDataAdapter da = new SqlDataAdapter(dbcommand);
                DataSet        dt = new DataSet();
                da.Fill(dt);
                if (dt != null && dt.Tables[0].Rows.Count > 0)
                {
                    List <ScanLoadingPlan> LoadingPlanList = new List <ScanLoadingPlan>();

                    foreach (DataRow row in dt.Tables[0].Rows)
                    {
                        ScanLoadingPlan A = new ScanLoadingPlan();
                        A.TLPHID        = Convert.ToInt64(row["TLPHID"]);
                        A.LoadingPlanNo = row["LoadingPlanNo"].ToString();
                        A.CustomerId    = row["CustomerId"].ToString();
                        LoadingPlanList.Add(A);
                    }
                    SS.ScanLoadingPlanList = LoadingPlanList;
                    SS.Status  = "Success";
                    SS.Message = "Data retrived successfully";
                }
                else
                {
                    SS.Status  = "Failure";
                    SS.Message = "Invalid Stillage";
                }
            }
            catch (Exception Ex)
            {
                SS.Status  = "Failure";
                SS.Message = Ex.Message;
            }
            finally
            {
                dbcommand.Connection.Close();
            }
            return(SS);
        }