当前位置: 首页>>代码示例>>Python>>正文


Python MOSES.updateWorkCalendarFor方法代码示例

本文整理汇总了Python中MOSES.updateWorkCalendarFor方法的典型用法代码示例。如果您正苦于以下问题:Python MOSES.updateWorkCalendarFor方法的具体用法?Python MOSES.updateWorkCalendarFor怎么用?Python MOSES.updateWorkCalendarFor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MOSES的用法示例。


在下文中一共展示了MOSES.updateWorkCalendarFor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: saveThese

# 需要导入模块: import MOSES [as 别名]
# 或者: from MOSES import updateWorkCalendarFor [as 别名]
    def saveThese(self, selected_names):
        selected_employee_ids = [list(self.employees_list[self.employees_list["Name"] == x]["Employee ID"])[0] for x in selected_names]
        dates = [self.start_date.date().toPyDate(), self.end_date.date().toPyDate()]
        allow_continue = False
        if (len(selected_employee_ids)>1) and (dates[0] == dates[1]):
            ask = QtGui.QMessageBox.question(self, 'Multiple Employees Selected!', "You appear to have chosen the ids of several employees. Click yes if you'd like to continue modifying the work calendar for all their names. If not, click no and select only one employee's name.", QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.No)
            if ask == QtGui.QMessageBox.Yes:
                allow_continue = True
        elif (len(selected_employee_ids) > 1) and (dates[0] < dates[1]):
            ask = QtGui.QMessageBox.question(self, 'Multiple Dates and Employees Selected!', "You appear to have chosen the ids of several employees and an entire date range. Are you sure that you want to apply the settings for all of them for all these dates? I'd recommend changing the status of one employee for one date at a time. Click yes if you'd like to continue modifying the work calendar for all their names for those dates. If not, click no and select only one employee's name and one date.", QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.No)
            if ask == QtGui.QMessageBox.Yes:
                allow_continue = True
        elif (len(selected_employee_ids) == 1) and (dates[0] < dates[1]):
            ask = QtGui.QMessageBox.question(self, 'Multiple Dates Selected!', "You appear to have chosen an entire date range. Are you sure that you want to apply the settings for the selected employee all these dates? I'd recommend changing the status of one employee for one date at a time. Click yes if you'd like to continue modifying the work calendar for all their names for those dates. If not, click no and select only one date.", QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.No)
            if ask == QtGui.QMessageBox.Yes:
                allow_continue = True
        elif (len(selected_employee_ids) <= 0):
            self.alertMessage('No Employees Selected!', "Please select an employee in order to process the work status and relaxation.")
        else:
            allow_continue = True

        if allow_continue:
            status = str(self.status_combobox.currentText())
            relaxation = self.relaxation_spinbox.value()/100
            comment = str(self.comment_lineedit.text())
            if self.approve_selected_button.isChecked():
                approval = "Approved"
            elif self.reject_selected_button.isChecked():
                approval = "Rejected"
            else:
                approval = "Pending"
            approval_comment = str(self.rejection_comment_lineedit.text())
            self.alertMessage("Please Wait","This could take a while. Click OK and hold on to your horses.")
            update = MOSES.updateWorkCalendarFor(self.user_id, self.password, status, relaxation, comment, approval, approval_comment, dates, selected_employee_ids)
            if update:
                self.alertMessage("Success","Successfully updated the Work Calendar")
                self.applyFilters()
            else:
                self.alertMessage("Failure","Failed in updating the Work Calendar")

        else:
            print "Not allowed to continue"
开发者ID:vinay87,项目名称:oink,代码行数:44,代码来源:LeaveApproval.py


注:本文中的MOSES.updateWorkCalendarFor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。