コード例 #1
0
    public DataView loadData(ListInfo info, DBManager db, Repeater repeater)
    {
        DBFilter filter = binding.createFilter();

        //if (info != null && info.orderby != null && !info.orderby.Equals(""))
        //    filter.add(info.orderby, info.order);


        string select = "e.*";
        string from   = "from [" + db.dbclass.tableName + "] e ";//LEFT JOIN " + EEmpPositionInfo.db.dbclass.tableName + " p ON c.EmpID=p.EmpID AND p.EmpPosEffTo IS NULL";

        filter.add(WebUtils.AddRankFilter(Session, "e.EmpID", true));
        //foreach (RepeaterItem item in HierarchyLevel.Items)
        //{
        //    DBFilter sub = null;
        //    DropDownList c = (DropDownList)item.FindControl("HElementID");
        //    string v = c.SelectedValue;
        //    if (!v.Equals(""))
        //    {
        //        if (sub == null)
        //        {
        //            sub = new DBFilter();
        //            sub.add(new MatchField("p.EmpPosID", "EmpPosID"));
        //        }
        //        sub.add(new Match("HLevelID", c.Attributes["HLevelID"]));
        //        sub.add(new Match("HElementID", v));
        //    }
        //    if (sub != null)
        //        filter.add(new Exists(EEmpHierarchy.db.dbclass.tableName, sub));
        //}

        DBFilter empInfoFilter = EmployeeSearchControl1.GetEmpInfoFilter(AppUtils.ServerDateTime(), AppUtils.ServerDateTime());

        empInfoFilter.add(new MatchField("e.EmpID", "ee.EmpID"));
        filter.add(new Exists(EEmpPersonalInfo.db.dbclass.tableName + " ee", empInfoFilter));

        DataTable table = filter.loadData(dbConn, null, select, from);

        table = EmployeeSearchControl1.FilterEncryptedEmpInfoField(table, info);

        view = new DataView(table);
        if (repeater != null)
        {
            repeater.DataSource = view;
            repeater.DataBind();
        }

        return(view);
    }
コード例 #2
0
    public DataView loadData(ListInfo info, DBManager db, Repeater repeater)
    {
        DBFilter filter = binding.createFilter();

        if (info != null && info.orderby != null && !info.orderby.Equals(""))
        {
            filter.add(info.orderby, info.order);
        }


        string select = "et.EmpTermID, e.*";
        string from   = "from [" + db.dbclass.tableName + "] e ";//LEFT JOIN " + EEmpPositionInfo.db.dbclass.tableName + " p ON c.EmpID=p.EmpID AND p.EmpPosEffTo IS NULL";

        from += " inner join " + EEmpTermination.db.dbclass.tableName + " et on et.empid = e.empid ";
        filter.add(WebUtils.AddRankFilter(Session, "e.EmpID", true));

        //DateTime dtLastEmploymentDateFrom, dtLastEmploymentDateTo;
        //if (DateTime.TryParse(((WebDatePicker)EmployeeSearchControl1.AdditionElementControl.FindControl("LastEmploymentDateFrom")).Value, out dtLastEmploymentDateFrom))
        //    filter.add(new Match("et.EmpTermLastDate", ">=", dtLastEmploymentDateFrom));
        //if (DateTime.TryParse(((WebDatePicker)EmployeeSearchControl1.AdditionElementControl.FindControl("LastEmploymentDateTo")).Value, out dtLastEmploymentDateTo))
        //    filter.add(new Match("et.EmpTermLastDate", "<=", dtLastEmploymentDateTo));

        DBFilter empPayrollFilter = new DBFilter();

        empPayrollFilter.add(Payroll_PeriodSelectionList1.GetEmpPayrollDBTerm());
        DBFilter lastEmploymentDateFilter = new DBFilter();

        lastEmploymentDateFilter.add(new MatchField("et.EmpTermLastDate", "<=", "tmpPP.PayPeriodTo"));
        empPayrollFilter.add(new IN("ep.PayPeriodID", "SELECT tmpPP.PayPeriodID FROM " + EPayrollPeriod.db.dbclass.tableName + " tmpPP", lastEmploymentDateFilter));
        filter.add(new IN("e.EmpID", "SELECT DISTINCT ep.EmpID FROM " + EEmpPayroll.db.dbclass.tableName + " ep", empPayrollFilter));

        DBFilter empInfoFilter = EmployeeSearchControl1.GetEmpInfoFilter(AppUtils.ServerDateTime(), AppUtils.ServerDateTime());

        empInfoFilter.add(new MatchField("e.EmpID", "ee.EmpID"));
        filter.add(new Exists(EEmpPersonalInfo.db.dbclass.tableName + " ee", empInfoFilter));

        DataTable table = filter.loadData(dbConn, null, select, from);

        table = EmployeeSearchControl1.FilterEncryptedEmpInfoField(table, info);

        view = new DataView(table);
        if (repeater != null)
        {
            repeater.DataSource = view;
            repeater.DataBind();
        }

        return(view);
    }
    protected void Repeater_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        EIncentivePayment obj = new EIncentivePayment();

        db.toObject(((DataRowView)e.Item.DataItem).Row, obj);
        Hashtable values = new Hashtable();

        db.populate(obj, values);

        {
            //((Button)e.Item.FindControl("Edit")).Visible = IsAllowEdit;
            //if (obj.PayRecID != null)
            //{
            //    ((Button)e.Item.FindControl("Edit")).Visible = false;
            //    ((CheckBox)e.Item.FindControl("DeleteItem")).Visible = false;
            //}
            HtmlInputHidden h = (HtmlInputHidden)e.Item.FindControl("IPID");
            h.Value = obj.IPID.ToString();



            Label IPPercent = (Label)e.Item.FindControl("IPPercent");
            Label IPEffDate = (Label)e.Item.FindControl("IPEffDate");

            Binding ebinding = new Binding(dbConn, db);
            ebinding.add(IPPercent);
            ebinding.add(IPEffDate);
//            ebinding.add(new BlankZeroLabelVLBinder(EEmpBankAccount.db, EmpAccID, "EmpAccID", EEmpBankAccount.VLBankAccount).setTextDisplayForZero(HROne.Common.WebUtility.GetLocalizedString(EEmpBankAccount.DEFAULT_BANK_ACCOUNT_TEXT)));
            ebinding.init(Request, Session);
            ebinding.toControl(values);

            DBFilter empRankFilter = new DBFilter();
            empRankFilter.add(WebUtils.AddRankFilter(Session, "EmpID", true));
            empRankFilter.add(new Match("EmpID", obj.EmpID));
            if (EEmpPersonalInfo.db.count(dbConn, empRankFilter) > 0)
            {
                IPPercent.Text = obj.IPPercent.ToString("#0.00");
                if (!obj.IPEffDate.Ticks.Equals(0))
                {
                    IPEffDate.Text = obj.IPEffDate.ToString("yyyy-MM-dd");
                }
            }
            else
            {
                IPPercent.Text = "******";
                IPEffDate.Text = "******";
            }
        }
    }
コード例 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtils.CheckAccess(Response, Session))
        {
            return;
        }


        EESSUser user = WebUtils.GetCurUser(Session);

        if (user != null)
        {
            m_ESSUserID = user.EmpID;
        }
        // Start 0000209, Miranda, 2015-06-11
        HROne.Common.WebUtility.WebControlsLocalization(this, this.Controls);
        // End 0000209, Miranda, 2015-06-11
        DateTime currentDate = AppUtils.ServerDateTime().Date;
        DBFilter empRosterTableGroupFilter = new DBFilter();

        empRosterTableGroupFilter.add(new Match("ertg.EmpID", m_ESSUserID));
        OR orEmpRosterTableGroupFromTerm = new OR();

        orEmpRosterTableGroupFromTerm.add(new Match("ertg.EmpRosterTableGroupEffFr", "<=", currentDate));
        orEmpRosterTableGroupFromTerm.add(new NullTerm("ertg.EmpRosterTableGroupEffFr"));
        empRosterTableGroupFilter.add(orEmpRosterTableGroupFromTerm);
        OR orEmpRosterTableGroupToTerm = new OR();

        orEmpRosterTableGroupToTerm.add(new Match("ertg.EmpRosterTableGroupEffTo", ">=", currentDate));
        orEmpRosterTableGroupToTerm.add(new NullTerm("ertg.EmpRosterTableGroupEffTo"));
        empRosterTableGroupFilter.add(orEmpRosterTableGroupToTerm);

        DBFilter RosterTableGroupIDFilter = new DBFilter();

        RosterTableGroupIDFilter.add(new IN("RosterTableGroupID", "SELECT ertg.RosterTableGroupID FROM " + EEmpRosterTableGroup.db.dbclass.tableName + " ertg", empRosterTableGroupFilter));
        sbinding = new SearchBinding(dbConn, ERosterClientSite.db);
        sbinding.add(new DropDownVLSearchBinder(RosterTableGroupID, "RosterTableGroupID", ERosterTableGroup.VLRosterTableGroup).setFilter(RosterTableGroupIDFilter));
        sbinding.init(DecryptedRequest, null);

        RosterTableGroupID.Items[0].Text = "All";


        HtmlLink cssLink = new HtmlLink();

        cssLink.Href = "~/CSS/RadScheduler.css";
        cssLink.Attributes.Add("rel", "stylesheet");
        cssLink.Attributes.Add("type", "text/css");
        Header.Controls.Add(cssLink);
    }
コード例 #5
0
    protected void Delete_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        EWorkHourPattern o = new EWorkHourPattern();

        o.WorkHourPatternID = CurID;
        db.select(dbConn, o);
        DBFilter empWorkHourPatternFilter = new DBFilter();

        empWorkHourPatternFilter.add(new Match("WorkHourPatternID", o.WorkHourPatternID));
        empWorkHourPatternFilter.add("empid", true);
        ArrayList empPosList = EEmpPositionInfo.db.select(dbConn, empWorkHourPatternFilter);

        if (empPosList.Count > 0)
        {
            int curEmpID = 0;
            errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_USED_BY_EMPLOYEE, new string[] { HROne.Common.WebUtility.GetLocalizedString("Work Hour Pattern"), o.WorkHourPatternCode }));
            foreach (EEmpPositionInfo empPos in empPosList)
            {
                EEmpPersonalInfo empInfo = new EEmpPersonalInfo();
                empInfo.EmpID = empPos.EmpID;
                if (EEmpPersonalInfo.db.select(dbConn, empInfo))
                {
                    if (curEmpID != empPos.EmpID)
                    {
                        errors.addError("- " + empInfo.EmpNo + ", " + empInfo.EmpEngFullName);
                        curEmpID = empPos.EmpID;
                    }
                }
                // Start 0000148, Ricky So, 2014/12/21
                //else
                //    EEmpPositionInfo.db.delete(dbConn, empPos);
                // End 0000148, Ricky So, 2014/12/21
            }
            errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT);
            return;
        }
        else
        {
            WebUtils.StartFunction(Session, FUNCTION_CODE);
            db.delete(dbConn, o);
            WebUtils.EndFunction(dbConn);
        }

        HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "WorkHourPattern_List.aspx");
    }
コード例 #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtils.CheckAccess(Response, Session))
        {
            return;
        }
        binding = new Binding(dbConn, db);

        EESSUser user = WebUtils.GetCurUser(Session);

        if (user != null)
        {
            CurID = user.EmpID;
        }

        DBFilter empTaxFilter = new DBFilter();

        empTaxFilter.add(new Match("te.EmpID", CurID));
        empTaxFilter.add(new Match("te.TaxEmpIsReleasePrintoutToESS", true));
        empTaxFilter.add(new MatchField("TaxForm.TaxFormID", "te.TaxFormID"));

        //if (!IsPostBack)
        {
            DBFilter taxFormFilter = new DBFilter();
            taxFormFilter.add(new Match("TaxFormType", "B"));
            taxFormFilter.add("TaxFormYear", false);
            taxFormFilter.add(new Exists("TaxEmp te", empTaxFilter));
            binding.add(new DropDownVLBinder(ETaxForm.db, TaxFormID, ETaxForm.VLTaxFormYear, taxFormFilter));
        }


        binding.init(Request, Session);


        HROne.Common.WebUtility.WebControlsLocalization(this, this.Controls);



        if (!Page.IsPostBack)
        {
            if (CurID > 0)
            {
                loadObject();
            }
            else
            {
            }
        }
    }
コード例 #7
0
    //protected void PopulateEditForm(Appointment editedAppointment)
    //{
    //    WebFormUtils.loadValues(RosterClientID, ERosterClient.VLRosterClient, new DBFilter());

    //    if (editedAppointment.ID != null)
    //    {
    //        string[] id_Array = editedAppointment.ID.ToString().Split(new char[] { '_' });

    //        if (id_Array.GetLength(0) == 2)
    //        {
    //            if (id_Array[0].Equals("RosterTable"))
    //            {
    //                ERosterTable rosterTable = new ERosterTable();
    //                rosterTable.RosterTableID = int.Parse(id_Array[1]);
    //                if (ERosterTable.db.select(dbConn, rosterTable))
    //                {
    //                    Binding ebinding = new Binding(dbConn, ERosterTable.db);
    //                    ebinding.add(RosterTableID);
    //                    ebinding.add(EmpID);
    //                    ebinding.add(RosterTableDate);
    //                    ebinding.add(new DropDownVLBinder(ERosterTable.db, RosterCodeID, ERosterCode.VLRosterCode));
    //                    ebinding.init(Request, Session);
    //                    Hashtable values = new Hashtable();
    //                    ERosterTable.db.populate(rosterTable, values);
    //                    ebinding.toControl(values);

    //                    EEmpPersonalInfo empInfo = new EEmpPersonalInfo();
    //                    empInfo.EmpID = rosterTable.EmpID;
    //                    if (EEmpPersonalInfo.db.select(dbConn, empInfo))
    //                        EmpName.Text = empInfo.EmpEngFullNameWithAlias;
    //                    else
    //                        EmpName.Text = string.Empty;

    //                }

    //                ERosterCode rosterCode = new ERosterCode();
    //                rosterCode.RosterCodeID = rosterTable.RosterCodeID;
    //                ERosterCode.db.select(dbConn, rosterCode);
    //                if (rosterCode.RosterClientID > 0)
    //                    RosterClientID.SelectedValue = rosterCode.RosterClientID.ToString();

    //                RefreshClientSite(rosterCode.RosterClientID);

    //                if (rosterCode.RosterClientSiteID > 0)
    //                    RosterClientSiteID.SelectedValue = rosterCode.RosterClientSiteID.ToString();

    //                RefreshRosterCode(rosterCode.RosterClientSiteID);
    //            }
    //        }
    //    }
    //}

    //protected void RefreshClientSite(int RosterClientID)
    //{
    //    string selected = RosterClientSiteID.SelectedValue;

    //    DBFilter rosterClientSiteFilter = new DBFilter();
    //    rosterClientSiteFilter.add(new Match("RosterClientID", RosterClientID));
    //    WebFormUtils.loadValues(RosterClientSiteID, ERosterClientSite.VLRosterClientSite, rosterClientSiteFilter, null, (string)selected, (string)"combobox.notselected");

    //}

    //protected void RefreshRosterCode(int RosterClientSiteID)
    //{
    //    string selected = RosterCodeID.SelectedValue;

    //    DBFilter rosterCodeFilter = new DBFilter();
    //    rosterCodeFilter.add(new Match("RosterClientSiteID", RosterClientSiteID));
    //    WebFormUtils.loadValues(RosterCodeID, ERosterCode.VLRosterCode, rosterCodeFilter, null, (string)selected, (string)"combobox.notselected");


    //}

    //protected void SubmitButton_Click(object sender, EventArgs e)
    //{
    //    ERosterTable rosterTable = new ERosterTable();

    //    Binding ebinding = new Binding(dbConn, ERosterTable.db);
    //    ebinding.add(RosterTableID);
    //    ebinding.add(RosterTableDate);
    //    ebinding.add(EmpID);
    //    ebinding.add(new DropDownVLBinder(ERosterTable.db, RosterCodeID, ERosterCode.VLRosterCode));
    //    Hashtable values = new Hashtable();
    //    ebinding.toValues(values);
    //    ERosterTable.db.parse(values, rosterTable);

    //    ERosterTable.db.update(dbConn, rosterTable);

    //    //// Create resource based on the selected user
    //    ////Resource user = new Resource("User", int.Parse(UserDropDown.SelectedValue), UserDropDown.SelectedItem.Text);
    //    //DateTime start = RadScheduler1.DisplayToUtc(StartTime.SelectedDate.Value);
    //    //DateTime end = RadScheduler1.DisplayToUtc(EndTime.SelectedDate.Value);

    //    //if (EditedAppointmentID == null)
    //    //{
    //    //    // Insert
    //    //    Appointment appointment = new Appointment(null, start, end, DescriptionText.Text);
    //    //    //appointment.Resources.Add(user);

    //    //    RadScheduler1.InsertAppointment(appointment);
    //    //}
    //    //else
    //    //{
    //    //    Appointment appointment = RadScheduler1.Appointments.FindByID(EditedAppointmentID);
    //    //    Appointment appointmentToUpdate = RadScheduler1.PrepareToEdit(appointment, RadScheduler1.EditingRecurringSeries);

    //    //    appointmentToUpdate.Subject = DescriptionText.Text;
    //    //    appointmentToUpdate.Start = start;
    //    //    appointmentToUpdate.End = end;

    //    //    // Remove the existing user resource, if any
    //    //    Resource existingUser = appointmentToUpdate.Resources.GetResourceByType("User");
    //    //    if (existingUser != null)
    //    //    {
    //    //        appointmentToUpdate.Resources.Remove(existingUser);
    //    //    }
    //    //    //appointmentToUpdate.Resources.Add(user);

    //    //    RadScheduler1.UpdateAppointment(appointmentToUpdate);
    //    //}
    //    RadScheduler1.Rebind();
    //    RadDock1.Closed = true;
    //}



    //protected void RosterClientID_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //    string selected = RosterClientID.SelectedValue;
    //    int intRosterClientID;

    //    if (int.TryParse(selected, out intRosterClientID))
    //        RefreshClientSite(intRosterClientID);
    //    else
    //        RefreshClientSite(0);

    //    selected = RosterClientSiteID.SelectedValue;
    //    int intRosterClientSiteID;

    //    if (int.TryParse(selected, out intRosterClientSiteID))
    //        RefreshRosterCode(intRosterClientSiteID);
    //    else
    //        RefreshRosterCode(0);

    //}
    //protected void RosterClientSiteID_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //    string selected = RosterClientSiteID.SelectedValue;
    //    int intRosterClientSiteID;

    //    if (int.TryParse(selected, out intRosterClientSiteID))
    //        RefreshRosterCode(intRosterClientSiteID);
    //    else
    //        RefreshRosterCode(0);

    //}
    //protected void RadDock1_DockPositionChanged(object sender, DockPositionChangedEventArgs e)
    //{
    //    System.Diagnostics.Debug.Write(e.ToString());
    //}

    public void rosterClientSiteloadData()
    {
        DBFilter filter = new DBFilter();

        //if (info != null && info.orderby != null && !info.orderby.Equals(""))
        //    filter.add(info.orderby, info.order);

        string select = "* ";
        string from   = "from " + ERosterClientSite.db.dbclass.tableName + " ";

        DataTable table = filter.loadData(dbConn, null, select, from);

        rosterClientSiteRepeater.DataSource = table;
        rosterClientSiteRepeater.DataBind();
    }
コード例 #8
0
        protected override void afterDelete(DatabaseConnection dbConn, DBManager db)
        {
            base.afterDelete(dbConn, db);

            //  Delete leave application only if roster table is not mapped to this leave application
            if (this.LeaveAppID > 0)
            {
                DBFilter filter = new DBFilter();
                filter.add(new Match("LeaveAppID", this.LeaveAppID));
                if (ERosterTable.db.count(dbConn, filter) <= 0)
                {
                    DeleteLeaveApplication(dbConn, this);
                }
            }
        }
コード例 #9
0
ファイル: DataDict.cs プロジェクト: dhamotharang/H-R-One
        public static bool IsHoliday(DatabaseConnection dbConn, DateTime date)
        {
            DBFilter filter = new DBFilter();

            filter.add(new Match("PublicHolidayDate", date));

            if (db.count(dbConn, filter) > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #10
0
    protected void init_PaymentCodeDropdown()
    {
        if (PaymentCode.Items.Count <= 0)
        {
            PaymentCode.Items.Add(new ListItem("Not Selected", "-1"));

            DBFilter m_filter = new DBFilter();
            m_filter.add("PaymentCode", true);

            foreach (EPaymentCode o in EPaymentCode.db.select(dbConn, m_filter))
            {
                PaymentCode.Items.Add(new ListItem(string.Format("{0} - {1}", o.PaymentCode, o.PaymentCodeDesc), o.PaymentCodeID.ToString()));
            }
        }
    }
コード例 #11
0
    public DBFilter getPayrollPeriodFilter()
    {
        DBFilter filter = new DBFilter();

        filter.add(new Match("PayGroupID", CurPayGroupID));
        DateTime dtPayPeriodFr;
        DateTime dtPayPeriodTo;

        if (DateTime.TryParse(PayPeriodFr.Value, out dtPayPeriodFr) && DateTime.TryParse(PayPeriodTo.Value, out dtPayPeriodTo))
        {
            filter.add(new Match("pp.PayPeriodFr", "<=", dtPayPeriodTo));
            filter.add(new Match("pp.PayPeriodTo", ">=", dtPayPeriodFr));
        }
        return(filter);
    }
コード例 #12
0
    public void loadPermissions(Repeater repeater, string category)
    {
        DBFilter filter = new DBFilter();

        //foreach (string allowFunctionCode in AllowEmailFunctionList)
        //    filter.add(new Match("FunctionCode", allowFunctionCode));
        filter.add(new Match("FunctionCategory", category));
        //filter.add(new Match("FunctionIsHidden", "<>", true));
        filter.add("FunctionCode", true);
        DataTable table = ESystemFunction.db.loadDataSet(dbConn, null, filter);
        DataView  view  = new DataView(table);

        repeater.DataSource = view;
        repeater.DataBind();
    }
コード例 #13
0
 public static EBankSwift GetObjectByBankCode(DatabaseConnection dbConn, string p_bankCode, string p_countryCode)
 {
     if (!string.IsNullOrEmpty(p_bankCode))
     {
         DBFilter m_filter = new DBFilter();
         m_filter.add(new Match("BankCode", p_bankCode));
         m_filter.add(new Match("CountryCode", p_countryCode));
         ArrayList m_list = EBankSwift.db.select(dbConn, m_filter);
         if (m_list.Count > 0)
         {
             return((EBankSwift)m_list[0]);
         }
     }
     return(null);
 }
コード例 #14
0
    public DataView loadData(ListInfo info, DBManager db, Repeater repeater)
    {
        // Start 0000183, KuangWei, 2015-04-10
        if (isSupervisor(CurID))
        {
            TeamRecordExport.Visible = true;
        }
        // End 0000183, KuangWei, 2015-04-10

        DBFilter filter = sbinding.createFilter();
        OR       orTimeCardRecordHolder = new OR();

        orTimeCardRecordHolder.add(new Match("EmpID", CurID));
        //if (!string.IsNullOrEmpty(timeCardNo))
        orTimeCardRecordHolder.add(new Match("TimeCardRecordCardNo", GetTimeCardNo(CurID)));
        filter.add(orTimeCardRecordHolder);

        DateTime dtTimeCardRecordDate;

        if (!DateTime.TryParse(TimeCardRecordDate.Value, out dtTimeCardRecordDate))
        {
            dtTimeCardRecordDate = AppUtils.ServerDateTime().Date;
        }
        filter.add(new Match("TimeCardRecordDateTime", ">=", dtTimeCardRecordDate));
        filter.add(new Match("TimeCardRecordDateTime", "<", dtTimeCardRecordDate.AddDays(1)));


        //if (info != null && info.orderby != null && !info.orderby.Equals(""))
        //    filter.add(info.orderby, info.order);


        string select = "*";
        string from   = "from " + ETimeCardRecord.db.dbclass.tableName + "";


        DataTable table = filter.loadData(dbConn, info, select, from);

        view = new DataView(table);

        ListFooter.Refresh();

        if (repeater != null)
        {
            repeater.DataSource = view;
            repeater.DataBind();
        }
        return(view);
    }
コード例 #15
0
 public TableExpression(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
 {
     try
     {
         _SQLStatement = info.GetString("_SQLStatement");
     }
     catch
     {
         _SQLStatement = string.Empty;
     }
     try
     {
         _TableName = info.GetString("_TableName");
     }
     catch
     {
         _TableName = string.Empty;
     }
     try
     {
         _SourceTables = (System.Collections.ArrayList)info.GetValue("_SourceTables", typeof(System.Collections.ArrayList));
     }
     catch
     {
     }
     try
     {
         _Fields = (System.Collections.ArrayList)info.GetValue("_Fields", typeof(System.Collections.ArrayList));
     }
     catch
     {
     }
     try
     {
         _Relations = (Webb.Data.DBFilter)info.GetValue("_Relations", typeof(Webb.Data.DBFilter));
     }
     catch
     {
     }
     try
     {
         _IsExpression = info.GetBoolean("_IsExpression");
     }
     catch
     {
         _IsExpression = false;
     }
 }
コード例 #16
0
        public void ImportToDatabase(int UploadEmpID)
        {
            DBFilter sessionFilter = new DBFilter();

            sessionFilter.add(new Match("SessionID", m_SessionID));
            if (UploadEmpID > 0)
            {
                sessionFilter.add(new Match("UploadEmpID", UploadEmpID));
            }
            ArrayList uploadEmppQualificationList = tempDB.select(dbConn, sessionFilter);

            foreach (EUploadEmpQualification obj in uploadEmppQualificationList)
            {
                EEmpQualification empQualification = new EEmpQualification();

                if (obj.ImportActionStatus != ImportDBObject.ImportActionEnum.INSERT)
                {
                    empQualification.EmpQualificationID = obj.EmpQualificationID;
                    uploadDB.select(dbConn, empQualification);
                }

                obj.ExportToObject(empQualification);

                if (obj.ImportActionStatus == ImportDBObject.ImportActionEnum.INSERT)
                {
                    //AND andTerms = new AND();
                    //andTerms.add(new Match("EmpQualificationFrom", "<=", empQualification.EmpQualificationFrom));
                    //andTerms.add(new Match("QualificationID", empQualification.QualificationID));

                    //EEmpQualification lastObj = (EEmpQualification)AppUtils.GetLastObj(dbConn, EEmpQualification.db, "EmpQualificationFrom", empQualification.EmpID, andTerms);
                    //if (lastObj != null)
                    //    if (lastObj.EmpQualificationTo.Ticks == 0)
                    //    {
                    //        lastObj.EmpQualificationTo = empQualification.EmpQualificationFrom.AddDays(-1);
                    //        uploadDB.update(dbConn, lastObj);
                    //    }

                    empQualification.EmpID = ParseTemp.GetEmpIDFromUploadEmpID(dbConn, obj.UploadEmpID);
                    uploadDB.insert(dbConn, empQualification);
                    //DBFilter emplastPosFilter = new DBFilter();
                }
                else if (obj.ImportActionStatus == ImportDBObject.ImportActionEnum.UPDATE)
                {
                    uploadDB.update(dbConn, empQualification);
                }
                tempDB.delete(dbConn, obj);
            }
        }
コード例 #17
0
        public LeaveBalanceCalc(DatabaseConnection dbConn, int EmpID)
        {
            this.dbConn = dbConn;
            this.EmpID  = EmpID;
            //position = AppUtils.GetLastPositionInfo(dbConn, asOfDate, EmpID);
            //if (position == null)
            //    throw new Exception("No position defined");
            //leavePlan = new ELeavePlan(position.LeavePlanID);
            leaveBalanceProcessList.Add(new AnnualLeaveBalanceProcess(dbConn, EmpID));
            leaveBalanceProcessList.Add(new SickLeaveBalanceProcess(dbConn, EmpID));
            leaveBalanceProcessList.Add(new CompensationLeaveBalanceProcess(dbConn, EmpID));
            leaveBalanceProcessList.Add(new StatutoryHolidayBalanceProcess(dbConn, EmpID));
            leaveBalanceProcessList.Add(new PublicHolidayBalanceProcess(dbConn, EmpID));
            leaveBalanceProcessList.Add(new RestDayBalanceProcess(dbConn, EmpID));
            leaveBalanceProcessList.Add(new BirthdayLeaveBalanceProcess(dbConn, EmpID));

            DBFilter dbfilter = new DBFilter();

            dbfilter.add("LeaveType", true);

            ArrayList leaveTypeArray = ELeaveType.db.select(dbConn, dbfilter);

            foreach (ELeaveType leaveType in leaveTypeArray)
            {
                if (leaveType.LeaveType != ELeaveType.LEAVETYPECODE_ANNUAL &&
                    leaveType.LeaveType != ELeaveType.LEAVETYPECODE_SLCAT1 &&
                    leaveType.LeaveType != ELeaveType.LEAVETYPECODE_SLCAT2 &&
                    leaveType.LeaveType != ELeaveType.LEAVETYPECODE_COMPENSATION &&
                    leaveType.LeaveType != ELeaveType.LEAVETYPECODE_STATUTORYHOLIDAY &&
                    leaveType.LeaveType != ELeaveType.LEAVETYPECODE_PUBLICHOLIDAY &&
                    leaveType.LeaveType != ELeaveType.LEAVETYPECODE_RESTDAY &&
                    leaveType.LeaveType != ELeaveType.LEAVETYPECODE_BIRTHDAY
                    )
                {
                    if (!leaveType.LeaveTypeIsDisabled)
                    {
                        leaveBalanceProcessList.Add(leaveType.LeaveTypeID, new LeaveBalanceProcess(dbConn, EmpID, leaveType.LeaveTypeID));
                    }
                }
                else if (leaveType.LeaveTypeIsDisabled && leaveBalanceProcessList.ContainsKey(leaveType.LeaveTypeID))
                {
                    leaveBalanceProcessList.Remove(leaveType.LeaveTypeID);
                }
            }

//leaveBalanceProcessList.Clear();
//leaveBalanceProcessList.Add(new CompensationLeaveBalanceProcess(dbConn, EmpID));
        }
コード例 #18
0
    protected void Page_PreRender(object sender, EventArgs e)
    {
        BOCIAVCPanel.Visible = false;

        DBFilter empMPFPlanFilter = new DBFilter();

        empMPFPlanFilter.add(new Match("EmpID", CurEmpID));
        empMPFPlanFilter.add("EmpMPFEffFr", false);

        DateTime dateFrom = new DateTime();

        if (DateTime.TryParse(EmpAVCEffFr.Value, out dateFrom))
        {
            empMPFPlanFilter.add(new Match("EmpMPFEffFr", "<=", dateFrom));
        }

        ArrayList empMPFPlanList = EEmpMPFPlan.db.select(dbConn, empMPFPlanFilter);


        EMPFPlan mpfPlan = new EMPFPlan();

        if (empMPFPlanList.Count > 0)
        {
            EEmpMPFPlan empMPFPlan = (EEmpMPFPlan)empMPFPlanList[0];
            mpfPlan.MPFPlanID = empMPFPlan.MPFPlanID;
        }
        else if (!DefaultMPFPlanID.SelectedValue.Equals(string.Empty))
        {
            mpfPlan.MPFPlanID = int.Parse(DefaultMPFPlanID.SelectedValue);
        }
        if (EMPFPlan.db.select(dbConn, mpfPlan))
        {
            EMPFScheme mpfScheme = new EMPFScheme();
            mpfScheme.MPFSchemeID = mpfPlan.MPFSchemeID;
            if (EMPFScheme.db.select(dbConn, mpfScheme))
            {
                if (mpfScheme.MPFSchemeTrusteeCode.Equals("BOCI"))
                {
                    BOCIAVCPanel.Visible = true;
                }

                else
                {
                    BOCIAVCPanel.Visible = false;
                }
            }
        }
    }
コード例 #19
0
    protected void Delete_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        ArrayList list = WebUtils.SelectedRepeaterItemToBaseObjectList(db, Repeater, "ItemSelect");

        foreach (EHierarchyElement obj in list)
        {
            db.select(dbConn, obj);
            DBFilter hierarchyElementFilter = new DBFilter();
            hierarchyElementFilter.add(new Match("HElementID", obj.HElementID));

            IN inTerms = new IN("EmpPosID", "Select EmpPosID From " + EEmpHierarchy.db.dbclass.tableName, hierarchyElementFilter);

            DBFilter empPosFilter = new DBFilter();
            empPosFilter.add(inTerms);
            empPosFilter.add("empid", true);
            ArrayList empPosList = EEmpPositionInfo.db.select(dbConn, empPosFilter);
            if (empPosList.Count > 0)
            {
                errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_USED_BY_EMPLOYEE, new string[] { HROne.Common.WebUtility.GetLocalizedString("Code"), obj.HElementCode }));
                foreach (EEmpPositionInfo empPos in empPosList)
                {
                    EEmpPersonalInfo empInfo = new EEmpPersonalInfo();
                    empInfo.EmpID = empPos.EmpID;
                    if (EEmpPersonalInfo.db.select(dbConn, empInfo))
                    {
                        errors.addError("- " + empInfo.EmpNo + ", " + empInfo.EmpEngFullName);
                    }
                    else
                    {
                        EEmpPositionInfo.db.delete(dbConn, empPos);
                    }
                }
                errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT);
            }
            else
            {
                WebUtils.StartFunction(Session, FUNCTION_CODE);
                db.delete(dbConn, obj);
                WebUtils.EndFunction(dbConn);
            }
        }

        loadData(info, db, Repeater);
    }
コード例 #20
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        WebUtils.StartFunction(Session, FUNCTION_CODE);
        foreach (RepeaterItem item in Repeater.Items)
        {
            CheckBox cb = (CheckBox)item.FindControl("ItemSelect");
            CheckBox AuthorizerIsReadOnly     = (CheckBox)item.FindControl("AuthorizerIsReadOnly");
            CheckBox AuthorizerSkipEmailAlert = (CheckBox)item.FindControl("AuthorizerSkipEmailAlert");
            if (cb.Checked)
            {
                EEmpPersonalInfo o = new EEmpPersonalInfo();
                WebFormUtils.GetKeys(EEmpPersonalInfo.db, o, cb);

                DBFilter empAuthorizerFilter = new DBFilter();
                empAuthorizerFilter.add(new Match("empid", o.EmpID));
                empAuthorizerFilter.add(new Match("AuthorizationGroupID", CurID));
                if (EAuthorizer.db.count(dbConn, empAuthorizerFilter) <= 0)
                {
                    EAuthorizer authorizer = new EAuthorizer();
                    authorizer.EmpID = o.EmpID;
                    authorizer.AuthorizationGroupID     = CurID;
                    authorizer.AuthorizerIsReadOnly     = AuthorizerIsReadOnly.Checked;
                    authorizer.AuthorizerSkipEmailAlert = AuthorizerSkipEmailAlert.Checked;
                    EAuthorizer.db.insert(dbConn, authorizer);
                }
            }
        }
        WebUtils.EndFunction(dbConn);

        ArrayList list = WebUtils.SelectedRepeaterItemToBaseObjectList(EEmpPersonalInfo.db, Repeater, "ItemSelect");

        foreach (EEmpPersonalInfo o in list)
        {
            DBFilter empAuthorizerFilter = new DBFilter();
            empAuthorizerFilter.add(new Match("empid", o.EmpID));
            empAuthorizerFilter.add(new Match("AuthorizationGroupID", CurID));
            if (EAuthorizer.db.count(dbConn, empAuthorizerFilter) <= 0)
            {
                WebUtils.StartFunction(Session, FUNCTION_CODE, o.EmpID);
                EAuthorizer authorizer = new EAuthorizer();
                authorizer.EmpID = o.EmpID;
                authorizer.AuthorizationGroupID = CurID;
                EAuthorizer.db.insert(dbConn, authorizer);
                WebUtils.EndFunction(dbConn);
            }
        }
        HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "ESS_AuthorizationGroup_View.aspx?AuthorizationGroupID=" + CurID);
    }
コード例 #21
0
    public DataView loadData(ListInfo info, DBManager db, DataList repeater)
    {
        DBFilter filter = binding.createFilter();

        DateTime dtPeriodFr, dtPeriodTo;

        if (DateTime.TryParse(RequestFromDate.Value, out dtPeriodFr))
        {
            filter.add(new Match("RequestOTClaimCancelCreateDateTime", ">=", dtPeriodFr));
        }
        if (DateTime.TryParse(RequestToDate.Value, out dtPeriodTo))
        {
            filter.add(new Match("RequestOTClaimCancelCreateDateTime", "<", dtPeriodTo.AddDays(1)));
        }

        filter.add(new Match("c.EmpID", this.CurID));

        if (!EmpRequestStatus.SelectedValue.Equals(string.Empty))
        {
            if (EmpRequestStatus.SelectedValue.Equals("REQUEESTSTATUS_PROCESSING"))
            {
                filter.add(EEmpRequest.EndStatusDBTerms("EmpRequestStatus", true));
            }
            else if (EmpRequestStatus.SelectedValue.Equals("REQUEESTSTATUS_END_PROCESS"))
            {
                filter.add(EEmpRequest.EndStatusDBTerms("EmpRequestStatus", false));
            }
        }

        string select = "c.RequestOTClaimCancelID, c.RequestOTClaimCancelCreateDateTime, r.EmpRequestStatus, r.EmpRequestID, r.EmpRequestLastAuthorizationWorkFlowIndex, la.* ";
        string from   = "from " + db.dbclass.tableName + " c " +
                        " LEFT JOIN " + EOTClaim.db.dbclass.tableName + " la ON c.OTClaimID = la.OTClaimID " +
                        " LEFT JOIN " + EEmpRequest.db.dbclass.tableName + " r On r.EmpRequestRecordID = c.RequestOTClaimCancelID and r.EmpRequestType = '" + EEmpRequest.TYPE_EEOTCLAIM + "'";


        DataTable table = filter.loadData(dbConn, info, select, from);

        view = new DataView(table);

        ListFooter.Refresh();

        if (repeater != null)
        {
            repeater.DataSource = view;
            repeater.DataBind();
        }
        return(view);
    }
コード例 #22
0
    public DataView loadData(ListInfo info, DBManager db, DataList repeater)
    {
        //DBFilter filter = sbinding.createFilter();

        DBFilter filter = new DBFilter();
        OR       m_OR   = new OR();

        DateTime m_asAtDate = new DateTime();

        if (DateTime.TryParse(AsAtDate.TextBox.Text, out m_asAtDate))
        {
            filter.add(new Match("EffectiveDate", "<=", m_asAtDate));
            m_OR.add(new Match("ExpiryDate", ">=", m_asAtDate));
            m_OR.add(new NullTerm("ExpiryDate"));
            filter.add(m_OR);
        }
        if (SchemeSelect.SelectedIndex > 0)
        {
            DBFieldTranscoder idTranscoder = EPayScale.db.getField("SchemeCode").transcoder;
            if (idTranscoder != null)
            {
                filter.add(new Match("SchemeCode", AppUtils.Encode(EPayScaleMap.db.getField("SchemeCode"), SchemeSelect.SelectedValue.ToString())));
            }
        }

        if (info != null && info.orderby != null && !info.orderby.Equals(""))
        {
            //filter.add(info.orderby, info.order);
        }
        else
        {
            info.orderby = "SchemeCode, Point";
            info.order   = false;
        }
        string select = "*";
        string from   = "from PayscaleMap ";

        DataTable table = WebUtils.GetDataTableFromSelectQueryWithFilter(dbConn, select, from, filter, info);

        view = new DataView(table);
        if (repeater != null)
        {
            repeater.DataSource = view;
            repeater.DataBind();
        }

        return(view);
    }
コード例 #23
0
    protected void Delete_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        ELeaveCode obj = new ELeaveCode();

        obj.LeaveCodeID = CurID;
        db.select(dbConn, obj);
        DBFilter leaveApplicationFilter = new DBFilter();

        leaveApplicationFilter.add(new Match("LeaveCodeID", obj.LeaveCodeID));
        leaveApplicationFilter.add("empid", true);
        ArrayList leaveApplicationList = ELeaveApplication.db.select(dbConn, leaveApplicationFilter);

        if (leaveApplicationList.Count > 0)
        {
            int curEmpID = 0;
            errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_USED_BY_EMPLOYEE, new string[] { HROne.Common.WebUtility.GetLocalizedString("Leave Code"), obj.LeaveCode }));
            foreach (ELeaveApplication leaveApplication in leaveApplicationList)
            {
                EEmpPersonalInfo empInfo = new EEmpPersonalInfo();
                empInfo.EmpID = leaveApplication.EmpID;
                if (EEmpPersonalInfo.db.select(dbConn, empInfo))
                {
                    if (curEmpID != leaveApplication.EmpID)
                    {
                        errors.addError("- " + empInfo.EmpNo + ", " + empInfo.EmpEngFullName);
                        curEmpID = leaveApplication.EmpID;
                    }
                }
                else
                {
                    ELeaveApplication.db.delete(dbConn, leaveApplication);
                }
            }
            errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT);
            return;
        }
        else
        {
            WebUtils.StartFunction(Session, FUNCTION_CODE);
            db.delete(dbConn, obj);
            WebUtils.EndFunction(dbConn);
        }
        HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "LeaveCode_List.aspx");
    }
コード例 #24
0
    protected void Delete_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        ArrayList list = new ArrayList();

        foreach (DataListItem item in Repeater.Items)
        {
            CheckBox        c = (CheckBox)item.FindControl("DeleteItem");
            HtmlInputHidden h = (HtmlInputHidden)item.FindControl("AuthorizationGroupID");
            if (c.Checked)
            {
                EAuthorizationGroup obj = new EAuthorizationGroup();
                obj.AuthorizationGroupID = Int32.Parse(h.Value);
                list.Add(obj);
            }
        }
        foreach (EAuthorizationGroup obj in list)
        {
            db.select(dbConn, obj);
            DBFilter workflowDetailFilter = new DBFilter();
            workflowDetailFilter.add(new Match("AuthorizationGroupID", obj.AuthorizationGroupID));

            DBFilter workflowFilter = new DBFilter();
            workflowFilter.add(new IN("AuthorizationWorkFlowID", "SELECT AuthorizationWorkFlowID FROM " + EAuthorizationWorkFlowDetail.db.dbclass.tableName, workflowDetailFilter));
            ArrayList workflowList = EAuthorizationWorkFlow.db.select(dbConn, workflowFilter);
            if (workflowList.Count > 0)
            {
                errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_IS_IN_USE, new string[] { HROne.Common.WebUtility.GetLocalizedString("Authorization Group") + ":" + obj.AuthorizationCode }));
                errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT);
                view = loadData(info, db, Repeater);
                return;
            }
            else
            {
                DBFilter authorizerFilter = new DBFilter();
                authorizerFilter.add(new Match("AuthorizationGroupID", obj.AuthorizationGroupID));
                EAuthorizer.db.delete(dbConn, authorizerFilter);

                WebUtils.StartFunction(Session, FUNCTION_CODE);
                db.delete(dbConn, obj);
                WebUtils.EndFunction(dbConn);
            }
        }
        view = loadData(info, db, Repeater);
    }
コード例 #25
0
    protected void loadEmpExtraField()
    {
        DBFilter  filter = new DBFilter();
        DataTable table  = filter.loadData(dbConn, "Select distinct EmpExtraFieldGroupName from EmpExtraField order by EmpExtraFieldGroupName");

        if (table.Rows.Count > 0)
        {
            EmpExtraFieldPanel.Visible            = true;
            EmpExtraFieldGroupRepeater.DataSource = table;
            EmpExtraFieldGroupRepeater.DataBind();
        }
        else
        {
            EmpExtraFieldPanel.Visible = false;
        }
    }
コード例 #26
0
ファイル: EAA_HR021.cs プロジェクト: dhamotharang/H-R-One
        public static EEAA_HR021 GetObject(DatabaseConnection dbConn, int EmpID)
        {
            DBFilter m_filter = new DBFilter();

            m_filter.add(new Match("EmpID", EmpID));
            ArrayList m_list = db.select(dbConn, m_filter);

            if (m_list.Count > 0)
            {
                return((EEAA_HR021)m_list[0]);
            }
            else
            {
                return(null);
            }
        }
コード例 #27
0
ファイル: LeaveType.cs プロジェクト: dhamotharang/H-R-One
        public static ELeaveType GetObject(DatabaseConnection dbConn, int LeaveTypeID)
        {
            DBFilter filter = new DBFilter();

            filter.add(new Match("LeaveTypeID", LeaveTypeID));
            ArrayList leaveTypeList = ELeaveType.db.select(dbConn, filter);

            if (leaveTypeList.Count > 0)
            {
                return((ELeaveType)leaveTypeList[0]);
            }
            else
            {
                return(new ELeaveType());
            }
        }
コード例 #28
0
        public double GetTotalPaymentAmount(DatabaseConnection dbConn)
        {
            double   totalPaymentAmount  = 0;
            DBFilter payrollRecordFilter = new DBFilter();

            payrollRecordFilter.add(new Match("EmpPayrollID", EmpPayrollID));

            ArrayList list = EPaymentRecord.db.select(dbConn, payrollRecordFilter);

            foreach (EPaymentRecord payrollRecord in list)
            {
                totalPaymentAmount += payrollRecord.PayRecActAmount;
            }

            return(totalPaymentAmount);
        }
コード例 #29
0
ファイル: DataDict.cs プロジェクト: dhamotharang/H-R-One
            protected static EPaymentType GetPaymentType(DatabaseConnection dbConn, String PaymentType)
            {
                DBFilter dbFilter = new DBFilter();

                dbFilter.add(new Match("PaymentTypeCode", PaymentType));
                ArrayList arrayList = EPaymentType.db.select(dbConn, dbFilter);

                if (arrayList.Count > 0)
                {
                    return((EPaymentType)arrayList[0]);
                }
                else
                {
                    return(null);
                }
            }
コード例 #30
0
    protected void Page_PreRender(object sender, EventArgs e)
    {
        DBFilter AuthorizationWorkFlowDetailFilter = new DBFilter();

        AuthorizationWorkFlowDetailFilter.add(new Match("AuthorizationWorkFlowID", CurID));

        DataTable AuthorizationWorkFlowDetailDataTable = AuthorizationWorkFlowDetailFilter.loadData(dbConn, ListFooter.ListInfo, "*", " FROM " + EAuthorizationWorkFlowDetail.db.dbclass.tableName);

        AuthorizationWorkFlowRepeater.DataSource = new DataView(AuthorizationWorkFlowDetailDataTable, string.Empty, ListFooter.ListOrderBy, DataViewRowState.CurrentRows);
        AuthorizationWorkFlowRepeater.DataBind();
        //if (AuthorizationWorkFlowRepeater.Items.Count > 0)
        //{
        //    AuthorizationWorkFlowRepeater.Items[0].FindControl("Up").Visible = false;
        //    AuthorizationWorkFlowRepeater.Items[AuthorizationWorkFlowRepeater.Items.Count - 1].FindControl("Down").Visible = false;
        //}
    }
コード例 #31
0
        private static IEnumerable<DBNode<DBMovieInfo>> CreateNodes(IEnumerable<TraktMovie> traktRecommendationMovies, IEnumerable<TraktWatchListMovie> traktWatchListMovies)
        {
            #region WatchList
            TraktLogger.Debug("Creating the watchlist node");
            var watchlistNode = new DBNode<DBMovieInfo> {Name = "${" + GUI.Translation.WatchList + "}"};

            var watchlistSettings = new DBMovieNodeSettings();
            watchlistNode.AdditionalSettings = watchlistSettings;

            TraktLogger.Debug("Getting the Movie's from Moving Pictures");
            var movieList = DBMovieInfo.GetAll();

            TraktLogger.Debug("Creating the watchlist filter");
            var watchlistFilter = new DBFilter<DBMovieInfo>();
            foreach (var movie in traktWatchListMovies.Select(traktmovie => movieList.Find(m => m.ImdbID.CompareTo(traktmovie.Imdb) == 0)).Where(movie => movie != null))
            {
                TraktLogger.Debug("Adding {0} to watchlist", movie.Title);
                watchlistFilter.WhiteList.Add(movie);
            }

            if (watchlistFilter.WhiteList.Count == 0)
            {
                TraktLogger.Debug("Nothing in watchlist, Blacklisting everything");
                watchlistFilter.BlackList.AddRange(movieList);
            }

            watchlistNode.Filter = watchlistFilter;

            #endregion

            #region Recommendations
            TraktLogger.Debug("Creating the recommendations node");
            var recommendationsNode = new DBNode<DBMovieInfo> {Name = "${" + GUI.Translation.Recommendations + "}"};

            var recommendationsSettings = new DBMovieNodeSettings();
            recommendationsNode.AdditionalSettings = recommendationsSettings;

            TraktLogger.Debug("Creating the recommendations filter");
            var recommendationsFilter = new DBFilter<DBMovieInfo>();
            foreach (var movie in traktRecommendationMovies.Select(traktMovie => movieList.Find(m => m.ImdbID.CompareTo(traktMovie.Imdb) == 0)).Where(movie => movie != null))
            {
                TraktLogger.Debug("Adding {0} to recommendations", movie.Title);
                recommendationsFilter.WhiteList.Add(movie);
            }

            if (recommendationsFilter.WhiteList.Count == 0)
            {
                TraktLogger.Debug("Nothing in recommendation list, Blacklisting everything");
                recommendationsFilter.BlackList.AddRange(movieList);
            }

            recommendationsNode.Filter = recommendationsFilter;

            #endregion

            return new DBNode<DBMovieInfo>[] { watchlistNode, recommendationsNode };
        }
コード例 #32
0
        protected override void OnPageLoad()
        {
            logger.Debug("OnPageLoad() Started.");

            // if the component didn't load properly we probably have a bad skin file
            if (facade == null) {
                // avoid showing a dialog on load when we are the last active module being started
                if (!preventDialogOnLoad) {
                    GUIDialogOK dialog = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
                    dialog.Reset();
                    dialog.SetHeading(Translation.Error);
                    dialog.SetLine(1, Translation.ProblemLoadingSkinFile);
                    dialog.DoModal(GetID);
                }
                else {
                    preventDialogOnLoad = false;
                }
                GUIWindowManager.ShowPreviousWindow();
                return;
            }

            // Check whether the plugin is initialized.
            if (!initComplete) {

                // avoid showing a dialog on load when we are the last active module being started
                if (preventDialogOnLoad) {
                    preventDialogOnLoad = false;
                    GUIWindowManager.ShowPreviousWindow();
                    return;
                }

                // if we are not initialized yet show a loading dialog
                // this will 'block' untill loading has finished or the user
                // pressed cancel or ESC
                showLoadingDialog();

                // if the initialization is not complete the user cancelled
                if (!initComplete) {
                    // return to where the user came from
                    GUIWindowManager.ShowPreviousWindow();
                    return;
                }
            }

            // notify if the skin doesnt support categories
            if (categoriesFacade == null && MovingPicturesCore.Settings.CategoriesEnabled) {
                // avoid showing a dialog on load when we are the last active module being started
                if (!preventDialogOnLoad) {
                    GUIDialogOK dialog = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
                    dialog.Reset();
                    dialog.SetHeading(Translation.Error);
                    dialog.SetLine(1, "This skin does not support Categories...");
                    dialog.DoModal(GetID);
                }
                else {
                    preventDialogOnLoad = false;
                    GUIWindowManager.ShowPreviousWindow();
                    return;
                }
            }

            // if the user hasn't defined any import paths they need to goto the config screen
            if (DBImportPath.GetAllUserDefined().Count == 0) {
                GUIWindowManager.ShowPreviousWindow();
                if (!preventDialogOnLoad) {
                    ShowMessage(Translation.NoImportPathsHeading, Translation.NoImportPathsBody);
                }
                else {
                    preventDialogOnLoad = false;
                }
                return;
            }

            // if we were passed a parameter we cant parse, exit back
            if (MovieLoadParamater == null && CategoryLoadParamater == null && SearchModeLoadParameter == null && !string.IsNullOrEmpty(UnparsedLoadParameter)) {
                logger.Warn("Moving Pictures can not understand the following paramater: " + UnparsedLoadParameter);
                GUIWindowManager.ShowPreviousWindow();
                ShowMessage(Translation.Error, Translation.BadParam);
            }

            if (browser == null) {
                browser = new MovieBrowser(skinSettings);
                MovingPicturesCore.Browser = browser;

                // add available filters to browser
                remoteFilter = new RemoteNumpadFilter();
                browser.Filters.Add(remoteFilter);

                parentalControlsFilter = MovingPicturesCore.Settings.ParentalControlsFilter;
                parentalControlsFilter.Active = MovingPicturesCore.Settings.ParentalControlsEnabled;
                browser.Filters.Add(parentalControlsFilter);

                // setup browser events
                browser.MovieSelectionChanged += new MovieBrowser.MovieSelectionChangedDelegate(MovieDetailsPublisher);
                browser.NodeSelectionChanged += new MovieBrowser.NodeSelectionChangedDelegate(PublishCategoryDetails);
                browser.ContentsChanged += new MovieBrowser.ContentsChangedDelegate(OnBrowserContentsChanged);
                browser.ViewChanged += new MovieBrowser.ViewChangedDelegate(OnBrowserViewChanged);

                // Load all available translation strings
                foreach (string name in Translation.Strings.Keys) {
                    SetProperty("#MovingPictures.Translation." + name + ".Label", Translation.Strings[name]);
                }

                SetProperty("#MovingPictures.Sort.Field", Sort.GetFriendlySortName(browser.CurrentSortField));
                SetProperty("#MovingPictures.Sort.Direction", browser.CurrentSortDirection.ToString());

                // if enabled, activate the default filter
                if (MovingPicturesCore.Settings.DefaultFilterEnabled)
                    browser.FilterNode = MovingPicturesCore.Settings.DefaultFilter;

                if (filteringIndicator != null) filteringIndicator.Visible = false;

                PublishFilterDetails();
            }

            if (recentInsertedDiskSerials == null) {
                // Also listen to new movies added as part of the autoplay/details functionality
                if (diskInsertedAction != DiskInsertedAction.NOTHING) {
                    recentInsertedDiskSerials = new Dictionary<string, string>();
                    MovingPicturesCore.DatabaseManager.ObjectInserted += new DatabaseManager.ObjectAffectedDelegate(OnMovieAdded);
                    logger.Debug("Autoplay/details is now listening for movie additions");
                }
            }

            // (re)link our backdrop image controls to the backdrop image swapper
            backdrop.GUIImageOne = movieBackdropControl;
            backdrop.GUIImageTwo = movieBackdropControl2;
            backdrop.LoadingImage = loadingImage;

            // (re)link the facade controls to the browser object
            browser.Facade = facade;
            browser.CategoriesFacade = categoriesFacade;

            // we are supposed to launch on a movie page, pass this to movie browser
            if (MovieLoadParamater != null) {
                browser.RememberLastState = false;

                browser.SelectedMovie = MovieLoadParamater;
                browser.CurrentView = BrowserViewMode.DETAILS;
                browser.TopLevelView = BrowserViewMode.DETAILS;
            }

            // we are supposed to launch on a category page, pass this to movie browser
            else if (CategoryLoadParamater != null && browser.CategoriesAvailable) {
                browser.RememberLastState = true;

                browser.TopLevelNode = CategoryLoadParamater;
                browser.CurrentNode = CategoryLoadParamater;

                if (CategoryLoadParamater.HasChildren) {
                    browser.TopLevelView = BrowserViewMode.CATEGORIES;
                    browser.CurrentView = BrowserViewMode.CATEGORIES;
                }
                else {
                    browser.TopLevelView = MovingPicturesCore.Settings.DefaultView;
                    browser.CurrentView = MovingPicturesCore.Settings.DefaultView;
                }

                loaded = true;
                preventDialogOnLoad = false;

            }

            else if (SearchStringLoadParameter != null && SearchModeLoadParameter != null) {
                bool success = Search((SearchMode)SearchModeLoadParameter, SearchStringLoadParameter);
                if (!success) {
                    GUIWindowManager.ShowPreviousWindow();
                    return;
                }

                browser.TopLevelView = browser.CurrentView;
            }

            // standard loading logic
            else {
                if (browser.CategoriesAvailable || browser.LastView != BrowserViewMode.CATEGORIES) {
                    browser.TopLevelView = BrowserViewMode.CATEGORIES;
                    browser.TopLevelNode = null;
                    browser.RememberLastState = true;

                    if (browser.LastView == BrowserViewMode.DETAILS) {
                        browser.SelectedMovie = browser.LastSelectedMovie;
                        browser.CurrentView = BrowserViewMode.DETAILS;
                    }
                    else {
                        browser.SelectedMovie = browser.LastSelectedMovie;
                        browser.CurrentNode = browser.LastNode;
                        browser.CurrentView = browser.LastView;
                    }
                }
                else {
                    //the skin doesn't support categories
                    browser.CurrentNode = null;
                    browser.CurrentView = MovingPicturesCore.Settings.DefaultView;
                }
            }

            MediaPortal.GUI.Library.GUIPropertyManager.SetProperty("#currentmodule", MovingPicturesCore.Settings.HomeScreenName);
            browser.AutoRefresh = true;

            setWorkingAnimationStatus(false);
            if (movieStartIndicator != null)
                movieStartIndicator.Visible = false;

            // Take control and disable MediaPortal AutoPlay when the plugin has focus
            disableNativeAutoplay();

            if (awaitingUserRatingMovie != null) {
                GetUserRating(awaitingUserRatingMovie);
                awaitingUserRatingMovie = null;
            }

            logger.Debug("OnPageLoad() Ended.");
        }
コード例 #33
0
        /// <summary>
        /// Creates a dummy blacklist list constraint as opposed to a real Blacklist.
        /// A real blacklist can add a huge amount of records to the filters table.
        /// The purpose of the blacklist in this context is to simply ensure that there is 
        /// always at least one criteria added to a filter so that it doesn't show All Movies.
        /// </summary>
        /// <param name="filter">The Filter that requires a dummy blacklist criteria</param>
        static void AddDummyBlacklistToFilter(DBFilter<DBMovieInfo> filter)
        {
            if (filter == null) return;

            // clear any legitimate blacklist if set
            filter.BlackList.Clear();

            // when we're managing a blacklist for a nodes filter
            // we typically need to add a record for each movie in the users database
            // this can result in a large amount of records inserted into the Filters table
            // instead, let's create a dummy criteria and add it the filter e.g. a movie that will never match
            var criteria = new DBCriteria<DBMovieInfo>();
            criteria.Field = DBField.GetFieldByDBName(typeof(DBMovieInfo), "imdb_id");
            criteria.Operator = DBCriteria<DBMovieInfo>.OperatorEnum.EQUAL;
            criteria.Value = "ttDummyBlacklist";

            // add the criteria to the filter
            filter.Criteria.Add(criteria);
        }
コード例 #34
0
        private static void UpdateNodes(DBNode<DBMovieInfo>[] nodes, IEnumerable<TraktMovie> traktRecommendationMovies, IEnumerable<TraktWatchListMovie> traktWatchListMovies)
        {
            if (nodes.Length != 2)
            {
                TraktLogger.Error("We don't have the correct number of nodes to correctly update");
            }

            TraktLogger.Debug("Getting the Movie's from Moving Pictures");
            var movieList = DBMovieInfo.GetAll();

            #region WatchList
            TraktLogger.Debug("Creating the watchlist filter");
            var watchlistFilter = new DBFilter<DBMovieInfo>();
            TraktLogger.Debug("WatchList: {0}", string.Join(", ", traktWatchListMovies.Select(m => m.Title).ToArray()));
            foreach (var movie in traktWatchListMovies.Select(traktmovie => movieList.Find(m => m.ImdbID.CompareTo(traktmovie.Imdb) == 0)).Where(movie => movie != null))
            {
                TraktLogger.Debug("Adding {0} to watchlist", movie.Title);
                watchlistFilter.WhiteList.Add(movie);
            }

            if (watchlistFilter.WhiteList.Count == 0)
            {
                TraktLogger.Debug("Nothing in watchlist, Blacklisting everything");
                watchlistFilter.BlackList.AddRange(movieList);
            }

            TraktLogger.Debug("Retrieving the watchlist node");
            var watchlistNode = nodes[0];
            if (watchlistNode.Filter != null) watchlistNode.Filter.Delete();
            watchlistNode.Filter = watchlistFilter;
            watchlistNode.Commit();
            #endregion

            #region Recommendations
            TraktLogger.Debug("Creating the recommendations filter");
            var recommendationsFilter = new DBFilter<DBMovieInfo>();
            foreach (var movie in traktRecommendationMovies.Select(traktMovie => movieList.Find(m => m.ImdbID.CompareTo(traktMovie.Imdb) == 0)).Where(movie => movie != null))
            {
                TraktLogger.Debug("Adding {0} to recommendations", movie.Title);
                recommendationsFilter.WhiteList.Add(movie);
            }

            if (recommendationsFilter.WhiteList.Count == 0)
            {
                TraktLogger.Debug("Nothing in recommendation list, Blacklisting everything");
                recommendationsFilter.BlackList.AddRange(movieList);
            }

            TraktLogger.Debug("Retrieving the recommendations node");
            var recommendationsNode = nodes[1];
            if (recommendationsNode.Filter != null) recommendationsNode.Filter.Delete();
            recommendationsNode.Filter = recommendationsFilter;
            recommendationsNode.Commit();
            #endregion
        }
コード例 #35
0
 private static void RemoveMovieFromNode(DBMovieInfo movie, DBNode<DBMovieInfo> rootNode)
 {
     foreach (var node in rootNode.Children)
     {
         node.Filter.WhiteList.Remove(movie);
         if (node.Filter.WhiteList.Count == 0)
         {
             var filter = new DBFilter<DBMovieInfo>();
             filter.BlackList.AddRange(DBMovieInfo.GetAll());
             node.Filter.Delete();
             node.Filter = filter;
         }
         node.Commit();
     }
 }