Exemplo n.º 1
0
 def button(self):
     from Director.Director import InsertDirectorAPI
     self.value = self.view.ui.lineEdit.text()
     if self.value == "":
         return 0
     self.api = InsertDirectorAPI()
     self.api.insertInv(self.value)
Exemplo n.º 2
0
	def ok(self):
		from Director.Director import InsertDirectorAPI
		from database import create_debug_engine, create_session
		de = create_debug_engine(True)
		session = create_session(de)
		self.api = InsertDirectorAPI()
		self.data = self.line()
		if self.data[0] == "":
			return self.view.close()
		session.add(self.api.insertUser(self.data[0],self.data[1],self.data[2],self.data[3],self.data[4]))
		session.commit()
		return self.view.close()
Exemplo n.º 3
0
class Inventory_controller:
    def __init__(self, view):
        self.view = view
        ui = view.ui
        ui.pushButton.pressed.connect(self.button)

    def button(self):
        from Director.Director import InsertDirectorAPI
        self.value = self.view.ui.lineEdit.text()
        if self.value == "":
            return 0
        self.api = InsertDirectorAPI()
        self.api.insertInv(self.value)
Exemplo n.º 4
0
	def accept(self):
		from Director.Director import InsertDirectorAPI
		from database import create_debug_engine, create_session
		de = create_debug_engine(True)
		session = create_session(de)
		self.api = InsertDirectorAPI()
		self.data = self.line()
		if self.data[0] == "":
			return self.view.ui.label12.setText("Пожалуйста, заполните все поля!!!")
		self.n = self.api.insertUser(self.data[0],self.data[1],self.data[2],self.data[3],self.data[4])
		if type(self.n) == str:
			return self.view.ui.label12.setText(self.n)
		session.add(self.n)
		return session.commit()
Exemplo n.º 5
0
class Newuser_controller:
	def __init__(self, view):
		self.view = view
		ui = view.ui
		ui.pushButton.pressed.connect(self.ok)
		ui.pushButton_2.pressed.connect(self.accept)
		ui.pushButton_3.pressed.connect(self.cancel)
	def line(self):
		self.a = self.view.ui.comboBox.currentText()
		self.b = self.view.ui.comboBox_2.currentText()
		if self.a == "Да":
			self.a = 1
		else:
			self.a=0
		if self.b == "Да":
			self.b = 1
		else:
			self.b=0
		return (self.view.ui.lineEdit.text(), self.view.ui.lineEdit_2.text(),self.view.ui.lineEdit1.text(), self.a, self.b)
	def ok(self):
		from Director.Director import InsertDirectorAPI
		from database import create_debug_engine, create_session
		de = create_debug_engine(True)
		session = create_session(de)
		self.api = InsertDirectorAPI()
		self.data = self.line()
		if self.data[0] == "":
			return self.view.close()
		session.add(self.api.insertUser(self.data[0],self.data[1],self.data[2],self.data[3],self.data[4]))
		session.commit()
		return self.view.close()
	def accept(self):
		from Director.Director import InsertDirectorAPI
		from database import create_debug_engine, create_session
		de = create_debug_engine(True)
		session = create_session(de)
		self.api = InsertDirectorAPI()
		self.data = self.line()
		if self.data[0] == "":
			return self.view.ui.label12.setText("Пожалуйста, заполните все поля!!!")
		self.n = self.api.insertUser(self.data[0],self.data[1],self.data[2],self.data[3],self.data[4])
		if type(self.n) == str:
			return self.view.ui.label12.setText(self.n)
		session.add(self.n)
		return session.commit()

	def cancel(self):
		return self.view.close()
Exemplo n.º 6
0
	def accept(self):
		from Director.Director import InsertDirectorAPI
		from database import create_debug_engine, create_session
		de = create_debug_engine(True)
		session = create_session(de)
		self.api = InsertDirectorAPI()
		self.data = self.line()
		if self.data == None:
			return 0
		if self.data[0] == "":
			return self.view.ui.label_5.setText("Пожалуйста, заполните все поля!!!")
		self.n = self.api.insertShare(self.user_id, self.data[0], self.data[1], self.data[2], self.data[3])
		if type(self.n) == str:
			return self.view.ui.label_5.setText(self.n)
		if self.n ==0:
			return self.view.ui.label_5.setText("Данные обновлены") 
		session.add(self.n)
		return session.commit()
Exemplo n.º 7
0
class Share_controller:
	def __init__(self, view):
		self.view = view
		ui = view.ui
		self.user_id = view.model
		ui.pushButton.pressed.connect(self.accept)
		ui.pushButton_2.pressed.connect(self.cancel)
	def line(self):
		sign = ", \\ ] [ ) ( ) > < : ; \' \" ! @ # $ % ^ & * № ` ~ { }"
		sign = sign.split()
		self.a = self.view.ui.lineEdit_2.text()

		for self.i in sign:
			self.a = self.a.replace(self.i,".")


		try:
			self.b = int(self.view.ui.lineEdit_3.text())
			self.a = float(self.a)
			return (self.view.ui.lineEdit.text(), self.a,self.b, self.view.ui.lineEdit_4.text())
		except:
			return self.view.ui.label_5.setText("Пожалуйста, введите числовое значение в поле!!!")

	def accept(self):
		from Director.Director import InsertDirectorAPI
		from database import create_debug_engine, create_session
		de = create_debug_engine(True)
		session = create_session(de)
		self.api = InsertDirectorAPI()
		self.data = self.line()
		if self.data == None:
			return 0
		if self.data[0] == "":
			return self.view.ui.label_5.setText("Пожалуйста, заполните все поля!!!")
		self.n = self.api.insertShare(self.user_id, self.data[0], self.data[1], self.data[2], self.data[3])
		if type(self.n) == str:
			return self.view.ui.label_5.setText(self.n)
		if self.n ==0:
			return self.view.ui.label_5.setText("Данные обновлены") 
		session.add(self.n)
		return session.commit()

	def cancel(self):
		return self.view.close()