private ViewRoomFee[] LoadRoomFeeList(int ContractID)
 {
     ViewRoomFee[] list = new ViewRoomFee[] { };
     try
     {
         DateTime   StartTime                = DateTime.MinValue;
         DateTime   EndTime                  = DateTime.MinValue;
         int        CompanyID                = WebUtil.GetCompanyID(this.Context);
         List <int> RoomIDList               = new List <int>();
         List <int> ProjectIDList            = WebUtil.GetMyProjects(WebUtil.GetUser(this.Context).UserID).Where(p => p.ID != 1).Select(p => p.ID).ToList();
         List <int> FeeTypeList              = new List <int>();
         int[]      ChargeSummaryID          = new int[] { };
         int        IsCharged                = -1;
         List <int> RoomPropertyList         = new List <int>();
         bool       IsContractFee            = true;
         bool       IsRoomFee                = true;
         bool       IsCuiShou                = false;
         bool       IsAutoEndTime            = false;
         string     keywords                 = string.Empty;
         bool       ExcludeHistoryChargeTime = false;
         list = ViewRoomFee.GetViewRoomFeeListByRoomID(RoomIDList, ProjectIDList, StartTime, EndTime, ChargeSummaryID, IsCharged, RoomPropertyList, IsRoomFee, IsContractFee, ContractID, IsAutoEndTime, keywords, ExcludeHistoryChargeTime, UserID: WebUtil.GetUser(this.Context).UserID);
         if (IsCuiShou)
         {
             list = list.Where(p => p.CuiShouTotalCost > 0).ToArray();
             if (EndTime > DateTime.MinValue)
             {
                 list = list.Where(p => p.CalculateCuiShouStartTime <= EndTime).ToArray();
             }
         }
         else
         {
             list = list.Where(p => p.TotalCost > 0).ToArray();
             if (EndTime > DateTime.MinValue)
             {
                 list = list.Where(p => p.CalculateStartTime <= EndTime).ToArray();
             }
         }
     }
     catch (Exception ex)
     {
         LogHelper.WriteError("AddContract.aspx", "visit: LoadRoomFeeList", ex);
     }
     return(list);
 }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.tdWidth.Value  = "210";
            this.tdHeight.Value = "99";
            string     IDs    = Request.QueryString["IDs"];
            List <int> IDList = new List <int>();

            if (string.IsNullOrEmpty(IDs))
            {
                Response.End();
                return;
            }
            if (!string.IsNullOrEmpty(IDs))
            {
                IDList = JsonConvert.DeserializeObject <List <int> >(IDs);
            }
            if (!IsPostBack)
            {
                int RoomID             = 0;
                int ContractID         = 0;
                int DefaultChargeManID = 0;
                var list = ViewRoomFee.GetViewRoomFeeListByIDs(IDList, UserID: WebUtil.GetUser(this.Context).UserID);
                if (list.Length > 0)
                {
                    RoomID             = list[0].RoomID;
                    ContractID         = list[0].ContractID;
                    DefaultChargeManID = list[0].DefaultChargeManID;
                }
                foreach (var item in list)
                {
                    money += item.TotalCost;
                }
                this.rptProject.DataSource = list;
                this.rptProject.DataBind();
                var project = Foresight.DataAccess.Project.GetProjectByID(ID: RoomID, ContractID: ContractID);
                if (project != null)
                {
                    this.tdRemark.Value         = project.CuiFeiNote;
                    this.tdFirstTitle.InnerHtml = project.PrintTitle;
                    if (project.IsDefinePrintSize)
                    {
                        this.tdWidth.Value  = project.PrintWidth > 0 ? project.PrintWidth.ToString() : "210";
                        this.tdHeight.Value = project.PrintHeight > 0 ? project.PrintHeight.ToString() : WebUtil.GetPrintHeight().ToString();
                    }
                    else
                    {
                        this.tdWidth.Value  = "210";
                        this.tdHeight.Value = WebUtil.GetPrintHeight(project.PrintType).ToString();
                    }
                    this.IsPrintUnitPrice = project.IsPrintUnitPrice;
                    if (this.IsPrintUnitPrice)
                    {
                        this.ColumnCount++;
                    }
                    this.FullName = project.FullName + "-" + project.Name;
                }
                RoomPhoneRelation relation = null;
                if (DefaultChargeManID > 0)
                {
                    relation = RoomPhoneRelation.GetRoomPhoneRelation(DefaultChargeManID);
                }
                if (relation == null)
                {
                    relation = RoomPhoneRelation.GetDefaultInChargeFeeRoomPhoneRelation(RoomID, ContractID);
                }
                if (relation != null)
                {
                    this.OwnerName = relation.RelationName;
                }
                SetInfo(RoomID);
            }
        }