public override sealed void DrawControls() { if (IsLoad) { TypesOfLampsStatus state = Accessory.GetState(TypeOfAccessories.ElectronicUnit, UnitBarcode); ListOfLabelsConstructor list = new ListOfLabelsConstructor(MainProcess, "Ел. блок", getData()); list.ListOfLabels = new List <LabelForConstructor> { new LabelForConstructor(string.Empty, false), new LabelForConstructor(string.Empty, false), new LabelForConstructor(string.Empty, false), new LabelForConstructor(string.Empty, false), new LabelForConstructor("Модель: {0}"), new LabelForConstructor("Партія: {0}"), new LabelForConstructor("Гарантія до {0}") }; if (state == TypesOfLampsStatus.ToRepair) { MainProcess.CreateButton("Зберігання", 15, 275, 100, 35, "storage", Storage_Click); } else { MainProcess.CreateButton("Ремонт", 15, 275, 100, 35, "repair", Repair_Click); } MainProcess.CreateButton("Списання", 125, 275, 100, 35, "writeoff", Writeoff_Click, null, null, state != TypesOfLampsStatus.ToCharge); } }
public override sealed void DrawControls() { if (IsLoad) { TypesOfLampsStatus state = Accessory.GetState(TypeOfAccessories.Case, CaseBarcode); ListOfLabelsConstructor list = new ListOfLabelsConstructor(MainProcess, ResultParameters); list.ListOfLabels = new List <LabelForConstructor> { new LabelForConstructor("Корпус", ControlsStyle.LabelH2), new LabelForConstructor("Модель: {0}"), new LabelForConstructor("Партія: {0}"), new LabelForConstructor("Гарантія до {0}"), new LabelForConstructor("Електроблок", ControlsStyle.LabelH2), new LabelForConstructor("Партія: {0}", 1), new LabelForConstructor("Гарантія до {0}"), }; MainProcess.CreateButton("Уснановка", 15, 225, 100, 35, "installNew", InstallNew); MainProcess.CreateButton("Розібрати", 125, 225, 100, 35, "collate", Collate); if (state == TypesOfLampsStatus.ToRepair) { MainProcess.CreateButton("Зберігання", 15, 275, 100, 35, "storages", Storages); } else { MainProcess.CreateButton("Ремонт", 15, 275, 100, 35, "repair", Repair); } MainProcess.CreateButton("Спиння", 125, 275, 100, 35, "writeoff", WriteOff, null, null, state != TypesOfLampsStatus.ToCharge); } }
private bool correctAccessoryStatus(string barcode) { TypesOfLampsStatus state = Accessory.GetState(TypeOfAccessories.ElectronicUnit, barcode); if (state == TypesOfLampsStatus.ToRepair) { return(true); } else { ShowMessage(@"Комплектуюча має бути у статусі ""На ремонті""!"); return(false); } }
private void ok_Click() { object caseId = BarcodeWorker.GetIdByBarcode(CaseBarcode); //Статус корпуса, в который запихиваем новое комплектующее TypesOfLampsStatus status = Accessory.GetState(TypeOfAccessories.Case, CaseBarcode.ToString()); bool isLamp = accessoryTable == typeof(db.Lamps).Name; object accessoryId = BarcodeWorker.GetIdByBarcode(NewAccessoryBarcode.ToString()); string command = string.Format( "UPDATE {0} SET Status=@IsWorking,[Case]=@Case,{1}=0,DateOfActuality=@Date{2} WHERE RTRIM(BarCode)=@Barcode", accessoryTable, dbObject.IS_SYNCED, isLamp ? ",Barcode=@NewBarCode" : string.Empty); using (SqlCeCommand query = dbWorker.NewQuery(command)) { query.AddParameter("Barcode", NewAccessoryBarcode); query.AddParameter("NewBarCode", string.Empty); query.AddParameter("Case", caseId); query.AddParameter("IsWorking", status); query.AddParameter("Date", DateTime.Now); query.ExecuteNonQuery(); } using (SqlCeCommand query = dbWorker.NewQuery(string.Format( "UPDATE Cases SET {0}=@Id,{1}=0,DateOfActuality=@Date WHERE RTRIM(BarCode)=@Case", accessoryField, dbObject.IS_SYNCED))) { query.AddParameter("Case", CaseBarcode); query.AddParameter("Id", accessoryId); query.AddParameter("Date", DateTime.Now); query.ExecuteNonQuery(); } //query = dbWorker.NewQuery(string.Format( // "UPDATE {0} SET Status=@IsWorking,[Case]=@Id,{1}=0,DateOfActuality=@Date WHERE {2}=@Id", // accessoryTable, // dbObject.IS_SYNCED, // dbObject.IDENTIFIER_NAME)); //query.AddParameter("Id", caseId); //query.AddParameter(dbObject.IDENTIFIER_NAME, accessoryId); //query.AddParameter("Date", DateTime.Now); //query.ExecuteNonQuery(); //string caseBarcode = CaseBarcode.ToString(); //installMovement(caseBarcode); OnHotKey(KeyAction.Esc); }
private void finish(bool isForExchange) { object[] result = null; //Штрихкод установленной лампы using (SqlCeCommand query = dbWorker.NewQuery(string.Format(@" SELECT a.Barcode, a.SyncRef FROM Cases c LEFT JOIN {0} a ON a.Id=c.{1} WHERE RTRIM(c.BarCode)=@BarCode", accessoryTable, accessoryTable.Substring(0, accessoryTable.Length - 1)))) { query.AddParameter("BarCode", CaseBarcode); result = query.SelectArray(); } if (result != null && result.Length == 2) { object oldLampBarcode = result[0]; object accessoryRef = result[1]; object caseId = BarcodeWorker.GetIdByBarcode(CaseBarcode); object newAccessoryId = BarcodeWorker.GetIdByBarcode(NewAccessoryBarcode); bool isLamp = accessoryTable == typeof(db.Lamps).Name; string partOfCommand = string.Format( "UPDATE {0} SET Status=@Status{1},[Case]=@Case,{2}=0,DateOfActuality=@Date{3} WHERE ", accessoryTable, type != TypeOfAccessories.ElectronicUnit ? ", Barcode=@NewBarcode " : string.Empty, dbObject.IS_SYNCED, "{0}"); //Статус комплектующего, которое меняем TypesOfLampsStatus status = Accessory.GetState(TypeOfAccessories.Lamp, oldLampBarcode.ToString()); //Старое комплектующее using (SqlCeCommand query = dbWorker.NewQuery(string.Concat( string.Format(partOfCommand, ",DrawdownDate=@DrawdownDate"), " RTRIM(SyncRef)=RTRIM(@SyncRef)"))) { query.AddParameter("Status", isForExchange ? TypesOfLampsStatus.ToRepair : TypesOfLampsStatus.Storage); query.AddParameter("Case", 0); query.AddParameter("LampBarcode", oldLampBarcode); query.AddParameter("NewBarcode", isLamp ? NewAccessoryBarcode : oldLampBarcode); query.AddParameter(dbObject.SYNCREF_NAME, accessoryRef); query.AddParameter("Date", DateTime.Now); query.AddParameter("DrawdownDate", DateTime.Now); query.ExecuteNonQuery(); } //Новое комплектующее using ( SqlCeCommand query = dbWorker.NewQuery(string.Concat(string.Format(partOfCommand, string.Empty), " Id=@Id"))) { query.AddParameter("Status", status); query.AddParameter("Case", caseId); query.AddParameter("Id", newAccessoryId); query.AddParameter("NewBarcode", isLamp ? string.Empty : oldLampBarcode); query.AddParameter("Date", DateTime.Now); query.ExecuteNonQuery(); } //Замена комплектующего в светильнике using (SqlCeCommand query = dbWorker.NewQuery(string.Format( "UPDATE CASES SET {0}=@NewAccessoryId,{1}=0,DateOfActuality=@Date WHERE RTRIM(BarCode)=RTRIM(@CaseBarcode)", accessoryField, dbObject.IS_SYNCED))) { query.AddParameter("CaseBarcode", CaseBarcode); query.AddParameter("NewAccessoryId", newAccessoryId); query.AddParameter("Date", DateTime.Now); query.ExecuteNonQuery(); } //Завершение //string caseBarcode = CaseBarcode.ToString(); //installMovement(caseBarcode); //removeMovement(oldLampBarcode.ToString(), caseBarcode); OnHotKey(KeyAction.Esc); } }