예제 #1
0
        public int SetQuality(ProductionQualityDBModel model)
        {
            string xmlString = ConvertToXML(model.DefectList.Where(t => t.No > 0).ToList());

            SqlParameter[] param = new SqlParameter[] {
                new SqlParameter("@Ref", model.RefNo),
                new SqlParameter("@ProdDateTime", DateTime.Now),
                new SqlParameter("@LocationRef", model.LocationRef),
                new SqlParameter("@LotQ", model.LotQ),
                new SqlParameter("@Sample", model.Sample),
                new SqlParameter("@Check", model.Check),
                new SqlParameter("@Status", model.QualityStatus),
                new SqlParameter("@DefectiveUnit", model.DefectiveUnit),
                new SqlParameter("@xmlString", xmlString),
                new SqlParameter("@AddedBy", model.AddedBy)
            };
            string sql = toSqlString(param, "bimob.dbo.USP_Qualityentry ");

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

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

                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
        public int SetQuality(ProductionQualityDBModel model)
        {
            int result = Context.SetQuality(model);

            return(result);
        }
예제 #4
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.Quality).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.Quality
                });
                prs = DBAccess.Database.RecentPRs.Result.Where(t => t.EntryType == (int)EntryType.Quality).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();
            }
            //ProdcutionAccountingDBModel model;
            //if (list != null)
            //    model = list.Where(t => t.RefNo == atvReference.Text).First();
            //else
            //    model = new ProdcutionAccountingDBModel { 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 qty = Convert.ToInt16(etQty.Text);
            var userCode = bitopiApplication.User.UserCode;
            ProductionQualityDBModel model = new ProductionQualityDBModel();

            model.LocationRef   = DBAccess.Database.RecentHistory.Result.LocationID;
            model.RefNo         = atvReference.Text;
            model.LotQ          = Convert.ToInt16(etLotQ.Text);
            model.Sample        = Convert.ToInt16(etSample.Text);
            model.Check         = etSample.Text;
            model.DefectiveUnit = Convert.ToInt16(etDefectiveUnit.Text);
            model.QualityStatus = spStatus.Text.ToString();
            model.DefectList    = defectList;
            model.AddedBy       = bitopiApplication.User.UserCode;
            //new Thread(new ThreadStart(() =>
            //{

            //var result = repo.SetProduction(refid,
            //qty, model.LocationRef, userCode);
            var result = repo.SetQuality(model);

            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();
        }