private async void BtnSave_Click(object sender, EventArgs e) { RollSettingsDBModel model = new RollSettingsDBModel() { SupplierRollNo = etSupRollNo.Text, OwnWidth = etOwnWidth.Text, WidthBeforeWash = etWidthBW.Text, SLengthBW = etLengthBW.Text, WidthUOM = selectedUOM, RollID = txtRollNo.Tag.ToString(), HeadCutting = isHeadCut }; int result = await repo.SetRoll(model); if (result > 0) { roll = await repo.GetRollID(selectedGRN, selectedColor); txtRollNo.Text = roll.RollSerial.ToString(); txtRollNo.Tag = roll.RollID; etSupRollNo.Text = ""; etOwnWidth.Text = ""; etWidthBW.Text = ""; etLengthBW.Text = ""; } else { Toast.MakeText(this, "SAVE FAILED!!!! Please Try Again", ToastLength.Long); } }
public void LoadInspection(RollSettingsDBModel model) { rlPopup.Visibility = ViewStates.Visible; FindViewById <RelativeLayout>(Resource.Id.rlHeadCut).Visibility = ViewStates.Invisible; FindViewById <RelativeLayout>(Resource.Id.rlQuality).Visibility = ViewStates.Invisible; FindViewById <RelativeLayout>(Resource.Id.rlInspection).Visibility = ViewStates.Visible; txtRollNoValue.Text = model.RollSerial.ToString(); txtRollNoValue.Tag = model.RollID; etSuppRollNo.Text = model.SupplierRollNo; etOwnLength.Text = model.OwnLength.ToString(); swPassFail.Checked = model.QCPass == null ? true : (bool)model.QCPass; }
public async Task <int> SetRoll(RollSettingsDBModel roll) { string url = RepositorySettings.BaseURl + "FabricRoll/SetRoll"; HttpClient client = new HttpClient(); HttpContent contentPost = new StringContent(JsonConvert.SerializeObject(roll), Encoding.UTF8, "application/json"); HttpResponseMessage result = await client.PostAsync(url, contentPost); var aproves = JsonConvert.DeserializeObject <int>(result.Content.ReadAsStringAsync().Result); return(aproves); }
public int SetRoll(RollSettingsDBModel model) { string xmlStr = UtilityOptions.GetXMLFromObject(model); SqlParameter[] param = new SqlParameter[] { new SqlParameter("@XmlStr", xmlStr), new SqlParameter("@QryOption", 5) }; int result = ExecuteNoResult("Inventory.dbo.SP_ROLL_INFORMATION_MOB", param); return(result); }
public List <RollSettingsDBModel> GetRoll(string grnID, string colorNmae) { List <RollSettingsDBModel> _DBModelList = new List <RollSettingsDBModel>(); try { var param = new SqlParameter[] { new SqlParameter("@QryOption", 3), new SqlParameter("@GRNId", grnID), new SqlParameter("@ColorId", colorNmae) }; DataTable dt = ExecuteDataTable("Inventory.dbo.SP_ROLL_INFORMATION_MOB", param, CommandType.StoredProcedure); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { RollSettingsDBModel model = new RollSettingsDBModel(); model.OwnWidth = dr["OwnWidth"] != DBNull.Value ? dr["OwnWidth"].ToString() : ""; model.SupplierRollNo = dr["SupplierRollNo"] != DBNull.Value ? dr["SupplierRollNo"].ToString() : ""; model.WidthBeforeWash = dr["SWidthBW"] != DBNull.Value ? dr["SWidthBW"].ToString() : ""; model.SWidthAW = dr["SWidthAW"] != DBNull.Value ? dr["SWidthAW"].ToString() : ""; model.RollSerial = dr["RollSerial"] != DBNull.Value ? dr["RollSerial"].ToString() : ""; model.SLengthBW = dr["SLengthBW"] != DBNull.Value ? dr["SLengthBW"].ToString() : ""; model.SLengthAW = dr["SLengthAW"] != DBNull.Value ? dr["SLengthAW"].ToString() : ""; model.SLengthAWPercent = dr["SLengthAWPercent"] != DBNull.Value ? dr["SLengthAWPercent"].ToString() : ""; model.SWidthAWParcent = dr["SWidthAWParcent"] != DBNull.Value ? dr["SWidthAWParcent"].ToString() : ""; model.RollID = dr["RollID"].ToString(); model.SerialNo = Convert.ToInt16(dr["SerialNo"].ToString()); model.OwnLength = dr["OwnLength"] != DBNull.Value ? Convert.ToDecimal(dr["OwnLength"].ToString()) : 0; model.QCPass = dr["QCPass"] != DBNull.Value ? dr.Field <bool?>("QCPass") : null; _DBModelList.Add(model); } } return(_DBModelList); } catch (Exception ex) { //ErrorSignal.FromCurrentContext().Raise(ex); throw ex; } finally { _DBModelList = null; } }
public void LoadHeadCut(RollSettingsDBModel model) { rlPopup.Visibility = ViewStates.Visible; var rlHeadCut = FindViewById <RelativeLayout>(Resource.Id.rlHeadCut); rlHeadCut.Visibility = ViewStates.Visible; FindViewById <RelativeLayout>(Resource.Id.rlQuality).Visibility = ViewStates.Invisible; FindViewById <RelativeLayout>(Resource.Id.rlInspection).Visibility = ViewStates.Invisible; etWidthBW = rlHeadCut.FindViewById <EditText>(Resource.Id.etWidthBW); etLengthBW = rlHeadCut.FindViewById <EditText>(Resource.Id.etLengthBW); txtRollNoValue.Text = model.RollSerial.ToString(); txtRollNoValue.Tag = model.RollID; etSuppRollNo.Text = model.SupplierRollNo; etOwnWidth.Text = model.OwnWidth; etWidthBW.Text = model.WidthBeforeWash; etLengthBW.Text = model.SLengthBW; }
public void LoadQuality(RollSettingsDBModel model) { rlPopup.Visibility = ViewStates.Visible; var rlQuality = FindViewById <RelativeLayout>(Resource.Id.rlQuality); FindViewById <RelativeLayout>(Resource.Id.rlHeadCut).Visibility = ViewStates.Invisible; rlQuality.Visibility = ViewStates.Visible; FindViewById <RelativeLayout>(Resource.Id.rlInspection).Visibility = ViewStates.Invisible; etWidthBW = rlQuality.FindViewById <EditText>(Resource.Id.etWidthBW); etLengthBW = rlQuality.FindViewById <EditText>(Resource.Id.etLengthBW); txtRollNoValue.Text = model.RollSerial.ToString(); txtRollNoValue.Tag = model.RollID; etSuppRollNo.Text = model.SupplierRollNo; etWidthBW.Text = model.WidthBeforeWash; etLengthBW.Text = model.SLengthBW; etWidthAW.Text = model.SWidthAW; etLengthAW.Text = model.SLengthAW; etWidthBW.TextChanged += (s, e) => { CalcWidthPercent(); }; etLengthBW.TextChanged += (s, e) => { CalcWidthPercent(); }; if (!String.IsNullOrEmpty(model.SLengthAWPercent)) { tvLengthPercent.Text = $"Shrinkage Length After Wash Parcent is {model.SLengthAWPercent}%"; } if (!String.IsNullOrEmpty(model.SWidthAWParcent)) { tvWidthPercent.Text = $"Shrinkage Width After Wash Parcent is {model.SWidthAWParcent}%"; } }
private async void SpColor_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { //throw new NotImplementedException(); selectedColor = ddlColor[e.Position]; roll = await repo.GetRollID(selectedGRN, selectedColor); txtRollNo.Text = roll.RollSerial.ToString(); txtRollNo.Tag = roll.RollID; etOwnWidth.Text = roll.OwnWidth; tcSupWidth.Text = roll.SupplierWidth.ToString(); if (swHeadCut.Checked) { etWidthBW.Text = roll.SWidthBW; etLengthBW.Text = roll.SLengthBW; } else { etWidthBW.Text = ""; etLengthBW.Text = ""; } }
public RollSettingsDBModel GetRollID(string grnID, string colorNmae) { RollSettingsDBModel model = new RollSettingsDBModel(); try { var param = new SqlParameter[] { new SqlParameter("@QryOption", 4), new SqlParameter("@GRNId", grnID), new SqlParameter("@ColorId", colorNmae) }; DataTable dt = ExecuteDataTable("Inventory.dbo.SP_ROLL_INFORMATION_MOB", param, CommandType.StoredProcedure); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { model.RollSerial = dr["RollSerial"] != DBNull.Value ? dr["RollSerial"].ToString() : ""; model.RollID = dr["RollID"] != DBNull.Value ? dr["RollID"].ToString() : ""; model.OwnWidth = dr["OwnWidth"] != DBNull.Value ? dr["OwnWidth"].ToString() : ""; model.SupplierWidth = dr["SupplierWidth"] != DBNull.Value ? Convert.ToDecimal(dr["SupplierWidth"].ToString()) : 0; model.SWidthBW = dr["SWidthBW"] != DBNull.Value ? dr["SWidthBW"].ToString() : ""; model.SLengthBW = dr["SLengthBW"] != DBNull.Value ? dr["SLengthBW"].ToString(): ""; } } return(model); } catch (Exception ex) { //ErrorSignal.FromCurrentContext().Raise(ex); throw ex; } finally { model = null; } }
public async Task <RollSettingsDBModel> GetRollID(string GrnId, string Colorid) { RollSettingsDBModel roll; try { //userid = Cipher.Encrypt(userid); string url = RepositorySettings.BaseURl + "FabricRoll/GetRollID?GrnID=" + GrnId + "&Colorid=" + Colorid; HttpClient client = new HttpClient(); HttpResponseMessage result = await client.GetAsync(url); string strResult = result.Content.ReadAsStringAsync().Result; roll = JsonConvert.DeserializeObject <RollSettingsDBModel>(strResult); if (roll == null) { roll = new RollSettingsDBModel(); } } catch (Exception ex) { roll = new RollSettingsDBModel(); } return(roll); }
private async void BtnSave_Click(object sender, EventArgs e) { RollSettingsDBModel roll = new RollSettingsDBModel() { RollID = txtRollNoValue.Tag.ToString(), RollSerial = txtRollNoValue.Text }; if (this.FabricRollUpdateItem == FabricRollUpdateItem.HeadCut) { roll.OwnWidth = etOwnWidth.Text; roll.WidthBeforeWash = etWidthBW.Text; roll.SLengthBW = etLengthBW.Text; } if (this.FabricRollUpdateItem == FabricRollUpdateItem.Inspection) { roll.OwnLength = Convert.ToDecimal(etOwnLength.Text); roll.QCPass = swPassFail.Checked; } if (this.FabricRollUpdateItem == FabricRollUpdateItem.QC) { roll.WidthBeforeWash = etWidthBW.Text; roll.SWidthAW = etWidthAW.Text; roll.SLengthBW = etLengthBW.Text; roll.SLengthAW = etLengthAW.Text; } int result = await repo.SetRoll(roll); if (result > 0) { rollList = await repo.GetRollList(selectedGRN, selectedColor); adapter.Items = rollList; adapter.NotifyDataSetChanged(); List <string> serial = rollList.Select(t => t.RollSerial).OrderBy(t => Convert.ToInt16(t)).ToList(); int srialMe = serial.IndexOf(roll.RollSerial); if ((srialMe + 1) <= serial.Count() - 1) { string srialNext = serial[srialMe + 1]; roll = rollList.Where(t => t.RollSerial == srialNext).FirstOrDefault(); if (this.FabricRollUpdateItem == FabricRollUpdateItem.HeadCut) { LoadHeadCut(roll); } if (this.FabricRollUpdateItem == FabricRollUpdateItem.Inspection) { LoadInspection(roll); } if (this.FabricRollUpdateItem == FabricRollUpdateItem.QC) { LoadQuality(roll); } } Toast.MakeText(this, "Saved Successfully!!!", ToastLength.Long).Show(); } else { Toast.MakeText(this, "Save not Successful!!!", ToastLength.Long).Show(); } }
public int SetRoll(RollSettingsDBModel model) { int result = _db.SetRoll(model); return(result); }