Ejemplo n.º 1
0
 private void gvPayoff_RowUpdated(object sender, DevExpress.XtraGrid.Views.Base.RowObjectEventArgs e)
 {
     if (newRow != null)
     {
         newRow.PAYOFFCONTROL_TYPE_ID         = 1;
         newRow.PAYOFFCONTROL_PAYOFFMASTER_ID = _payoffMasterId;
         newRow.PAYOFFCONTROL_TENSIZUP        = Math.Round((Convert.ToDouble(newRow.PAYOFFCONTROL_TENUP) / payoffMaster.PAYOFFMASTER_PARAMETERCODE), 2);
         newRow.PAYOFFCONTROL_TOTALTENUP      = newRow.PAYOFFCONTROL_QUANTITY * newRow.PAYOFFCONTROL_TENUP;
         newRow.PAYOFFCONTROL_TOTALTENSIZUP   = newRow.PAYOFFCONTROL_QUANTITY * newRow.PAYOFFCONTROL_TENSIZUP;
         dbContext.PayoffControl.Add(newRow);
     }
     dbContext.SaveChanges();
     newRow = null;
 }
Ejemplo n.º 2
0
 private void gvControl_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Delete && e.Modifiers == Keys.Control)
     {
         if (MessageBox.Show("Delete row?", "Confirmation", MessageBoxButtons.YesNo) !=
             DialogResult.Yes)
         {
             return;
         }
         GridView view      = sender as GridView;
         int      controlId = gvControl.GetNullableRowCellValue();
         if (controlId == 0)
         {
             return;
         }
         dbContext.PayoffControl.Remove(dbContext.PayoffControl.Find(controlId));
         dbContext.SaveChanges();
         view.DeleteRow(view.FocusedRowHandle);
     }
     if (e.KeyCode == Keys.D && e.Modifiers == Keys.Control)
     {
         if (MessageBox.Show("Taşeron hakedişine aktar?", "Onay", MessageBoxButtons.YesNo) !=
             DialogResult.Yes)
         {
             return;
         }
         GridView view      = sender as GridView;
         int      controlId = gvControl.GetNullableRowCellValue();
         if (controlId == 0)
         {
             return;
         }
         var           payoffControl    = dbContext.PayoffControl.Find(controlId);
         PayoffControl newPayoffControl = payoffControl;
         newPayoffControl.PAYOFFCONTROL_TYPE_ID = 1;
         dbContext.PayoffControl.Add(newPayoffControl);
         dbContext.SaveChanges();
         XtraMessageBox.Show("Aktarım Başarılı", "OK");
     }
 }
Ejemplo n.º 3
0
 private void gvPayoff_InitNewRow(object sender, InitNewRowEventArgs e)
 {
     newRow = this.gvPayoff.GetRow(e.RowHandle) as PayoffControl;
 }
Ejemplo n.º 4
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (validationResult() == true)
     {
         var selectedProject = dbContext.Project.Find(lueProject.EditValue);
         var payoffMaster    = new PayoffMaster
         {
             PAYOFFMASTER_PROJECT_ID    = selectedProject.ID,
             PAYOFFMASTER_PARAMETERCODE = Math.Round(((100 - selectedProject.Contract.CONTRACT_PRICECUTRATE) / 100), 3)
         };
         dbContext.PayoffMaster.Add(payoffMaster);
         lueProject.EditValue = null;
         dbContext.SaveChanges();
         var excelDatas = ExcelHelper.ReadExcel(txtFilePath.Text);
         foreach (var row in excelDatas)
         {
             if (row.PAYOFFDEFAULT_DEF1 != "")
             {
                 var payoffdef = new PayoffDefault();
                 payoffdef.PAYOFFDEFAULT_DEF1            = row.PAYOFFDEFAULT_DEF1;
                 payoffdef.PAYOFFDEFAULT_DEF2            = row.PAYOFFDEFAULT_DEF3;
                 payoffdef.PAYOFFDEFAULT_DEF3            = row.PAYOFFDEFAULT_DEF4;
                 payoffdef.PAYOFFDEFAULT_DEF4            = row.PAYOFFDEFAULT_DEF5;
                 payoffdef.PAYOFFDEFAULT_DEF5            = row.PAYOFFDEFAULT_DEF6;
                 payoffdef.PAYOFFDEFAULT_DEF6            = row.PAYOFFDEFAULT_DEF7;
                 payoffdef.PAYOFFDEFAULT_DEF7            = row.PAYOFFDEFAULT_DEF8;
                 payoffdef.PAYOFFDEFAULT_DEF8            = row.PAYOFFDEFAULT_DEF8;
                 payoffdef.PAYOFFDEFAULT_DEF9            = row.PAYOFFDEFAULT_DEF8;
                 payoffdef.PAYOFFDEFAULT_DEF10           = row.PAYOFFDEFAULT_DEF8;
                 payoffdef.PAYOFFDEFAULT_DEF11           = row.PAYOFFDEFAULT_DEF8;
                 payoffdef.PAYOFFDEFAULT_DEF12           = row.PAYOFFDEFAULT_DEF13;
                 payoffdef.PAYOFFDEFAULT_DEF13           = row.PAYOFFDEFAULT_DEF8;
                 payoffdef.PAYOFFDEFAULT_DEF14           = row.PAYOFFDEFAULT_DEF8;
                 payoffdef.PAYOFFDEFAULT_DEF15           = row.PAYOFFDEFAULT_DEF8;
                 payoffdef.PAYOFFDEFAULT_DEF16           = row.PAYOFFDEFAULT_DEF8;
                 payoffdef.PAYOFFDEFAULT_DEF17           = row.PAYOFFDEFAULT_DEF8;
                 payoffdef.PAYOFFDEFAULT_DEF18           = row.PAYOFFDEFAULT_DEF8;
                 payoffdef.PAYOFFDEFAULT_DEF19           = row.PAYOFFDEFAULT_DEF8;
                 payoffdef.PAYOFFDEFAULT_DEF20           = row.PAYOFFDEFAULT_DEF8;
                 payoffdef.PAYOFFDEFAULT_PAYOFFMASTER_ID = payoffMaster.ID;
                 dbContext.PayoffDefault.Add(payoffdef);
             }
         }
         dbContext.SaveChanges();
         foreach (var item in dbContext.PayoffDefault.Where(x => x.PAYOFFDEFAULT_PAYOFFMASTER_ID == payoffMaster.ID).ToList())
         {
             PayoffControl payoffControlVM = new PayoffControl();
             payoffControlVM.PAYOFFCONTROL_LB              = item.PAYOFFDEFAULT_DEF2;
             payoffControlVM.PAYOFFCONTROL_ITEMNAME        = item.PAYOFFDEFAULT_DEF5;
             payoffControlVM.PAYOFFCONTROL_UNIT            = item.PAYOFFDEFAULT_DEF6;
             payoffControlVM.PAYOFFCONTROL_SAP             = item.PAYOFFDEFAULT_DEF4;
             payoffControlVM.PAYOFFCONTROL_TENSIZUP        = Math.Round((Convert.ToDouble(item.PAYOFFDEFAULT_DEF8) / payoffMaster.PAYOFFMASTER_PARAMETERCODE), 2);
             payoffControlVM.PAYOFFCONTROL_TENUP           = Convert.ToDouble(item.PAYOFFDEFAULT_DEF8);
             payoffControlVM.PAYOFFCONTROL_QUANTITY        = Convert.ToDouble(item.PAYOFFDEFAULT_DEF12);
             payoffControlVM.PAYOFFCONTROL_TOTALTENUP      = payoffControlVM.PAYOFFCONTROL_QUANTITY * payoffControlVM.PAYOFFCONTROL_TENUP;
             payoffControlVM.PAYOFFCONTROL_TOTALTENSIZUP   = payoffControlVM.PAYOFFCONTROL_QUANTITY * payoffControlVM.PAYOFFCONTROL_TENSIZUP;
             payoffControlVM.PAYOFFCONTROL_PAYOFFMASTER_ID = payoffMaster.ID;
             payoffControlVM.PAYOFFCONTROL_TYPE_ID         = 0;
             dbContext.PayoffControl.Add(payoffControlVM);
         }
         dbContext.SaveChanges();
         foreach (var item in dbContext.PayoffDefault.Where(x => x.PAYOFFDEFAULT_PAYOFFMASTER_ID == payoffMaster.ID && (x.PAYOFFDEFAULT_DEF2 == "MON" || x.PAYOFFDEFAULT_DEF2 == "DM")).ToList())
         {
             PayoffControl payoffControlVM = new PayoffControl();
             payoffControlVM.PAYOFFCONTROL_LB              = item.PAYOFFDEFAULT_DEF2;
             payoffControlVM.PAYOFFCONTROL_ITEMNAME        = item.PAYOFFDEFAULT_DEF5;
             payoffControlVM.PAYOFFCONTROL_UNIT            = item.PAYOFFDEFAULT_DEF6;
             payoffControlVM.PAYOFFCONTROL_SAP             = item.PAYOFFDEFAULT_DEF4;
             payoffControlVM.PAYOFFCONTROL_TENSIZUP        = Math.Round((Convert.ToDouble(item.PAYOFFDEFAULT_DEF8) / payoffMaster.PAYOFFMASTER_PARAMETERCODE), 2);
             payoffControlVM.PAYOFFCONTROL_TENUP           = Convert.ToDouble(item.PAYOFFDEFAULT_DEF8);
             payoffControlVM.PAYOFFCONTROL_QUANTITY        = Convert.ToDouble(item.PAYOFFDEFAULT_DEF12);
             payoffControlVM.PAYOFFCONTROL_TOTALTENUP      = payoffControlVM.PAYOFFCONTROL_QUANTITY * payoffControlVM.PAYOFFCONTROL_TENUP;
             payoffControlVM.PAYOFFCONTROL_TOTALTENSIZUP   = payoffControlVM.PAYOFFCONTROL_QUANTITY * payoffControlVM.PAYOFFCONTROL_TENSIZUP;
             payoffControlVM.PAYOFFCONTROL_PAYOFFMASTER_ID = payoffMaster.ID;
             payoffControlVM.PAYOFFCONTROL_TYPE_ID         = 1;
             dbContext.PayoffControl.Add(payoffControlVM);
         }
         dbContext.SaveChanges();
         LoadData();
     }
 }