Beispiel #1
0
        private void Add_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            SmpUcFormState.CurrentState = FormCurrentState.AddMaster;

            if (!(DataGridEmployees.SelectedItem is Employee selectedEmployee))
            {
                return;
            }
            var newItem = new ContractMaster
            {
                Employee        = selectedEmployee,
                ContractNo      = "0",
                ContractDetails = new List <ContractDetail>(),
                DateEmployment  = selectedEmployee.ContractMasters.FirstOrDefault(c => c.IsCurrent)?.DateEmployment ?? DateTime.Now,
                DateExecution   = DateTime.Now,
                DateExport      = DateTime.Now
            };

            selectedEmployee.ContractMasters.Add(newItem);
            CollectionViewSource.GetDefaultView(DataGridEmployeeContracts.ItemsSource)?.Refresh();
            DataGridEmployeeContracts.SelectedItem = newItem;
            DataGridEmployeeContracts.ScrollIntoView(newItem);
            SmpUcContractMasterEdit.SelectFirstItem();

//			SmpUcContractDetailsEdit.DataContext = null;
//		    SmpUcContractMasterEdit.CurrentContractMaster = newItem;
        }
Beispiel #2
0
        public int Update(ContractModel model)
        {
            Mapper.CreateMap <ContractModel, ContractMaster>();
            ContractMaster objComp = Dbcontext.ContractMasters.SingleOrDefault(m => m.ContID == model.ContID);

            objComp = Mapper.Map(model, objComp);
            return(Dbcontext.SaveChanges());
        }
Beispiel #3
0
        public ContractModel GetById(int id)
        {
            Mapper.CreateMap <ContractMaster, ContractModel>();
            ContractMaster objComp  = Dbcontext.ContractMasters.SingleOrDefault(m => m.ContID == id);
            ContractModel  objCItem = Mapper.Map <ContractModel>(objComp);

            return(objCItem);
        }
Beispiel #4
0
        public int Insert(ContractModel model)
        {
            Mapper.CreateMap <ContractModel, ContractMaster>();
            ContractMaster objCompany = Mapper.Map <ContractMaster>(model);

            Dbcontext.ContractMasters.Add(objCompany);
            return(Dbcontext.SaveChanges());
        }
Beispiel #5
0
 public bool SaveContract(ContractModel model)
 {
     try
     {
         ContractMaster db = new ContractMaster()
         {
             isActive         = true,
             name             = model.name,
             no               = model.no,
             date             = model.date,
             branch           = model.branch,
             clientname       = model.clientname,
             pono             = model.pono,
             podate           = model.podate,
             validfromdate    = model.validfromdate,
             validtodate      = model.validtodate,
             rateapplicableon = model.rateapplicableon,
             //probusipermonth = model.probusipermonth,
             weight             = model.weight,
             freight            = model.freight,
             branchfrom         = model.branchfrom,
             branchto           = model.branchto,
             freightperKG       = model.freightperKG,
             statisticalcharges = model.statisticalcharges,
             FOV                    = model.FOV,
             hamaliperKG            = model.hamaliperKG,
             hamaniperArt           = model.hamaniperArt,
             localcharges           = model.localcharges,
             doordeliverychargesart = model.doordeliverychargesart,
             doordeliverychargesKG  = model.doordeliverychargesKG,
             gicharges              = model.gicharges,
             demurragedays          = model.demurragedays,
             demurragerate          = model.demurragerate,
             fileupload             = model.fileupload,
         };
         _tRS.ContractMasters.Add(db);
         _tRS.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         throw e;
     }
 }