Esempio n. 1
0
        private void cmb_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            SpareViewModel spareView = null;

            if ((spareView = gridSpares.CurrentItem as SpareViewModel) is SpareViewModel)
            {
                spareView.SelectedPrice = Convert.ToDecimal((sender as ComboBox).SelectedValue);
            }
        }
Esempio n. 2
0
        //[HttpGet]
        public ActionResult MasterPartial(Guid masterCode)
        {
            SpareViewModel spareVM = masterCode == Guid.Empty ? new SpareViewModel() : Mapper.Map <Spare, SpareViewModel>(_spareBusiness.GetSpare(masterCode));

            spareVM.IsUpdate = masterCode == Guid.Empty ? false : true;
            if (spareVM.IsUpdate == false)
            {
                spareVM.Code = _spareBusiness.GetSpareCode();
            }
            return(PartialView("_AddSpare", spareVM));
        }
Esempio n. 3
0
        public ActionResult CheckSpareCodeExist(SpareViewModel spareVM)
        {
            bool exists = _spareBusiness.CheckSpareCodeExist(Mapper.Map <SpareViewModel, Spare>(spareVM));

            if (exists)
            {
                return(Json("<p><span style='vertical-align: 2px'>Spare code is in use </span> <i class='fa fa-close' style='font-size:19px; color: red'></i></p>", JsonRequestBehavior.AllowGet));
            }
            //var result = new { success = true, message = "Success" };
            return(Json(true, JsonRequestBehavior.AllowGet));
        }
 private void CalcSum()
 {
     if (comboBoxSpare.SelectedValue != null && !string.IsNullOrEmpty(textBoxCount.Text))
     {
         try
         {
             int            id    = Convert.ToInt32(comboBoxSpare.SelectedValue);
             SpareViewModel Spare = logicP.Read(new SpareBindingModel {
                 Id = id
             })?[0];
             int count = Convert.ToInt32(textBoxCount.Text);
             int sum   = count * Spare?.Price ?? 0;
             textBoxPlusSum.Text = sum.ToString();
             PlusSum             = sum;
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Esempio n. 5
0
        public string InsertUpdateSpare(SpareViewModel spareVM)
        {
            object result = null;

            try
            {
                AppUA appUA = Session["AppUA"] as AppUA;
                spareVM.PSASysCommon             = new PSASysCommonViewModel();
                spareVM.PSASysCommon.CreatedBy   = appUA.UserName;
                spareVM.PSASysCommon.CreatedDate = _pSASysCommon.GetCurrentDateTime();
                spareVM.PSASysCommon.UpdatedBy   = appUA.UserName;
                spareVM.PSASysCommon.UpdatedDate = _pSASysCommon.GetCurrentDateTime();
                result = _spareBusiness.InsertUpdateSpare(Mapper.Map <SpareViewModel, Spare>(spareVM));
                return(JsonConvert.SerializeObject(new { Status = "OK", Record = result, Message = "Success" }));
            }
            catch (Exception ex)
            {
                AppConstMessage cm = _appConstant.GetMessage(ex.Message);
                return(JsonConvert.SerializeObject(new { Status = "ERROR", Record = "", Message = cm.Message }));
            }
        }