示例#1
0
        public int SetRejection(ProductionRejectionDBModel model)
        {
            SqlParameter[] param = new SqlParameter[] {
                new SqlParameter("@Ref", model.RefNo),
                new SqlParameter("@ProdDateTime", DateTime.Now),
                new SqlParameter("@LocationRef", model.LocationRef),
                new SqlParameter("@Grade", model.Grade),
                new SqlParameter("@SKUCode", model.SKUCode.ToString()),
                new SqlParameter("@SKUQuantiy", model.ProducedQty),

                new SqlParameter("@AddedBy", model.AddedBy)
            };

            try
            {
                int count = ExecuteNonQuery(CommandType.StoredProcedure, "bimob.dbo.USP_Rejectionentry", param);

                return(count);
            }
            catch (Exception ex)
            {
                //ErrorSignal.FromCurrentContext().Raise(ex);
                throw ex;
            }
        }
        public int SetRejection(ProductionRejectionDBModel model)
        {
            try
            {
                //model.RefNo = "Test Ref";
                string url = RepositorySettings.BaseURl + "Rejection";

                HttpClient  client      = new HttpClient();
                HttpContent contentPost = new StringContent(JsonConvert.SerializeObject(model), Encoding.UTF8,
                                                            "application/json");
                HttpResponseMessage result = client.PostAsync(url, contentPost).Result;
                var aproves = JsonConvert.DeserializeObject <int>(result.Content.ReadAsStringAsync().Result);
                return(aproves);
            }
            catch (Exception ex)
            {
                string msg = ex.Message;
                return(0);
            }
        }
示例#3
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            if (atvReference.Text == "")
            {
                Toast.MakeText(this, "Please Select an item first", ToastLength.Long).Show();
                return;
            }

            List <RecentPR> prs = DBAccess.Database.RecentPRs.Result.Where(t => t.EntryType == (int)EntryType.Rejection).ToList();

            if (prs.Where(t => t.RefID == atvReference.Text).Count() == 0)
            {
                DBAccess.Database.SaveRecentPR(new DAL.RecentPR {
                    RefID = atvReference.Text, LocationRef = tvLocation.Text, EntryType = (int)EntryType.Rejection
                });
                prs = DBAccess.Database.RecentPRs.Result.Where(t => t.EntryType == (int)EntryType.Rejection).ToList();
                if (prs.Count == 6)
                {
                    DBAccess.Database.DeleteItemAsync(prs.Where(t => t.ID == 1).FirstOrDefault());
                    foreach (var pr in prs)
                    {
                        pr.ID = pr.ID - 1;
                        DBAccess.Database.SaveRecentPR(pr);
                    }
                }
                PopulateRecentItem();
            }
            ProductionAccountingDBModel model;

            if (list != null)
            {
                model = list.Where(t => t.RefNo == atvReference.Text).First();
            }
            else
            {
                model = new ProductionAccountingDBModel {
                    LocationRef = DBAccess.Database.RecentPRs.Result.Where(t => t.RefID == atvReference.Text).First().LocationRef
                }
            };
            //gifView.Visibility = ViewStates.Visible;

            var progressDialog = ProgressDialog.Show(this, null, "Please Wait.", true);
            var refid          = atvReference.Text;
            var qty            = Convert.ToInt16(etQty.Text);
            var userCode       = bitopiApplication.User.UserCode;
            //new Thread(new ThreadStart(() =>
            //{

            ProductionRejectionDBModel dbmodel = new ProductionRejectionDBModel();

            dbmodel.RefNo       = atvReference.Text;
            dbmodel.LocationRef = DBAccess.Database.RecentHistory.Result.LocationID;
            dbmodel.Grade       = etGrade.Text;
            //dbmodel.SKUCode = Convert.ToInt16(etSKUCode.Text);
            dbmodel.ProducedQty = Convert.ToInt16(etQty.Text);
            dbmodel.AddedBy     = bitopiApplication.User.UserCode;
            var result = repo.SetRejection(dbmodel);

            RunOnUiThread(() =>
            {
                if (result > 0)
                {
                    if (SelectedPRStatus != "")
                    {
                        LoadList(SelectedPRStatus);
                    }
                    LoadSelectedList(atvReference.Text);
                    progressDialog.Dismiss();
                    Toast.MakeText(this, "Successfully Saved", ToastLength.Long).Show();
                }
                else
                {
                    progressDialog.Dismiss();
                    Toast.MakeText(this, "Unsuccessfull operation", ToastLength.Long).Show();
                }
                //gifView.Visibility = ViewStates.Gone;
            });
            //})).Start();
        }
示例#4
0
        public int SetRejection(ProductionRejectionDBModel model)
        {
            int result = Context.SetRejection(model);

            return(result);
        }