コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var id = Request.QueryString["project_id"];
                if (!string.IsNullOrEmpty(id))
                {
                    thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(id));

                    if (!IsPostBack)
                    {
                        interna.Checked = true;
                    }
                }

                if (thisProject == null)
                {
                    Response.End();
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
コード例 #2
0
 protected List <ctt_contract_cost> noCicostList = null; // 没有配置项的项目产品
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         var id = Request.QueryString["id"];
         thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(id));
         if (thisProject != null)
         {
             var taskList = new sdk_task_dal().GetProTask(thisProject.id);
             if (taskList != null && taskList.Count > 0)
             {
                 actTaskList = taskList.Where(_ => _.status_id != (int)DTO.DicEnum.TICKET_STATUS.DONE).ToList();
             }
             var costList = new ctt_contract_cost_dal().GetCostByProId(thisProject.id);
             if (costList != null && costList.Count > 0)
             {
                 noCicostList = costList.Where(_ => _.product_id == null).ToList();
             }
             if (!IsPostBack)
             {
                 // noTempId
                 noTempId.DataTextField  = "name";
                 noTempId.DataValueField = "id";
                 noTempId.DataSource     = new sys_notify_tmpl_dal().GetTempByEvent(DicEnum.NOTIFY_EVENT.PROJECT_COMPLETED);
                 noTempId.DataBind();
             }
         }
     }
     catch (Exception msg)
     {
         Response.End();
     }
 }
コード例 #3
0
ファイル: ProjectSummary.aspx.cs プロジェクト: evelh/Done
 protected bool isTemp = false;      // 判断项目是否时项目模板
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         var id = Request.QueryString["id"];
         thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(id));
         if (thisProject != null)
         {
             if (AuthBLL.GetUserProjectAuth(LoginUserId, LoginUser.security_Level_id, thisProject.id).CanView == false)
             {
                 Response.Write("<script>alert('无权查看');window.close();</script>");
                 Response.End();
                 return;
             }
             taskList = new sdk_task_dal().GetProjectTask(thisProject.id);
             if (thisProject.type_id == (int)DicEnum.PROJECT_TYPE.TEMP)
             {
                 isTemp = true;
             }
         }
         else
         {
             Response.End();
         }
     }
     catch (Exception msg)
     {
         Response.End();
     }
 }
コード例 #4
0
ファイル: ProjectNoteShow.aspx.cs プロジェクト: evelh/Done
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var thisId = Request.QueryString["project_id"];
                if (!string.IsNullOrEmpty(thisId))
                {
                    thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(thisId));
                }
                var taskId = Request.QueryString["task_id"];
                if (!string.IsNullOrEmpty(taskId))
                {
                    task = new sdk_task_dal().FindNoDeleteById(long.Parse(taskId));
                }
                if (thisProject != null)
                {
                    ShowNoteList.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.PROJECT_NOTE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.PROJECT_NOTE + "&con1054=" + thisProject.id + "&con1055=";

                    actList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.ACTION_TYPE);
                    if (actList != null && actList.Count > 0)
                    {
                        actList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.PROJECT_NOTE).ToString()).ToList();
                    }
                }
                else if (task != null)
                {
                    account          = new BLL.CompanyBLL().GetCompany(task.account_id);
                    ShowNoteList.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.PROJECT_NOTE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.PROJECT_NOTE + "&con1054=" + task.id + "&con1055=";
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
コード例 #5
0
        protected DataTable milepostTable; // 里程碑
        protected void Page_Load(object sender, EventArgs e)
        {
            long id = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["id"]) && long.TryParse(Request.QueryString["id"], out id))
            {
                project = proBll.GetPoject(id);
            }

            if (project == null)
            {
                Response.Write("<script>alert('为获取到相关项目信息,请刷新页面后重试!');</script>"); return;
            }
            account = new CompanyBLL().GetCompany(project.account_id);
            // taskLsit = new DAL.sdk_task_dal().GetAllProTask(project.id);

            expPro        = proBll.GetTableBySql(@"select hours_worked,labor_cost,cost_cost_billable+cost_cost_nonbillable,expense_cost_billable+expense_cost_nonbillable,
labor_cost+cost_cost_billable+cost_cost_nonbillable+expense_cost_billable+expense_cost_nonbillable
from v_project_complete_profit where project_id = " + project.id.ToString());
            revPro        = proBll.GetTableBySql(@"select hours_billed,labor_dollars,cost_dollars,expense_dollars,milestone_dollars,
labor_dollars+cost_dollars+expense_dollars+milestone_dollars
from v_project_complete_profit
 where project_id = " + project.id.ToString());
            profitPro     = proBll.GetTableBySql(@"select labor_dollars-labor_cost,cost_dollars-cost_cost_billable-cost_cost_nonbillable,expense_dollars-expense_cost_billable-expense_cost_nonbillable,milestone_dollars,
labor_dollars+cost_dollars+expense_dollars+milestone_dollars -(labor_cost+cost_cost_billable+cost_cost_nonbillable+expense_cost_billable+expense_cost_nonbillable)
from v_project_complete_profit
 where project_id = " + project.id.ToString());
            yuguPro       = proBll.GetTableBySql(@"select Labor_Revenue,Cost_Revenue,Labor_Revenue+Cost_Revenue
from v_project_complete_profit
 where project_id = " + project.id.ToString());
            taskTable     = proBll.GetTableBySql($@"select if(sid is null ,'项目汇总',a.title) as 标题,if(sid is null ,'',a.status )as 状态,round(a.estimated_hours,2) as 预估时间,round(a.worked_hours,2) as 已工作时间,round(a.Billed_hours,2) as 已计费时间
,round(a.labor_dollars,2) as 工时收入,round(a.labor_cost,2) as 工时成本
from v_task_all a where 1=1    and a.project_id in({project.id.ToString()}) order by a.sort_order");
            chargeTable   = proBll.GetTableBySql($@"select if(id is null,null,date_purchased),if(id is null,null,name), if(id is null,null,cost_code_name),if(id is null,null,purchase_order_no),if(id is null,'汇总:',Invoice_no),
round(cost,2),round(billable_amount,2),round(revenue,2)
from(
select id,date_purchased,name, (select name from d_cost_code where id=t.cost_code_id)	cost_code_name,purchase_order_no,
Invoice_no,sum(Quantity*Unit_Cost)cost, sum(if(is_billable=1,ifnull( extended_price,Quantity*Unit_Price),0 ))billable_amount,
sum(if(is_billable=1 and bill_Status=1 ,ifnull( extended_price,Quantity*Unit_Price),0 ))revenue
from ctt_contract_cost t  where project_id={project.id.ToString()} and delete_time=0
GROUP BY id with ROLLUP)t
");
            expenseTable  = proBll.GetTableBySql($@"select if(id is null,null,Add_Date),if(id is null,null,resource_name), if(id is null,null,type_name),if(id is null,null,description),if(id is null,null,has_Receipt),if(id is null,'汇总:',is_billable),
round(amount,2),round(revenue,2)
from(
select id,Add_Date,(select name from sys_resource where id=t.create_user_id)resource_name, (select name from d_general where id=t.type_id)	type_name,description,
if(has_Receipt=1,'√','')has_Receipt,if(is_billable=1,'√','')is_billable,sum(Amount)Amount,sum( if(is_billable=1 and approve_and_post_date is not null ,amount,0 )  )revenue
from sdk_expense t  where project_id={project.id.ToString()} and delete_time=0
GROUP BY id with ROLLUP)t

");
            milepostTable = proBll.GetTableBySql($@"select if(id is null,null,due_date),if(id is null,'汇总:',name),round(dollars,2),round(revenue,2)
from(
select t.id,t.due_date,t.name,sum(dollars)dollars, sum(if(t.status_id= 1267,dollars,0 ))revenue
from ctt_contract_milestone t ,sdk_task a,sdk_task_milestone b 
where t.delete_time=0 and a.delete_time=0 and b.delete_time=0 and t.id=b.contract_milestone_id and b.task_id=a.id and a.project_id={project.id.ToString()}  
GROUP BY id with ROLLUP)t
");
        }
コード例 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    publish_type_id.DataTextField  = "name";
                    publish_type_id.DataValueField = "id";
                    var pushList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.NOTE_PUBLISH_TYPE);
                    if (pushList != null && pushList.Count > 0)
                    {
                        pushList = pushList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.PROJECT_NOTE).ToString()).ToList();
                    }
                    publish_type_id.DataSource = pushList;
                    publish_type_id.DataBind();
                }

                var project_id = Request.QueryString["project_id"];
                if (!string.IsNullOrEmpty(project_id))
                {
                    thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(project_id));
                }
                var id = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(id))
                {
                    thisCal = new pro_project_calendar_dal().FindNoDeleteById(long.Parse(id));
                    if (thisCal != null)
                    {
                        isAdd = false;
                        if (!IsPostBack)
                        {
                            if (thisCal.publish_type_id != null)
                            {
                                publish_type_id.SelectedValue = thisCal.publish_type_id.ToString();
                            }
                        }

                        thisProject = new pro_project_dal().FindNoDeleteById(thisCal.project_id);
                    }
                }


                if (thisProject == null)
                {
                    Response.End();
                }
            }
            catch (Exception msg)
            {
                Response.Write(msg);
                Response.End();
            }
        }
コード例 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var chooseDateString = Request.QueryString["chooseDate"];
                if (!string.IsNullOrEmpty(chooseDateString))
                {
                    chooseDate = DateTime.Parse(chooseDateString);
                }
                user = UserInfoBLL.GetUserInfo(GetLoginUserId());
                if (!string.IsNullOrEmpty(Request.QueryString["isSeven"]))
                {
                    isSeven = true;
                }
                if (!string.IsNullOrEmpty(Request.QueryString["isShowDetai"]))
                {
                    isShowDetai = true;
                }

                var id = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(id))
                {
                    thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(id));
                    if (thisProject != null)
                    {
                        taskList   = new sdk_task_dal().GetProTask(thisProject.id, " and type_id in (1807,1808,1812)");
                        proCalList = new pro_project_calendar_dal().GetCalByPro(thisProject.id);
                    }
                }
                if (!string.IsNullOrEmpty(Request.QueryString["isAll"]))
                {
                    isAll = true;
                }
                if (isAll)
                {
                    taskList = new sdk_task_dal().FindListBySql($"select* from sdk_task where delete_time = 0 and type_id in (1807,1808,1812)");
                    var ppDal = new DAL.pro_project_dal();
                    proCalList = new pro_project_calendar_dal().FindListBySql($"SELECT * from pro_project_calendar where delete_time = 0");
                    const string proLimitJson    = "{\"row\":\"7\",\"t1\":\"p\",\"col1\":\"0\",\"col2\":\"0\"}";
                    var          projectLimitSql = Convert.ToString(ppDal.GetSingle($"select f_rpt_getsql_limit('{proLimitJson}',{LoginUserId.ToString()})"));
                    projectList = ppDal.FindListBySql("select* from pro_project p where p.delete_time =0 " + projectLimitSql);
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }
コード例 #8
0
ファイル: EntryDetail.aspx.cs プロジェクト: evelh/Done
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var id = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(id))
                {
                    thisEntry = new sdk_work_entry_dal().FindNoDeleteById(long.Parse(id));
                }
                if (thisEntry == null)
                {
                    Response.End();
                }
                else
                {
                    if (thisEntry.cost_code_id != null)
                    {
                        thisCost = new d_cost_code_dal().FindNoDeleteById((long)thisEntry.cost_code_id);
                        thisRate = new ContractRateBLL().GetRateByCodeAndRole((long)thisEntry.cost_code_id, (long)thisEntry.role_id);
                    }
                    thisTask = new sdk_task_dal().FindNoDeleteById(thisEntry.task_id);

                    if (thisTask != null && thisTask.project_id != null)
                    {
                        thisProject = new pro_project_dal().FindNoDeleteById((long)thisTask.project_id);
                        if (thisProject != null)
                        {
                            thisAccount = new CompanyBLL().GetCompany(thisProject.account_id);
                        }
                    }
                    if (thisEntry.contract_id != null)
                    {
                        thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisEntry.contract_id);
                    }
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
コード例 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var id = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(id))
                {
                    thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(id));
                }
                if (!string.IsNullOrEmpty(Request.QueryString["isAll"]))
                {
                    isAll = true;
                }
                var chooseDateString = Request.QueryString["chooseDate"];
                if (!string.IsNullOrEmpty(chooseDateString))
                {
                    chooseDate = DateTime.Parse(chooseDateString);
                }

                var showDateString = Request.QueryString["showDate"];
                if (!string.IsNullOrEmpty(showDateString))
                {
                    showDate = DateTime.Parse(showDateString);
                }

                calendar.Text = GetTableByDate(showDate);

                if (!string.IsNullOrEmpty(Request.QueryString["isSeven"]))
                {
                    isSeven = true;
                }
                if (!string.IsNullOrEmpty(Request.QueryString["isShowDetai"]))
                {
                    isShowDetai = true;
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }
コード例 #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         var project_id = Request.QueryString["project_id"];
         thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(project_id));
         if (thisProject != null)
         {
             project_udf_list     = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.PROJECTS);
             project_udfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.PROJECTS, thisProject.id, project_udf_list);
             thisAccount          = new CompanyBLL().GetCompany(thisProject.account_id);
             if (thisProject.opportunity_id != null)
             {
                 thisOppo = new crm_opportunity_dal().FindNoDeleteById((long)thisProject.opportunity_id);
             }
         }
     }
     catch (Exception)
     {
         Response.End();
     }
 }
コード例 #11
0
ファイル: ProjectTeamManage.aspx.cs プロジェクト: evelh/Done
        protected crm_contact thisCon     = null; // 成员的联系人
        protected void Page_Load(object sender, EventArgs e)
        {
            var idString = Request.QueryString["id"];

            if (!string.IsNullOrEmpty(idString))
            {
                thisProTeam = new pro_project_team_dal().FindNoDeleteById(long.Parse(idString));
                if (thisProTeam != null)
                {
                    isAdd = false;
                    thisProTeamRoleList = new pro_project_team_role_dal().GetListTeamRole(thisProTeam.id);
                    thisProject         = new pro_project_dal().FindNoDeleteById(thisProTeam.project_id);
                    if (thisProTeam.resource_id != null)
                    {
                        thisRes = new sys_resource_dal().FindNoDeleteById((long)thisProTeam.resource_id);
                    }
                    if (thisProTeam.contact_id != null)
                    {
                        thisCon = new crm_contact_dal().FindNoDeleteById((long)thisProTeam.contact_id);
                    }
                }
            }
            var pId = Request.QueryString["project_id"];

            if (!string.IsNullOrEmpty(pId))
            {
                thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(pId));
            }
            if (thisProject != null)
            {
                thisAccount = new CompanyBLL().GetCompany(thisProject.account_id);
            }
            if (thisProject == null || thisAccount == null)
            {
                Response.End();
            }
        }
コード例 #12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         var thisId = Request.QueryString["project_id"];
         if (!string.IsNullOrEmpty(thisId))
         {
             thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(thisId));
         }
         if (thisProject != null)
         {
             ShowCalendarList.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.PROJECT_CALENDAR + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.PROJECT_CALENDAR + "&id=" + thisProject.id;
         }
         else
         {
             Response.End();
         }
         // project_calendar
     }
     catch (Exception)
     {
         Response.End();
     }
 }
コード例 #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var id = Request.QueryString["id"];
                thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(id));
                if (thisProject != null)
                {
                    //  校验 是否有权限进行查看
                    if (AuthBLL.GetUserProjectAuth(LoginUserId, LoginUser.security_Level_id, thisProject.id).CanView == false)
                    {
                        Response.Write("<script>alert('无权查看');window.close();</script>");
                        Response.End();
                        return;
                    }
                    thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath + "?id=" + id, LoginUserId);


                    var thisAccount = new CompanyBLL().GetCompany(thisProject.account_id);
                    ShowTitle.Text = "项目-" + thisProject.no + thisProject.name + "(" + thisAccount.name + ")";
                    var type = Request.QueryString["type"];
                    switch (type)
                    {
                    case "Schedule":
                        viewProjectIframe.Src = "ProjectSchedule?project_id=" + thisProject.id;
                        break;

                    case "ScheduleTemp":
                        viewProjectIframe.Src = "ProjectSchedule?project_id=" + thisProject.id + "&isTranTemp=1";
                        break;

                    case "Team":
                        viewProjectIframe.Src = "../Common/SearchBodyFrame.aspx?id=" + thisProject.id + "&cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.PROJECT_TEAM + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.PROJECT_TEAM;
                        break;

                    case "Cost":
                        viewProjectIframe.Src = "../Common/SearchBodyFrame.aspx?id=" + thisProject.id + "&cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.PROJECT_COST_EXPENSE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.PROJECT_COST_EXPENSE + "&isCheck=1";
                        break;    // project_cost_expense

                    case "Note":
                        viewProjectIframe.Src = "ProjectNoteShow?project_id=" + thisProject.id;
                        break;

                    case "Rate":
                        viewProjectIframe.Src = "../Common/SearchBodyFrame.aspx?id=" + thisProject.id + "&cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.PROJECT_RATE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.PROJECT_RATE;
                        break;

                    case "Calendar":
                        //viewProjectIframe.Src = "../Common/SearchBodyFrame.aspx?id=" + thisProject.id + "&cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.PROJECT_CALENDAR + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.PROJECT_CALENDAR; project_udf
                        viewProjectIframe.Src = "ProjectCalendarShow?project_id=" + thisProject.id;
                        break;

                    case "Attach":
                        viewProjectIframe.Src = "../Common/SearchBodyFrame.aspx?id=" + thisProject.id + "&cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.PROJECT_ATTACH + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.PROJECT_ATTACH;
                        break;

                    case "UDF":
                        viewProjectIframe.Src = "../Common/SearchBodyFrame.aspx?id=" + thisProject.id + "&cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.PROJECT_UDF + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.PROJECT_UDF;
                        break;

                    case "ticket":
                        viewProjectIframe.Src = "../Common/SearchFrameSet.aspx?cat=" + (int)DicEnum.QUERY_CATE.MY_QUEUE_ACTIVE + "&type=" + (int)QueryType.MY_QUEUE_ACTIVE + "&group=215&param1=4890&param2=" + thisProject.id + "&param4=AddHidden";
                        break;

                    default:
                        viewProjectIframe.Src = "ProjectSummary?id=" + thisProject.id;
                        break;
                    }

                    #region 记录浏览历史
                    var history = new sys_windows_history()
                    {
                        title = $"项目:" + thisProject.name + " " + (thisAccount != null? thisAccount.name:""),
                        url   = Request.RawUrl,
                    };
                    new IndexBLL().BrowseHistory(history, LoginUserId);
                    #endregion
                }
                else
                {
                    Response.End();
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }
コード例 #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
                if (!IsPostBack)
                {
                    ThisPageDataBind();
                }
                task_udfList = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.TASK);
                var project_id = Request.QueryString["project_id"];
                if (!string.IsNullOrEmpty(project_id))
                {
                    thisProject = ppdal.FindNoDeleteById(long.Parse(project_id));
                }
                var parTaskId = Request.QueryString["par_task_id"];
                if (!string.IsNullOrEmpty(parTaskId))
                {
                    parTask = sdDal.FindNoDeleteById(long.Parse(parTaskId));
                    if (parTask != null)
                    {
                        if (parTask.project_id != null)
                        {
                            thisProject = ppdal.FindNoDeleteById((long)parTask.project_id);
                        }
                    }
                }

                var typeString = Request.QueryString["type_id"];
                if (!string.IsNullOrEmpty(typeString))
                {
                    type_id = int.Parse(typeString);
                    if (!IsPostBack)
                    {
                        switch (type_id)
                        {
                        case (int)DicEnum.TASK_TYPE.PROJECT_ISSUE:
                            isProject_issue.Checked = true;
                            break;

                        case (int)DicEnum.TASK_TYPE.PROJECT_TASK:
                            isProject_issue.Checked = false;
                            break;

                        default:
                            break;
                        }
                    }
                }
                var id = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(id))
                {
                    thisTask = sdDal.FindNoDeleteById(long.Parse(id));
                    if (thisTask != null)
                    {
                        if (thisTask.parent_id != null)
                        {
                            parTask = sdDal.FindNoDeleteById((long)thisTask.parent_id);
                        }
                        type_id = thisTask.type_id;
                        isAdd   = false;
                        var isCopyString = Request.QueryString["IsCopy"];
                        if (!string.IsNullOrEmpty(isCopyString) && thisTask.type_id == (int)DicEnum.TASK_TYPE.PROJECT_TASK)
                        {
                            isCopy = true;
                        }
                        if (thisTask.project_id != null)
                        {
                            thisProject = ppdal.FindNoDeleteById((long)thisTask.project_id);
                        }
                        task_udfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.TASK, thisTask.id, task_udfList);
                        noteList          = new com_activity_dal().GetActiList($" and (task_id ={thisTask.id} or object_id={thisTask.id} )");

                        preList = new sdk_task_predecessor_dal().GetRelList(thisTask.id);
                        if (!IsPostBack)
                        {
                            status_id.SelectedValue = thisTask.status_id.ToString();
                            if (thisTask.is_visible_in_client_portal == 0)
                            {
                                DisplayInCapNone.Checked = true;
                            }
                            else
                            {
                                if (thisTask.can_client_portal_user_complete_task == 1)
                                {
                                    DisplayInCapYes.Checked = true;
                                }
                                else
                                {
                                    DisplayInCapYesNoComplete.Checked = true;
                                }
                            }

                            if (thisTask.is_project_issue == 1)
                            {
                                isProject_issue.Checked = true;
                            }
                            else
                            {
                                isProject_issue.Checked = false;
                            }

                            if (thisTask.estimated_type_id == (int)DicEnum.TIME_ENTRY_METHOD_TYPE.FIXWORK)
                            {
                                TaskTypeFixedWork.Checked = true;
                            }
                            else if (thisTask.estimated_type_id == (int)DicEnum.TIME_ENTRY_METHOD_TYPE.FIXDURATION)
                            {
                                TaskTypeFixedDuration.Checked = true;
                            }
                            else
                            {
                            }

                            department_id.SelectedValue = thisTask.department_id == null ? "" : ((int)thisTask.department_id).ToString();
                        }
                        var typeName = "任务";
                        //  判断是阶段,查询出相关项目的关联合同的里程碑  和自己的里程碑
                        if (type_id == (int)DicEnum.TASK_TYPE.PROJECT_PHASE && thisProject != null && thisProject.contract_id != null)
                        {
                            typeName = "阶段";
                            // 获取该项目合同下未被关联的里程碑
                            var proConMilList = new ctt_contract_milestone_dal().GetListByProId(thisProject.id);
                            // 获取该阶段下的所有里程碑
                            var phaMilList = new sdk_task_milestone_dal().GetPhaMilList(thisTask.id);
                            thisPhaMile = new List <PageMile>();
                            if (proConMilList != null && proConMilList.Count > 0)
                            {
                                thisPhaMile.AddRange(proConMilList);
                            }
                            if (phaMilList != null && phaMilList.Count > 0)
                            {
                                thisPhaMile.AddRange(phaMilList);
                            }
                            if (thisPhaMile.Count > 0)
                            {
                                thisPhaMile = thisPhaMile.OrderBy(_ => _.dueDate).ToList();
                            }
                        }
                        #region 记录浏览历史
                        if (!isCopy && !isAdd)
                        {
                            var account = new CompanyBLL().GetCompany(thisTask.account_id);
                            var history = new sys_windows_history()
                            {
                                title = $"编辑{typeName}:" + (thisProject != null ? thisProject.name : "") + " " + thisTask.title + " " + (account != null ? account.name : ""),
                                url   = Request.RawUrl,
                            };
                            new IndexBLL().BrowseHistory(history, LoginUserId);
                        }
                        #endregion
                    }
                }
                if (type_id == (int)DicEnum.TASK_TYPE.PROJECT_PHASE)
                {
                    isPhase = true;
                }

                if (thisProject == null)
                {
                    Response.End();
                }
                else
                {
                    if (thisProject.contract_id != null)
                    {
                        thisProContract = new ctt_contract_dal().FindNoDeleteById((long)thisProject.contract_id);
                        rateList        = new ctt_contract_rate_dal().GetRateByConId((long)thisProject.contract_id);
                    }
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }
コード例 #15
0
ファイル: TaskModify.aspx.cs プロジェクト: evelh/Done
        protected void Page_Load(object sender, EventArgs e)
        {
            // 批量修改
            // 1。多个任务 2.单个任务
            try
            {
                var stDal = new sdk_task_dal();
                var ppDal = new pro_project_dal();
                var ids   = Request.QueryString["taskIds"];
                if (!string.IsNullOrEmpty(ids))
                {
                    idList = ids.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    if (idList.Count() == 1)
                    {
                        var thisTask = stDal.FindNoDeleteById(long.Parse(idList[0]));
                        if (thisTask != null)
                        {
                            if (!IsPostBack)
                            {
                                thisProject   = ppDal.FindNoDeleteById((long)thisTask.project_id);
                                titleValue    = thisTask.title;
                                statuValue    = thisTask.status_id;
                                priorityValue = thisTask.priority;
                                estHoursValue = thisTask.estimated_hours;
                                depValue      = thisTask.department_id;
                                // workTypeValue = thisTask.
                                priResValue = thisTask.owner_resource_id;
                                if (thisTask.is_visible_in_client_portal == 1)
                                {
                                    if (thisTask.can_client_portal_user_complete_task == 1)
                                    {
                                        DisplayInCapYes.Checked = true;
                                    }
                                    else
                                    {
                                        DisplayInCapYesNoComplete.Checked = true;
                                    }
                                }
                                else
                                {
                                    DisplayInCapNone.Checked = true;
                                }
                            }
                            udfValue = new UserDefinedFieldsBLL().GetUdfValue(UDF_CATE.TASK, thisTask.id, udfTaskPara);
                            taskList.Add(thisTask);
                        }
                    }
                    else if (idList.Count() > 1)
                    {
                        taskList = stDal.GetTaskByIds(ids, $" and type_id in ({(int)DicEnum.TASK_TYPE.PROJECT_TASK},{(int)DicEnum.TASK_TYPE.PROJECT_ISSUE})");
                        if (taskList != null && taskList.Count > 0)
                        {
                            thisProject = ppDal.FindNoDeleteById((long)taskList[0].project_id);
                            var firstTask = taskList[0];
                            taskList.Remove(firstTask);
                            if (!IsPostBack)
                            {
                                udfValue = udfBLL.GetUdfValue(UDF_CATE.TASK, firstTask.id, udfTaskPara);

                                if (udfTaskPara != null && udfTaskPara.Count > 0)
                                {
                                    foreach (var udfTask in udfTaskPara)
                                    {
                                        var thisValue = "";
                                        if (udfValue.FirstOrDefault(_ => _.id == udfTask.id) != null)
                                        {
                                            thisValue = udfValue.FirstOrDefault(_ => _.id == udfTask.id).value.ToString();
                                        }
                                        var count = udfBLL.GetSameValueCount(UDF_CATE.TASK, ids, udfTask.col_name, thisValue.ToString());
                                        if (count > 1)
                                        {
                                            udfValue.FirstOrDefault(_ => _.id == udfTask.id).value = "多个值-保持不变";
                                        }
                                        else
                                        {
                                        }
                                    }
                                }

                                if (taskList.Any(_ => _.title != firstTask.title))
                                {
                                    titleValue = "多个值-保持不变";
                                }
                                else
                                {
                                    titleValue = firstTask.title;
                                }
                                if (taskList.Any(_ => _.status_id != firstTask.status_id))
                                {
                                    statuValue = 0;
                                }
                                else
                                {
                                    statuValue = firstTask.status_id;
                                }
                                if (taskList.Any(_ => _.priority != firstTask.priority))
                                {
                                    priorityValue = null;
                                }
                                else
                                {
                                    priorityValue = firstTask.priority;
                                }
                                #region 在页面上的显示设置
                                if (firstTask.is_visible_in_client_portal == 1)
                                {
                                    if (taskList.Any(_ => _.is_visible_in_client_portal != firstTask.is_visible_in_client_portal))
                                    {
                                        displayWayValue = "1";
                                    }
                                    else
                                    {
                                        if (firstTask.can_client_portal_user_complete_task == 1)
                                        {
                                            if (taskList.Any(_ => _.can_client_portal_user_complete_task != firstTask.can_client_portal_user_complete_task))
                                            {
                                                displayWayValue = "1";
                                            }
                                            else
                                            {
                                                DisplayInCapYes.Checked = true;
                                            }
                                        }
                                        else
                                        {
                                            if (taskList.Any(_ => _.can_client_portal_user_complete_task != firstTask.can_client_portal_user_complete_task))
                                            {
                                                displayWayValue = "1";
                                            }
                                            else
                                            {
                                                DisplayInCapYesNoComplete.Checked = true;
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    if (taskList.Any(_ => _.is_visible_in_client_portal != firstTask.is_visible_in_client_portal))
                                    {
                                        displayWayValue = "1";
                                    }
                                    else
                                    {
                                        DisplayInCapNone.Checked = true;
                                    }
                                }
                                if (!string.IsNullOrEmpty(displayWayValue))
                                {
                                    noChange.Checked = true;
                                }

                                #endregion

                                #region 固定工作,固定时间的设置
                                if (taskList.Any(_ => _.estimated_type_id != firstTask.estimated_type_id))
                                {
                                    fixTypeValue         = "1";
                                    typeNoChange.Checked = true;
                                }
                                else
                                {
                                    if (firstTask.estimated_type_id == (int)DicEnum.TIME_ENTRY_METHOD_TYPE.FIXWORK)
                                    {
                                        TaskTypeFixedWork.Checked = true;
                                    }
                                    else if (firstTask.estimated_type_id == (int)DicEnum.TIME_ENTRY_METHOD_TYPE.FIXDURATION)
                                    {
                                        TaskTypeFixedDuration.Checked = true;
                                    }
                                }
                                #endregion

                                if (taskList.Any(_ => _.estimated_hours != firstTask.estimated_hours))
                                {
                                    estHoursValue = null;
                                }
                                else
                                {
                                    estHoursValue = firstTask.estimated_hours;
                                }
                                if (taskList.Any(_ => _.department_id != firstTask.department_id))
                                {
                                    depValue = null;
                                }
                                else
                                {
                                    depValue = firstTask.department_id;
                                }

                                if (taskList.Any(_ => _.owner_resource_id != firstTask.owner_resource_id))
                                {
                                    priResValue = 0;
                                }
                                else
                                {
                                    priResValue = firstTask.owner_resource_id;
                                }
                            }
                        }
                    }

                    if (!IsPostBack)
                    {
                        ThisPageDataBind();
                    }


                    if (statuValue == 0)
                    {
                        status_id.Items.Insert(0, new ListItem()
                        {
                            Value = "0", Text = "多个选择-保持不变", Selected = true
                        });
                    }
                    else
                    {
                        status_id.SelectedValue = statuValue.ToString();
                    }
                    if (depValue == null)
                    {
                        department_id.ClearSelection();
                        department_id.Items.Insert(0, new ListItem()
                        {
                            Value = "0", Text = "多个选择-保持不变", Selected = true
                        });
                    }
                    else
                    {
                        department_id.ClearSelection();
                        department_id.SelectedValue = depValue.ToString();
                    }
                }
                else
                {
                    Response.End();
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
コード例 #16
0
ファイル: ProjectChart.aspx.cs プロジェクト: evelh/Done
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var project_id = Request.QueryString["project_id"];
                thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(project_id));
                type        = Request.QueryString["dateType"];
                if (string.IsNullOrEmpty(type))
                {
                    type = "day";
                }
                taskList = new sdk_task_dal().GetAllProTask(thisProject.id);
                if (taskList != null && taskList.Count > 0)
                {
                    start_date = Tools.Date.DateHelper.ConvertStringToDateTime((long)taskList.Min(_ => _.estimated_begin_time));
                    end_date   = Tools.Date.DateHelper.ConvertStringToDateTime(taskList.Max(_ => (long)_.estimated_end_time));
                    if (GetDateDiffMonth(start_date, end_date, "month") > 12)
                    {
                        end_date = start_date.AddYears(showYearNum).AddDays(-1);
                    }
                    else if (GetDateDiffMonth(start_date, end_date, "month") <= 2)
                    {
                        end_date = end_date.AddMonths(minMohth).AddDays(-1);  // 时间太少,增加宽度
                    }
                    // 页面上展示多少月份
                    var monthNum = GetDateDiffMonth(start_date, end_date, "month");
                    #region 日期展示说明
                    // 1.计算出具体显示多少月份,最多显示 showYearNum*12 的月份--循环添加
                    // 2.开始月份和结束月份可能不是整月,显示部分 --特殊处理
                    // 3.展示具体的天,周,月信息
                    #endregion

                    #region  右日历列表
                    StringBuilder headInfo = new StringBuilder();

                    switch (type)
                    {
                    case "day":
                        DayWidth = 32;
                        for (int i = 0; i < monthNum; i++)
                        {
                            headInfo.Append($"<div class='Gantt_dateMonthYear Gantt_titleFont Gantt_divTableHeader Gantt_header Gantt_date'>");
                            if ((i == 0 || i == monthNum - 1))     // 开始和结束时间以及特殊情况的处理
                            {
                                if (i == 0)
                                {
                                    var monthDayNum    = RetuenMonthDay(start_date);         // 开始日期的月份的总天数
                                    var surplusDays    = (monthDayNum - start_date.Day + 1); // 开始结束时间 --剩余天数
                                    var thisMonthWidth = surplusDays * DayWidth;             // 计算出这个月份占的宽度
                                    // style='width: {thisMonthWidth}px;'
                                    headInfo.Append($"<div class='Gantt_monthHolder'>{start_date.Year.ToString() + '.' + start_date.Month.ToString()}</div>");
                                    int s;
                                    for (s = start_date.Day; s <= monthDayNum; s++)
                                    {
                                        var diffDays = s - start_date.Day;
                                        headInfo.Append($"<div class='Gantt_divTableColumn Gantt_header Gantt_date' style='min-width: {DayWidth}px;'>{RetuenWeekDay((int)start_date.AddDays(diffDays).DayOfWeek)+"<br />" +s}</div>");
                                    }
                                }
                                else if (i == monthNum - 1)
                                {
                                    var monthDayNum    = RetuenMonthDay(end_date); // 开始日期的月份的总天数
                                    var surplusDays    = end_date.Day;             // 开始结束时间
                                    var thisMonthWidth = surplusDays * DayWidth;   // 计算出这个月份占的宽度
                                    //  style='width: {thisMonthWidth}px;'
                                    headInfo.Append($"<div class='Gantt_monthHolder'>{end_date.Year.ToString() + '.' + end_date.Month.ToString()}</div>");
                                    for (int s = 1; s <= surplusDays; s++)
                                    {
                                        var diffDays = s - surplusDays;
                                        headInfo.Append($"<div class='Gantt_divTableColumn Gantt_header Gantt_date' style='min-width: {DayWidth}px;'>{RetuenWeekDay((int)end_date.AddDays(diffDays).DayOfWeek) + "<br />" + s}</div>");
                                    }
                                }
                            }
                            else
                            {
                                var monthDayNum    = RetuenMonthDay(start_date.AddMonths(i));   // 开始日期的月份的总天数
                                var thisMonthWidth = monthDayNum * DayWidth;
                                //  style='width: {thisMonthWidth}px;'
                                headInfo.Append($"<div class='Gantt_monthHolder'>{start_date.AddMonths(i).Year.ToString() + '.' + start_date.AddMonths(i).Month.ToString()}</div>");
                                var thisMonthFirstDay = new DateTime(start_date.AddMonths(i).Year, start_date.AddMonths(i).Month, 1);
                                for (int s = 1; s <= monthDayNum; s++)
                                {
                                    headInfo.Append($"<div class='Gantt_divTableColumn Gantt_header Gantt_date'>{RetuenWeekDay((int)thisMonthFirstDay.AddDays(s - 1).DayOfWeek) + "<br />" + s}</div>");
                                }
                            }
                            headInfo.Append("</div>");
                        }
                        break;

                    case "week":
                        DayWidth = 30;
                        headInfo.Append($"<table border='0' cellspacing='0' cellpadding='0'><tbody><tr valign='top'><td><div class='grid TimelineGridHeader'><table border = '0' cellspacing='0' cellpadding='0'><tbody><tr height = '0'></tr></ tbody><thead> ");
                        // 添加月
                        headInfo.Append("<tr valign='middle' align='center'>");
                        for (int i = 0; i < monthNum; i++)
                        {
                            if ((i == 0 || i == monthNum - 1))     // 开始和结束时间以及特殊情况的处理
                            {
                                if (i == 0)
                                {
                                    var monthDayNum    = RetuenMonthDay(start_date);         // 开始日期的月份的总天数
                                    var surplusDays    = (monthDayNum - start_date.Day + 1); // 开始结束时间 --剩余天数
                                    var thisMonthWidth = surplusDays * DayWidth;             // 计算出这个月份占的宽度
                                    headInfo.Append($"<td colspan='{surplusDays}' class='TextUppercase'>{start_date.Year + "." + start_date.Month}</ td>");
                                }
                                else if (i == monthNum - 1)
                                {
                                    var monthDayNum    = RetuenMonthDay(end_date); // 开始日期的月份的总天数
                                    var surplusDays    = end_date.Day;             // 开始结束时间
                                    var thisMonthWidth = surplusDays * DayWidth;   // 计算出这个月份占的宽度
                                    headInfo.Append($"<td colspan='{end_date.Day}' class='TextUppercase'>{end_date.Year.ToString() + '.' + end_date.Month.ToString()}</ td>");
                                }
                            }
                            else
                            {
                                var monthDayNum    = RetuenMonthDay(start_date.AddMonths(i));   // 开始日期的月份的总天数
                                var thisMonthWidth = monthDayNum * DayWidth;
                                headInfo.Append($"<td colspan='{monthDayNum}' class='TextUppercase'>{start_date.AddMonths(i).Year.ToString() + '.' + start_date.AddMonths(i).Month.ToString()}</ td>");
                            }
                        }
                        headInfo.Append("</tr>");

                        // 添加周
                        headInfo.Append("<tr valign='middle' align='center'>");
                        var weekNum = GetDateDiffMonth(start_date, end_date, "week");
                        for (int s = 0; s < weekNum; s++)
                        {
                            if (s != (weekNum - 1))
                            {
                                headInfo.Append($"<td colspan='7'><div class='TimelineSecondaryHeader' style='width: {7*DayWidth}px;'>{start_date.AddDays(s * 7).Day}-{start_date.AddDays((s + 1) * 7 - 1).Day}</div></td>");
                            }
                            else
                            {
                                headInfo.Append($"<td colspan='7'><div class='TimelineSecondaryHeader' style='width: {(end_date.Day- start_date.AddDays(s * 7).Day)*DayWidth}px;'>{start_date.AddDays(s * 7).Day}-{end_date.Day}</div></td>");
                            }
                        }
                        headInfo.Append("</tr>");
                        headInfo.Append("</thead></table></div></td></tr></tbody></table> ");
                        break;

                    case "month":
                        DayWidth = 15;
                        for (int i = 0; i < monthNum; i++)
                        {
                            headInfo.Append($"<div class='Gantt_dateMonthYear Gantt_titleFont Gantt_divTableHeader Gantt_header Gantt_date'>");
                            if ((i == 0 || i == monthNum - 1))     // 开始和结束时间以及特殊情况的处理
                            {
                                if (i == 0)
                                {
                                    var monthDayNum    = RetuenMonthDay(start_date);         // 开始日期的月份的总天数
                                    var surplusDays    = (monthDayNum - start_date.Day + 1); // 开始结束时间 --剩余天数
                                    var thisMonthWidth = surplusDays * DayWidth;             // 计算出这个月份占的宽度
                                    headInfo.Append($"<div class='Gantt_monthHolder' style='width: {thisMonthWidth}px;'>{start_date.Year.ToString() + '.' + start_date.Month.ToString()}</div>");
                                }
                                else if (i == monthNum - 1)
                                {
                                    var monthDayNum    = RetuenMonthDay(end_date); // 开始日期的月份的总天数
                                    var surplusDays    = end_date.Day;             // 开始结束时间
                                    var thisMonthWidth = surplusDays * DayWidth;   // 计算出这个月份占的宽度
                                    headInfo.Append($"<div class='Gantt_monthHolder' style='width: {thisMonthWidth}px;'>{end_date.Year.ToString() + '.' + end_date.Month.ToString()}</div>");
                                }
                            }
                            else
                            {
                                var monthDayNum    = RetuenMonthDay(start_date.AddMonths(i));   // 开始日期的月份的总天数
                                var thisMonthWidth = monthDayNum * DayWidth;
                                headInfo.Append($"<div class='Gantt_monthHolder' style='width: {thisMonthWidth}px;'>{start_date.AddMonths(i).Year.ToString() + '.' + start_date.AddMonths(i).Month.ToString()}</div>");
                            }
                            headInfo.Append("</div>");
                        }
                        break;

                    default:
                        break;
                    }
                    liCalendar.Text = headInfo.ToString();
                    #endregion


                    #region  左列表
                    StringBuilder leftInfo = new StringBuilder();
                    leftInfo.Append($"<div class='Gantt_projectTitleFont Gantt_titleFont Gantt_divTableRow'><div class='Gantt_idFont Gantt_id Gantt_divTableColumnMonth'></div><div class='Gantt_projectFont Gantt_title Gantt_divTableColumnMonth Gantt_projectTitle'><div style = 'display: block; white-space:nowrap; overflow:inherit;'>{thisProject.name}</div></div></div> ");
                    AddTableHtml(null, taskList, "", "", 0, leftInfo);
                    liLeftTable.Text = leftInfo.ToString();
                    #endregion

                    #region  右图形
                    StringBuilder rightInfo    = new StringBuilder();
                    var           thisDays     = GetDateDiffMonth(start_date, DateTime.Now, "day"); // 开始时间距离今天的距离
                    double        noeDaysWidth = 0;
                    switch (type)
                    {
                    case "day":
                        noeDaysWidth = thisDays * (DayWidth + 10) + 0.8 * (DayWidth + 10);
                        break;

                    case "week":
                        noeDaysWidth = (thisDays + 1) * DayWidth + 0.5 * thisDays;
                        break;

                    case "month":
                        noeDaysWidth = (thisDays + 1) * DayWidth;
                        break;
                    }

                    rightInfo.Append($"<div class='Gantt_divTableRow'><img src = '../Images/todayBarIndicator.png' class='Gantt_TodayBar' style='left: {noeDaysWidth}px;'><div class='Gantt_projectBar' id='Gantt_projectBar' style='width: 100%;'><div style='width: 0%;'></div></div></div>");
                    AddImgHtml(null, taskList, "", rightInfo);
                    liRightImg.Text = rightInfo.ToString();
                    #endregion
                }
                else
                {
                    liCalendar.Text = "暂无数据";
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }
コード例 #17
0
ファイル: TicketNote.aspx.cs プロジェクト: evelh/Done
        protected void Page_Load(object sender, EventArgs e)
        {
            thisUser = new sys_resource_dal().FindNoDeleteById(GetLoginUserId());
            var caDal  = new com_activity_dal();
            var stDal  = new sdk_task_dal();
            var ppDal  = new pro_project_dal();
            var accDal = new crm_account_dal();
            var ccDal  = new ctt_contract_dal();
            var id     = Request.QueryString["id"];

            if (!string.IsNullOrEmpty(id))
            {
                thisNote = caDal.FindNoDeleteById(long.Parse(id));
                if (thisNote != null)
                {
                    isAdd = false;

                    thisNoteAtt = new com_attachment_dal().GetAttListByOid(thisNote.id);

                    thisTicket = stDal.FindNoDeleteById(thisNote.object_id);
                    if (thisTicket != null)
                    {
                        object_id = thisTicket.id;
                    }
                    else
                    {
                        thisProject = ppDal.FindNoDeleteById(thisNote.object_id);
                        if (thisProject != null)
                        {
                            object_id   = thisProject.id;
                            thisAccount = accDal.FindNoDeleteById(thisProject.account_id);
                        }
                        else
                        {
                            thisContract = ccDal.FindNoDeleteById(thisNote.object_id);
                            if (thisContract != null)
                            {
                                object_id   = thisContract.id;
                                thisAccount = accDal.FindNoDeleteById(thisContract.account_id);
                            }
                        }
                    }
                }
            }

            var ticketId = Request.QueryString["ticket_id"];

            if (!string.IsNullOrEmpty(ticketId))
            {
                thisTicket = stDal.FindNoDeleteById(long.Parse(ticketId));
            }
            if (thisTicket != null)
            {
                object_id = thisTicket.id;
                if (thisTicket.type_id == (int)DicEnum.TASK_TYPE.PROJECT_PHASE)
                {
                    // isPhase = true;
                }
                if (thisTicket.contact_id != null)
                {
                    thisContact = new crm_contact_dal().FindNoDeleteById((long)thisTicket.contact_id);
                }
                thisAccount    = accDal.FindNoDeleteById(thisTicket.account_id);
                ticket_creator = new sys_resource_dal().FindNoDeleteById(thisTicket.create_user_id);
                if (!IsPostBack)
                {
                    //status_id.SelectedValue = thisTicket.status_id.ToString();
                }

                if (thisTicket.project_id != null)
                {
                    thisProject = ppDal.FindNoDeleteById((long)thisTicket.project_id);
                    if (thisProject != null && thisAccount != null)
                    {
                        thisAccount = accDal.FindNoDeleteById(thisProject.account_id);
                    }
                }
            }
            if (thisAccount == null)
            {
                Response.End();
            }
            else
            {
                if (thisAccount.resource_id != null)
                {
                    thisAccManger = new sys_resource_dal().FindNoDeleteById((long)thisAccount.resource_id);
                }
            }

            if (!IsPostBack)
            {
                publish_type_id.DataTextField  = "name";
                publish_type_id.DataValueField = "id";
                var pushList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.NOTE_PUBLISH_TYPE);
                if (pushList != null && pushList.Count > 0)
                {
                    pushList = pushList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TICKET_NOTE).ToString()).ToList();
                }
                publish_type_id.DataSource = pushList;
                publish_type_id.DataBind();

                status_id.DataTextField  = "show";
                status_id.DataValueField = "val";
                status_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "ticket_status").Value;
                status_id.DataBind();
                if (thisTicket != null)
                {
                    status_id.SelectedValue = thisTicket.status_id.ToString();
                }

                action_type_id.DataTextField  = "name";
                action_type_id.DataValueField = "id";
                var actList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.ACTION_TYPE);
                actList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList();
                action_type_id.DataSource = actList;
                action_type_id.DataBind();


                if (thisNote != null)
                {
                    if (!IsPostBack)
                    {
                        if (thisNote.publish_type_id != null)
                        {
                            publish_type_id.SelectedValue = thisNote.publish_type_id.ToString();
                        }
                        action_type_id.SelectedValue = thisNote.action_type_id.ToString();
                    }
                }
                //else
                //{
                //    if (isContract)
                //    {
                //        publish_type_id.SelectedValue = ((int)DicEnum.NOTE_PUBLISH_TYPE.CONTRACT_INTERNA_USER).ToString();
                //    }
                //}

                var tempList = new sys_notify_tmpl_dal().GetTempByEvent(DicEnum.NOTIFY_EVENT.NONE);
                notify_id.DataTextField  = "name";
                notify_id.DataValueField = "id";
                notify_id.DataSource     = tempList;
                notify_id.DataBind();
            }
        }
コード例 #18
0
ファイル: TaskView.aspx.cs プロジェクト: evelh/Done
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var id = Request.QueryString["id"];
                thisTask = new sdk_task_dal().FindNoDeleteById(long.Parse(id));
                if (thisTask != null && thisTask.project_id != null)
                {
                    thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath + "?id=" + id, LoginUserId);
                    tvbDto.Add(new DictionaryEntryDto("type", "类型", 0));
                    tvbDto.Add(new DictionaryEntryDto("time", "操作时间", 0));
                    tvbDto.Add(new DictionaryEntryDto("resouName", "员工", 0));
                    tvbDto.Add(new DictionaryEntryDto("workHours", "实际工作时间", 0));
                    tvbDto.Add(new DictionaryEntryDto("notTiltle", "说明/标题", 0));
                    tvbDto.Add(new DictionaryEntryDto("billabled", "是否计费", 0));
                    tvbDto.Add(new DictionaryEntryDto("billed", "已计费", 0));

                    expDto.Add(new DictionaryEntryDto("type_id", "类型", 0));
                    expDto.Add(new DictionaryEntryDto("add_date", "费用日期", 0));
                    expDto.Add(new DictionaryEntryDto("create_user_id", "创建人", 0));
                    expDto.Add(new DictionaryEntryDto("expense_cost_code_id", "费用类别", 0));
                    expDto.Add(new DictionaryEntryDto("amount", "总额", 0));
                    expDto.Add(new DictionaryEntryDto("is_billable", "计费的", 0));
                    expDto.Add(new DictionaryEntryDto("approve_and_post_user_id", "已计费", 0));


                    v_task = new v_task_all_dal().FindById(thisTask.id);
                    if (thisTask.type_id == (int)DicEnum.TASK_TYPE.PROJECT_ISSUE)
                    {
                        taskType = "问题";
                    }
                    else if (thisTask.type_id == (int)DicEnum.TASK_TYPE.PROJECT_TASK)
                    {
                        taskType = "任务";
                    }
                    else
                    {
                        Response.End();
                    }
                    #region 记录浏览历史
                    var account = new CompanyBLL().GetCompany(thisTask.account_id);
                    var history = new sys_windows_history()
                    {
                        title = $"查看{taskType}:" + (thisProject != null ? thisProject.name : "") + " " + thisTask.title + " " + (account != null ? account.name : ""),
                        url   = Request.RawUrl,
                    };
                    new IndexBLL().BrowseHistory(history, LoginUserId);
                    #endregion
                    thisProject = new pro_project_dal().FindNoDeleteById((long)thisTask.project_id);
                    if (thisProject != null)
                    {
                        thisAccount = new crm_account_dal().FindNoDeleteById(thisProject.account_id);
                        if (thisProject.contract_id != null)
                        {
                            thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisProject.contract_id);
                        }
                    }
                    thisTaskResList = new sdk_task_resource_dal().GetTaskResByTaskId(thisTask.id);
                    var roleList = dic.FirstOrDefault(_ => _.Key == "role").Value as List <sys_role>;
                    var sysList  = dic.FirstOrDefault(_ => _.Key == "sys_resource").Value as List <DictionaryEntryDto>;

                    #region 工时备注附件
                    var tasEntryList = new sdk_work_entry_dal().GetByTaskId(thisTask.id);
                    if (tasEntryList != null && tasEntryList.Count > 0)
                    {
                        var newList = (from a in tasEntryList
                                       join b in roleList on a.role_id equals b.id
                                       join c in sysList on a.resource_id equals long.Parse(c.val)
                                       select new TaskViewDto {
                            id = a.id, type = "entry", time = Tools.Date.DateHelper.ConvertStringToDateTime((long)(a.end_time ?? a.start_time)), resouName = c.show + "(" + b.name + ")", workHours = a.hours_worked, notTiltle = a.summary_notes, billabled = a.is_billable == 1?"✓":"", billed = a.approve_and_post_date == null?"": "✓", startDate = Tools.Date.DateHelper.ConvertStringToDateTime((long)a.start_time), workTypeId = a.cost_code_id, contractId = a.contract_id, showOnInv = a.show_on_invoice == 1, serviceId = a.service_id
                        }).ToList();

                        tvdList.AddRange(newList);
                    }
                    var conAttDal      = new com_attachment_dal();
                    var allTaskAttList = new List <com_attachment>();
                    var taskNoteList   = new com_activity_dal().GetActiList($" and (task_id ={thisTask.id} or object_id={thisTask.id} )");
                    if (taskNoteList != null && taskNoteList.Count > 0)
                    {
                        var newList = (from a in taskNoteList
                                       join c in sysList on a.resource_id equals long.Parse(c.val) into temp
                                       from tt in temp.DefaultIfEmpty()
                                       select new TaskViewDto {
                            id = a.id, type = "note", time = Tools.Date.DateHelper.ConvertStringToDateTime(a.create_time), resouName = tt == null ? "" : tt.show, notTiltle = a.name, noteDescr = a.description
                        }).ToList();
                        tvdList.AddRange(newList);

                        foreach (var thisTaskNote in taskNoteList)
                        {
                            var thisNoteAttList = conAttDal.GetAttListByOid(thisTaskNote.id);
                            if (thisNoteAttList != null && thisNoteAttList.Count > 0)
                            {
                                allTaskAttList.AddRange(thisNoteAttList);
                            }
                        }
                    }
                    var taskAttList = conAttDal.GetAttListByOid(thisTask.id);
                    if (taskAttList != null && taskAttList.Count > 0)
                    {
                        allTaskAttList.AddRange(taskAttList);
                    }
                    if (allTaskAttList.Count > 0)
                    {
                        var newList = (from a in allTaskAttList
                                       join c in sysList on a.create_user_id equals long.Parse(c.val) into temp
                                       from tt in temp.DefaultIfEmpty()
                                       select new TaskViewDto {
                            id = a.id, type = "atach", time = Tools.Date.DateHelper.ConvertStringToDateTime(a.create_time), resouName = tt == null?"":tt.show, notTiltle = a.title, fileType = a.type_id
                        }).ToList();
                        tvdList.AddRange(newList);
                    }
                    if (tvdList != null && tvdList.Count > 0)
                    {
                        tvbOrder = Request.QueryString["tvbOrder"];
                        tvdList  = tvdList.OrderBy(_ => _.time).ToList();
                        if (!string.IsNullOrEmpty(tvbOrder))
                        {
                            var tvbOrderArr = tvbOrder.Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries);
                            var orderFile   = tvbDto.FirstOrDefault(_ => _.val == tvbOrderArr[0]);
                            if (tvbOrderArr[1] == "desc")
                            {
                                //tvdList = (from a in tvdList
                                //           orderby tvbOrderArr[0]  descending
                                //           select a).ToList();
                                tvdList.Sort(delegate(TaskViewDto t1, TaskViewDto t2) {
                                    return(GetObjectPropertyValue(t2, tvbOrderArr[0]).CompareTo(GetObjectPropertyValue(t1, tvbOrderArr[0])));
                                });
                                orderFile.select = orderFile != null ? 2 : orderFile.select;
                            }
                            else
                            {
                                //tvdList = (from a in tvdList
                                //           orderby tvbOrderArr[0]
                                //           select a).ToList();
                                tvdList.Sort(delegate(TaskViewDto t1, TaskViewDto t2) {
                                    return(GetObjectPropertyValue(t1, tvbOrderArr[0]).CompareTo(GetObjectPropertyValue(t2, tvbOrderArr[0])));
                                });
                                orderFile.select = orderFile != null ? 1 : orderFile.select;
                            }
                        }
                    }
                    #endregion

                    #region 费用
                    taskExpList = new sdk_expense_dal().GetExpByTaskId(thisTask.id);
                    if (taskExpList != null && taskExpList.Count > 0)
                    {
                        taskExpList = taskExpList.OrderByDescending(_ => _.add_date).ToList();
                        expOrder    = Request.QueryString["expOrder"];
                        if (!string.IsNullOrEmpty(expOrder))
                        {
                            var expOrderArr = expOrder.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                            var orderFile   = expDto.FirstOrDefault(_ => _.val == expOrderArr[0]);
                            if (expOrderArr[1] == "desc")
                            {
                                //taskExpList = (from a in taskExpList
                                //           orderby expOrderArr[0] descending
                                //           select a).ToList();
                                taskExpList.Sort(delegate(sdk_expense t1, sdk_expense t2) {
                                    return(GetObjectPropertyValue(t2, expOrderArr[0]).CompareTo(GetObjectPropertyValue(t1, expOrderArr[0])));
                                });
                                orderFile.select = orderFile != null ? 2 : orderFile.select;
                            }
                            else
                            {
                                //taskExpList = (from a in taskExpList
                                //           orderby expOrderArr[0]
                                //           select a).ToList();
                                taskExpList.Sort(delegate(sdk_expense t1, sdk_expense t2) {
                                    return(GetObjectPropertyValue(t1, expOrderArr[0]).CompareTo(GetObjectPropertyValue(t2, expOrderArr[0])));
                                });

                                orderFile.select = orderFile != null ? 1 : orderFile.select;
                            }
                        }
                    }
                    #endregion
                }
                else
                {
                    Response.End();
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }
コード例 #19
0
ファイル: ExpenseManage.aspx.cs プロジェクト: evelh/Done
        protected bool isFromReport             = false; // 是否从报表页面进行新增操作
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    PageDataBind();
                }
                isShowWorkType = new SysSettingBLL().GetValueById(SysSettingEnum.SDK_EXPENSE_SHOW_WORK_TYPE) == "1";// SDK_EXPENSE_SHOW_WORK_TYPE
                var seDal = new sdk_expense_dal();
                var stDal = new sdk_task_dal();
                var eId   = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(eId))
                {
                    thisExpense = seDal.FindNoDeleteById(long.Parse(eId));
                    if (thisExpense != null)
                    {
                        if (thisExpense.approve_and_post_date != null || thisExpense.approve_and_post_user_id != null)
                        {
                            Response.Write("<script>alert('审批提交的费用不可以更改!')window.close();</script>");
                            Response.End();
                        }
                        if (!new TaskBLL().CanEditExpense(thisExpense.id))
                        {
                            Response.Write("<script>alert('相关报表状态已经更改,不可以进行编辑!');window.close();</script>");
                            Response.End();
                        }

                        isAdd = false;

                        if (!IsPostBack)
                        {
                            if (thisExpense.cost_code_id != null)
                            {
                                cost_code_id.SelectedValue = thisExpense.cost_code_id.ToString();
                            }
                            expense_cost_code_id.SelectedValue = thisExpense.expense_cost_code_id.ToString();
                            RDAddExiRep.Checked           = true;
                            isBillable.Checked            = thisExpense.is_billable == 1;
                            payment_type_id.SelectedValue = thisExpense.payment_type_id.ToString();
                            hasReceipt.Checked            = thisExpense.has_receipt == 1;
                            if (thisExpense.project_id != null)
                            {
                                rbAssProTask.Checked = true;
                            }
                            else
                            {
                                rbAssNone.Checked = true;
                            }
                        }

                        if (thisExpense.project_id != null)
                        {
                            thisProject = new pro_project_dal().FindNoDeleteById((long)thisExpense.project_id);
                        }
                        if (thisExpense.project_id != null && thisExpense.task_id != null)
                        {
                            thisTask = new sdk_task_dal().FindNoDeleteById((long)thisExpense.task_id);
                        }
                        if (thisExpense.project_id == null && thisExpense.task_id != null)
                        {
                            thisTicket = new sdk_task_dal().FindNoDeleteById((long)thisExpense.task_id);
                        }
                        thisAccount = new crm_account_dal().FindNoDeleteById(thisExpense.account_id);
                        thisExpRep  = new sdk_expense_report_dal().FindNoDeleteById(thisExpense.expense_report_id);
                    }
                }
                var task_id = Request.QueryString["task_id"];
                if (!string.IsNullOrEmpty(task_id))
                {
                    thisTask = stDal.FindNoDeleteById(long.Parse(task_id));
                    if (thisTask != null && thisTask.project_id != null)
                    {
                        thisProject = new pro_project_dal().FindNoDeleteById((long)thisTask.project_id);
                        if (thisProject != null)
                        {
                            thisAccount = new crm_account_dal().FindNoDeleteById(thisProject.account_id);
                        }
                    }
                }
                var project_id = Request.QueryString["project_id"];
                if (!string.IsNullOrEmpty(project_id))
                {
                    thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(project_id));
                    if (thisProject != null)
                    {
                        thisAccount = new crm_account_dal().FindNoDeleteById(thisProject.account_id);
                    }
                }

                var report_id = Request.QueryString["report_id"];
                if (!string.IsNullOrEmpty(report_id))
                {
                    thisExpRep = new sdk_expense_report_dal().FindNoDeleteById(long.Parse(report_id));
                    if (thisExpRep != null)
                    {
                        isFromReport = true;
                        thisAccount  = new CompanyBLL().GetDefaultAccount();
                    }
                }

                var ticket_id = Request.QueryString["ticket_id"];
                if (!string.IsNullOrEmpty(ticket_id))
                {
                    thisTicket = new sdk_task_dal().FindNoDeleteById(long.Parse(ticket_id));
                    if (thisTicket != null)
                    {
                        thisAccount = new CompanyBLL().GetCompany(thisTicket.account_id);
                    }
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }
コード例 #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                thisUser = new sys_resource_dal().FindNoDeleteById(GetLoginUserId());
                var caDal  = new com_activity_dal();
                var stDal  = new sdk_task_dal();
                var ppDal  = new pro_project_dal();
                var accDal = new crm_account_dal();
                var ccDal  = new ctt_contract_dal();
                var id     = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(id))
                {
                    thisNote = caDal.FindNoDeleteById(long.Parse(id));
                    if (thisNote != null)
                    {
                        isAdd = false;

                        thisNoteAtt = new com_attachment_dal().GetAttListByOid(thisNote.id);

                        thisTask = stDal.FindNoDeleteById(thisNote.object_id);
                        if (thisTask != null)
                        {
                            object_id = thisTask.id;
                            if (thisTask.type_id == (int)DicEnum.TASK_TYPE.SERVICE_DESK_TICKET)
                            {
                                isTicket   = true;
                                thisTask   = null;
                                thisTicket = stDal.FindNoDeleteById(thisNote.object_id);
                            }
                        }
                        else
                        {
                            thisProject = ppDal.FindNoDeleteById(thisNote.object_id);
                            if (thisProject != null)
                            {
                                isProject   = true;
                                object_id   = thisProject.id;
                                thisAccount = accDal.FindNoDeleteById(thisProject.account_id);
                            }
                            else
                            {
                                thisContract = ccDal.FindNoDeleteById(thisNote.object_id);
                                if (thisContract != null)
                                {
                                    isContract  = true;
                                    object_id   = thisContract.id;
                                    thisAccount = accDal.FindNoDeleteById(thisContract.account_id);
                                }
                            }
                        }
                    }
                }
                var taskId      = Request.QueryString["task_id"];
                var project_id  = Request.QueryString["project_id"];
                var contract_id = Request.QueryString["contract_id"];
                var ticket_id   = Request.QueryString["ticket_id"];
                var call_id     = Request.QueryString["call_id"];
                if (!string.IsNullOrEmpty(taskId))
                {
                    thisTask = stDal.FindNoDeleteById(long.Parse(taskId));
                }
                else if (!string.IsNullOrEmpty(project_id))
                {
                    thisProject = ppDal.FindNoDeleteById(long.Parse(project_id));
                    if (thisProject != null)
                    {
                        isProject   = true;
                        object_id   = thisProject.id;
                        thisAccount = accDal.FindNoDeleteById(thisProject.account_id);
                    }
                }
                else if (!string.IsNullOrEmpty(contract_id))
                {
                    thisContract = ccDal.FindNoDeleteById(long.Parse(contract_id));
                    if (thisContract != null)
                    {
                        object_id   = thisContract.id;
                        thisAccount = accDal.FindNoDeleteById(thisContract.account_id);
                        isContract  = true;
                    }
                }
                else if (!string.IsNullOrEmpty(ticket_id))
                {
                    thisTicket = stDal.FindNoDeleteById(long.Parse(ticket_id));
                }
                else if (!string.IsNullOrEmpty(call_id))
                {
                    thisCall = new sdk_service_call_dal().FindNoDeleteById(long.Parse(call_id));
                    if (thisCall != null)
                    {
                        isCall         = true;
                        thisAccount    = new CompanyBLL().GetCompany(thisCall.account_id);
                        callTicketList = stDal.GetTciketByCall(thisCall.id);
                        if (callTicketList != null && callTicketList.Count > 0)
                        {
                            thisTask = callTicketList[0];
                            if (callTicketList.Any(_ => _.id != thisTask.id && _.status_id != thisTask.status_id))
                            {
                                isMantStatus = true;
                            }
                            if (callTicketList.Any(_ => _.id != thisTask.id && _.account_id != thisTask.account_id))
                            {
                                isManyAccount = true;
                            }
                            if (callTicketList.Any(_ => _.id != thisTask.id && _.title != thisTask.title))
                            {
                                isManyTitle = true;
                            }
                        }
                        else
                        {
                            Response.Write("<script>alert('服务预定下暂无工单!');window.close();</script>");
                            return;
                        }
                    }
                }


                if (thisTask != null)
                {
                    thisAccount = accDal.FindNoDeleteById(thisTask.account_id);
                    object_id   = thisTask.id;
                    if (thisTask.type_id == (int)DicEnum.TASK_TYPE.PROJECT_PHASE)
                    {
                        isPhase = true;
                    }
                    task_creator = new sys_resource_dal().FindNoDeleteById(thisTask.create_user_id);
                    if (thisTask.project_id != null)
                    {
                        thisProject = ppDal.FindNoDeleteById((long)thisTask.project_id);
                        if (thisProject != null)
                        {
                            thisAccount = accDal.FindNoDeleteById(thisProject.account_id);
                        }
                    }
                }
                if (thisTicket != null)
                {
                    isTicket     = true;
                    object_id    = thisTicket.id;
                    task_creator = new sys_resource_dal().FindNoDeleteById(thisTicket.create_user_id);
                    thisAccount  = accDal.FindNoDeleteById(thisTicket.account_id);
                    if (thisTicket.contact_id != null)
                    {
                        thisContact = new crm_contact_dal().FindNoDeleteById((long)thisTicket.contact_id);
                    }
                }
                if (thisAccount == null)
                {
                    Response.End();
                }
                else
                {
                    if (thisAccount.resource_id != null)
                    {
                        thisAccManger = new sys_resource_dal().FindNoDeleteById((long)thisAccount.resource_id);
                    }
                }
                if (!IsPostBack)
                {
                    publish_type_id.DataTextField  = "name";
                    publish_type_id.DataValueField = "id";
                    var pushList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.NOTE_PUBLISH_TYPE);
                    if (pushList != null && pushList.Count > 0)
                    {
                        if (isProject)
                        {
                            pushList = pushList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.PROJECT_NOTE).ToString()).ToList();
                        }
                        else if (isContract)
                        {
                            pushList = pushList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.CONTRACT_NOTE).ToString()).ToList();
                        }
                        else if (isTicket)
                        {
                            pushList = pushList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList();
                        }
                        else
                        {
                            pushList = pushList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList();
                        }
                    }
                    publish_type_id.DataSource = pushList;
                    publish_type_id.DataBind();

                    status_id.DataTextField  = "show";
                    status_id.DataValueField = "val";
                    var statusList = dic.FirstOrDefault(_ => _.Key == "ticket_status").Value as List <DictionaryEntryDto>;
                    if (isMantStatus)
                    {
                        statusList.Add(new DictionaryEntryDto()
                        {
                            val = "0", show = "多个值,保持不变"
                        });
                    }
                    status_id.DataSource = statusList;
                    status_id.DataBind();
                    if (isMantStatus)
                    {
                        status_id.SelectedValue = "0";
                    }
                    else if (thisTask != null)
                    {
                        status_id.SelectedValue = thisTask.status_id.ToString();
                    }
                    else if (thisTicket != null)
                    {
                        status_id.SelectedValue = thisTicket.status_id.ToString();
                    }
                    action_type_id.DataTextField  = "name";
                    action_type_id.DataValueField = "id";
                    var actList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.ACTION_TYPE);
                    if (actList != null && actList.Count > 0)
                    {
                        if (isProject)
                        {
                            actList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.PROJECT_NOTE).ToString()).ToList();
                        }
                        else if (isContract)
                        {
                            actList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.CONTRACT_NOTE).ToString()).ToList();
                        }
                        else if (isTicket)
                        {
                            actList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList();
                        }
                        else
                        {
                            actList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList();
                        }
                    }
                    action_type_id.DataSource = actList;
                    action_type_id.DataBind();
                    if (thisNote != null)
                    {
                        if (!IsPostBack)
                        {
                            if (thisNote.publish_type_id != null)
                            {
                                publish_type_id.SelectedValue = thisNote.publish_type_id.ToString();
                            }
                            action_type_id.SelectedValue = thisNote.action_type_id.ToString();
                            isAnnounce.Checked           = thisNote.announce == 1;
                        }
                    }
                    else
                    {
                        if (isContract)
                        {
                            publish_type_id.SelectedValue = ((int)DicEnum.NOTE_PUBLISH_TYPE.CONTRACT_INTERNA_USER).ToString();
                        }
                    }

                    var tempList = new sys_notify_tmpl_dal().GetTempByEvent(DicEnum.NOTIFY_EVENT.NONE);
                    notify_id.DataTextField  = "name";
                    notify_id.DataValueField = "id";
                    notify_id.DataSource     = tempList;
                    notify_id.DataBind();
                }

                if (isProject)
                {
                    tmplList = new FormTemplateBLL().GetTmplByType((int)DicEnum.FORM_TMPL_TYPE.PROJECT_NOTE, LoginUserId);
                }
                else if (isTicket && thisTicket != null)
                {
                    tmplList = new FormTemplateBLL().GetTmplByType((int)DicEnum.FORM_TMPL_TYPE.TICKET_NOTE, LoginUserId);
                }
                else if (thisTask != null)
                {
                    tmplList = new FormTemplateBLL().GetTmplByType((int)DicEnum.FORM_TMPL_TYPE.TASK_NOTE, LoginUserId);
                }
            }
            catch (Exception msg)
            {
                Response.Write(msg);
                Response.End();
            }
        }
コード例 #21
0
ファイル: ProjectSchedule.aspx.cs プロジェクト: evelh/Done
        protected string pageShowType = "";     // 页面过滤数据类型 --默认展示全部的数据(过滤阶段,完成等信息)
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var id = Request.QueryString["project_id"];
                thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(id));
                if (thisProject != null)
                {
                    pageShowType = Request.QueryString["pageShowType"];
                    taskList     = new sdk_task_dal().GetProjectTask(thisProject.id);
                    var isTran = Request.QueryString["isTranTemp"];
                    if ((!string.IsNullOrEmpty(isTran))) //thisProject.type_id != (int)DicEnum.PROJECT_TYPE.TEMP &&
                    {
                        isTransTemp = true;
                    }
                    if (!IsPostBack)
                    {
                        var tempList = new pro_project_dal().GetTempList();
                        // 项目模板  --project_temp
                        if (tempList != null && tempList.Count > 0)
                        {
                            project_temp.DataTextField  = "name";
                            project_temp.DataValueField = "id";
                            project_temp.DataSource     = tempList;
                            project_temp.DataBind();
                        }

                        organization_location_id.DataTextField  = "name";
                        organization_location_id.DataValueField = "id";
                        organization_location_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "org_location").Value;
                        organization_location_id.DataBind();

                        useResource_daily_hours.Checked = thisProject.use_resource_daily_hours == 1;
                        excludeWeekend.Checked          = thisProject.exclude_weekend == 1;
                        excludeHoliday.Checked          = thisProject.exclude_holiday == 1;
                        warnTime_off.Checked            = thisProject.warn_time_off == 1;
                    }

                    //  if (!int.TryParse(Request.QueryString["cat"], out catId))
                    var catIdString = Request.QueryString["CatID"];
                    if (string.IsNullOrEmpty(catIdString))
                    {
                        catId = (int)DicEnum.QUERY_CATE.PROJECT_TASK;
                    }
                    else
                    {
                        catId = int.Parse(catIdString);
                    }

                    // if (!long.TryParse(Request.QueryString["type"], out queryTypeId))

                    var queryTypeIdString = Request.QueryString["QeryTypeId"];
                    if (string.IsNullOrEmpty(queryTypeIdString))
                    {
                        queryTypeId = (int)QueryType.PROJECT_TASK;
                        //queryTypeId = (int)QueryType.PROJECT_PHASE;
                    }
                    else
                    {
                        queryTypeId = int.Parse(queryTypeIdString);
                    }


                    if (catId == 0 || queryTypeId == 0)
                    {
                        Response.Close();
                        return;
                    }
                    // 一个query_type下只有一个group时可以不传参gruop_id
                    if (paraGroupId == 0)
                    {
                        var groups = bll.GetQueryGroup(catId);
                        foreach (var g in groups)
                        {
                            if (g.query_type_id == queryTypeId)
                            {
                                if (paraGroupId != 0)   // 一个query_type下有多个group,不能判断使用哪个
                                {
                                    Response.Close();
                                    return;
                                }
                                paraGroupId = g.id;
                            }
                        }
                    }
                    // if (!long.TryParse(Request.QueryString["id"], out objId))
                    objId = thisProject.id;
                    QueryData();
                    CalcTableWidth();
                }
                else
                {
                    Response.End();
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }
コード例 #22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var cost_id     = Request.QueryString["id"];
                var contract_id = Request.QueryString["contract_id"];
                var project_id  = Request.QueryString["project_id"];
                var task_id     = Request.QueryString["task_id"];
                var ticket_id   = Request.QueryString["ticket_id"];
                var costCodeId  = Request.QueryString["cost_code_id"];
                if (!string.IsNullOrEmpty(costCodeId))
                {
                    costCode = new d_cost_code_dal().FindNoDeleteById(long.Parse(costCodeId));
                }

                #region  拉框赋值
                cost_type_id.DataTextField  = "show";
                cost_type_id.DataValueField = "val";
                cost_type_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "chargeType").Value;
                cost_type_id.DataBind();
                cost_type_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });
                cost_type_id.SelectedValue = ((int)DicEnum.COST_TYPE.OPERATIONA).ToString();

                // status_id
                status_id.DataTextField  = "show";
                status_id.DataValueField = "val";
                var statuList = dic.FirstOrDefault(_ => _.Key == "chargeStatus").Value as List <DictionaryEntryDto>;

                #endregion
                if (!string.IsNullOrEmpty(contract_id))
                {
                    contract = new ctt_contract_dal().FindNoDeleteById(long.Parse(contract_id));
                    if (contract != null)
                    {
                        if (!IsPostBack)
                        {
                            isbillable.Checked = true;
                        }
                    }
                }
                if (!string.IsNullOrEmpty(cost_id))
                {
                    conCost = new ctt_contract_cost_dal().FindNoDeleteById(long.Parse(cost_id));
                    if (conCost != null)
                    {
                        isAdd    = false;
                        costCode = new d_cost_code_dal().FindNoDeleteById(conCost.cost_code_id);

                        cost_type_id.SelectedValue = conCost.cost_type_id == null ? ((int)DicEnum.COST_TYPE.OPERATIONA).ToString() : conCost.cost_type_id.ToString();
                        if (!IsPostBack)
                        {
                            status_id.SelectedValue = conCost.status_id.ToString();
                        }


                        if (conCost.contract_id != null)
                        {
                            contract = new ctt_contract_dal().FindNoDeleteById((long)conCost.contract_id);
                        }
                        if (conCost.project_id != null)
                        {
                            thisProject = new pro_project_dal().FindNoDeleteById((long)conCost.project_id);
                        }
                        if (conCost.task_id != null)
                        {
                            thisTask = new sdk_task_dal().FindNoDeleteById((long)conCost.task_id);
                            if (thisTask.type_id == (int)DicEnum.TASK_TYPE.SERVICE_DESK_TICKET)
                            {
                                thisTask   = null;
                                thisTicket = new sdk_task_dal().FindNoDeleteById((long)conCost.task_id);
                            }
                        }

                        if (!IsPostBack)
                        {
                            isbillable.Checked    = conCost.is_billable == 1;
                            AddConfigItem.Checked = conCost.create_ci == 1;
                        }

                        if (conCost.status_id == (int)DicEnum.COST_STATUS.UNDETERMINED)
                        {
                            statuList = statuList.Where(_ => _.val == (conCost.status_id).ToString() || _.val == ((int)DicEnum.COST_STATUS.PENDING_PURCHASE).ToString() || _.val == ((int)DicEnum.COST_STATUS.CANCELED).ToString()).ToList();
                        }
                        else if (conCost.status_id == (int)DicEnum.COST_STATUS.CANCELED)
                        {
                            statuList = statuList.Where(_ => _.val == (conCost.status_id).ToString() || _.val == ((int)DicEnum.COST_STATUS.PENDING_PURCHASE).ToString() || _.val == ((int)DicEnum.COST_STATUS.CANCELED).ToString()).ToList();
                        }
                        else
                        {
                            statuList = statuList.Where(_ => _.val == (conCost.status_id).ToString() || _.val == ((int)DicEnum.COST_STATUS.CANCELED).ToString()).ToList();
                        }
                    }
                }
                if (!string.IsNullOrEmpty(project_id))
                {
                    thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(project_id));
                }
                if (!string.IsNullOrEmpty(task_id))
                {
                    thisTask = new sdk_task_dal().FindNoDeleteById(long.Parse(task_id));
                    if (thisTask != null && thisTask.project_id != null)
                    {
                        thisProject = new pro_project_dal().FindNoDeleteById((long)thisTask.project_id);
                    }
                }
                if (!string.IsNullOrEmpty(ticket_id))
                {
                    thisTicket = new sdk_task_dal().FindNoDeleteById(long.Parse(ticket_id));
                }
                if (thisTicket != null)
                {
                    thisAccount = new CompanyBLL().GetCompany(thisTicket.account_id);
                }

                status_id.DataSource = statuList;
                status_id.DataBind();
                //status_id.Items.Insert(0, new ListItem() { Value = "0", Text = "   ", Selected = true });
                if (!IsPostBack)
                {
                    if (isAdd)
                    {
                        status_id.SelectedValue = ((int)DicEnum.COST_STATUS.PENDING_DELIVERY).ToString();
                    }
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }
コード例 #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var account_id = Request.QueryString["account_id"];
                itemStartDatePara = Request.QueryString["stareDate"];
                itemEndDatePara   = Request.QueryString["endDate"];
                contractTypePara  = Request.QueryString["contract_type"];
                contractCatePara  = Request.QueryString["contract_cate"];
                projectItemPara   = Request.QueryString["itemDeal"];

                var thisProjectId = Request.QueryString["thisProject"];
                if (!string.IsNullOrEmpty(thisProjectId))
                {
                    thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(thisProjectId));
                }
                if (thisProject != null)
                {
                    project_idHidden.Value = thisProject.id.ToString();
                }


                contract_udfList = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.CONTRACTS);
                account          = new CompanyBLL().GetCompany(long.Parse(account_id));

                if (!IsPostBack)
                {
                    PageDataBind();
                    if (!string.IsNullOrEmpty(itemStartDatePara))
                    {
                        itemStartDate.Value = itemStartDatePara;
                    }
                    if (!string.IsNullOrEmpty(itemEndDatePara))
                    {
                        itemEndDate.Value = itemEndDatePara;
                    }
                    if (!string.IsNullOrEmpty(contractTypePara))
                    {
                        contract_type_id.SelectedValue = contractTypePara;
                    }
                    if (!string.IsNullOrEmpty(contractCatePara))
                    {
                        contract_cate_id.SelectedValue = contractCatePara;
                    }
                    if (!string.IsNullOrEmpty(projectItemPara))
                    {
                    }

                    var childAccList = new crm_account_dal().GetSubsidiariesById(account.id);
                    if (childAccList != null && childAccList.Count > 0)
                    {
                        if (!string.IsNullOrEmpty(isCheckSunAccountPara))
                        {
                            ckchildAccounts.Checked = true;
                        }
                    }
                    else
                    {
                        ckchildAccounts.Enabled = false;
                    }
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
コード例 #24
0
ファイル: WorkEntry.aspx.cs プロジェクト: evelh/Done
        protected bool noTime = false;      // 可以不输入开始结束时间(根据系统设置进行判断)
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                //  是否需要输入开始结束时间
                var isNeedTimeString = Request.QueryString["NoTime"];
                var noTimeSet        = new SysSettingBLL().GetSetById(SysSettingEnum.SDK_ENTRY_REQUIRED);
                if (!string.IsNullOrEmpty(isNeedTimeString))
                {
                    if (noTimeSet != null && noTimeSet.setting_value == "0")
                    {
                        noTime = true;
                    }
                }
                var callId = Request.QueryString["callId"];
                if (!string.IsNullOrEmpty(callId))
                {
                    thisCall = new sdk_service_call_dal().FindNoDeleteById(long.Parse(callId));
                }
                thisUser = new sys_resource_dal().FindNoDeleteById(GetLoginUserId());
                var resList = dic.FirstOrDefault(_ => _.Key == "sys_resource").Value as List <DictionaryEntryDto>;
                if (!IsPostBack)
                {
                    resource_id.DataTextField  = "show";
                    resource_id.DataValueField = "val";
                    var  entryProxySet = new SysSettingBLL().GetValueById(SysSettingEnum.SDK_ENTRY_PROXY);
                    bool isAgent       = false;
                    if (entryProxySet == ((int)DicEnum.PROXY_TIME_ENTRY.DISABLED).ToString())
                    {
                        if (resList != null && resList.Count > 0)
                        {
                            resList = resList.Where(_ => _.val == LoginUserId.ToString()).ToList();
                        }
                    }
                    else
                    {
                        var agentResList = new UserResourceBLL().GetAgentUser(LoginUserId, out isAgent);
                        if (agentResList != null && agentResList.Count > 0)
                        {
                            resList = (from a in agentResList
                                       select new DictionaryEntryDto()
                            {
                                val = a.id.ToString(), show = a.name
                            }).ToList();
                        }
                    }
                    resource_id.DataSource    = resList;
                    resource_id.SelectedValue = LoginUserId.ToString();
                    resource_id.DataBind();

                    var statusList = dic.FirstOrDefault(_ => _.Key == "ticket_status").Value as List <DictionaryEntryDto>;
                    //statusList.Remove(statusList.FirstOrDefault(_=>_.val==((int)DicEnum.TICKET_STATUS.NEW).ToString()));
                    status_id.DataTextField  = "show";
                    status_id.DataValueField = "val";
                    status_id.DataSource     = statusList;
                    status_id.DataBind();


                    cost_code_id.DataTextField  = "name";
                    cost_code_id.DataValueField = "id";
                    cost_code_id.DataSource     = new d_cost_code_dal().GetCostCodeByWhere((int)DicEnum.COST_CODE_CATE.GENERAL_ALLOCATION_CODE);
                    cost_code_id.DataBind();

                    notify_id.DataTextField  = "name";
                    notify_id.DataValueField = "id";
                    notify_id.DataSource     = new sys_notify_tmpl_dal().GetTempByEvent(DicEnum.NOTIFY_EVENT.TICKET_TIME_ENTRY_CREATED_EDITED);
                    notify_id.DataBind();
                }

                var taskId = Request.QueryString["task_id"];
                if (!string.IsNullOrEmpty(taskId))
                {
                    thisTask = new sdk_task_dal().FindNoDeleteById(long.Parse(taskId));
                }

                var id = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(id))
                {
                    thisWorkEntry = new sdk_work_entry_dal().FindNoDeleteById(long.Parse(id));
                    if (thisWorkEntry != null)
                    {
                        if (thisWorkEntry.approve_and_post_date != null || thisWorkEntry.approve_and_post_user_id != null)
                        {
                            Response.Write("<script>alert('审批提交的工时不可以更改!');window.close();</script>");
                            Response.End();
                        }

                        if (!resList.Any(_ => _.val == thisWorkEntry.create_user_id.ToString()))
                        {
                            Response.Write("<script>alert('系统设置不能代理操作!');window.close();</script>");
                            return;
                        }
                        if (thisWorkEntry.end_time == null && noTimeSet != null && noTimeSet.setting_value == "0")
                        {
                            noTime = true;
                        }
                        entryList = new sdk_work_entry_dal().GetBatchList(thisWorkEntry.batch_id);
                        isAdd     = false;
                        thisTask  = new sdk_task_dal().FindNoDeleteById(thisWorkEntry.task_id);
                        if (!IsPostBack)
                        {
                            resource_id.ClearSelection();
                            resource_id.SelectedValue  = ((long)thisWorkEntry.resource_id).ToString();
                            cost_code_id.SelectedValue = ((long)thisWorkEntry.cost_code_id).ToString();
                            // status_id.SelectedValue = ((long)thisWorkEntry.)
                            // thisTask  = new crm_account_dal().FindNoDeleteById(thisWorkEntry.);
                        }

                        if (thisWorkEntry.contract_id != null)
                        {
                            thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisWorkEntry.contract_id);
                        }
                        if (!IsPostBack)
                        {
                            isBilled.Checked  = thisWorkEntry.is_billable == 0;
                            ShowOnInv.Checked = thisWorkEntry.show_on_invoice == 1;
                            if (isBilled.Checked)
                            {
                                ShowOnInv.Enabled = true;
                            }
                        }
                    }
                    else
                    {
                        Response.Write("<script>alert('工时已被删除!')window.close();</script>");
                        Response.End();
                    }
                }
                #region 根据批次获取相关工时
                //var batchId = Request.QueryString["batchId"];
                //if (!string.IsNullOrEmpty(batchId))
                //{
                //    entryList = new sdk_work_entry_dal().GetBatchList(long.Parse(batchId));
                //    if(entryList!=null&& entryList.Count > 0)
                //    {
                //        thisWorkEntry = entryList[0];
                //        if (thisWorkEntry.approve_and_post_date != null || thisWorkEntry.approve_and_post_user_id != null)
                //        {
                //            Response.Write("<script>alert('审批提交的工时不可以更改!');window.close();</script>");
                //            Response.End();
                //        }

                //        if (!resList.Any(_ => _.val == thisWorkEntry.create_user_id.ToString()))
                //        {
                //            Response.Write("<script>alert('系统设置不能代理操作!')window.close();</script>");
                //            Response.End();
                //        }
                //        if (thisWorkEntry.end_time == null && noTimeSet != null && noTimeSet.setting_value == "0")
                //        {
                //            noTime = true;
                //        }
                //        entryList = new sdk_work_entry_dal().GetBatchList(thisWorkEntry.batch_id);
                //        isAdd = false;
                //        thisTask = new sdk_task_dal().FindNoDeleteById(thisWorkEntry.task_id);
                //        if (!IsPostBack)
                //        {
                //            resource_id.SelectedValue = ((long)thisWorkEntry.resource_id).ToString();
                //            cost_code_id.SelectedValue = ((long)thisWorkEntry.cost_code_id).ToString();
                //            // status_id.SelectedValue = ((long)thisWorkEntry.)
                //            // thisTask  = new crm_account_dal().FindNoDeleteById(thisWorkEntry.);

                //        }

                //        if (thisWorkEntry.contract_id != null)
                //        {
                //            thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisWorkEntry.contract_id);
                //        }
                //        if (!IsPostBack)
                //        {
                //            isBilled.Checked = thisWorkEntry.is_billable == 0;
                //            ShowOnInv.Checked = thisWorkEntry.show_on_invoice == 1;
                //            if (isBilled.Checked)
                //            {
                //                ShowOnInv.Enabled = true;
                //            }
                //        }
                //    }
                //}
                #endregion
                if (thisTask != null)
                {
                    v_task      = new v_task_all_dal().FindById(thisTask.id);
                    thisProjetc = new pro_project_dal().FindNoDeleteById((long)thisTask.project_id);
                    if (thisProjetc != null)
                    {
                        thisAccount = new crm_account_dal().FindNoDeleteById(thisProjetc.account_id);
                        if (!IsPostBack)
                        {
                            status_id.SelectedValue = thisTask.status_id.ToString();
                        }
                    }
                }
                // 项目关联合同,并且合同中设置-工时录入需要输入开始结束时间
                if (thisProjetc != null && thisProjetc.contract_id != null)
                {
                    var thisCttContract = new ctt_contract_dal().FindNoDeleteById((long)thisProjetc.contract_id);
                    if (thisCttContract != null)
                    {
                        if (thisCttContract.timeentry_need_begin_end == 1)
                        {
                            noTime = false;
                        }
                    }
                }

                if (thisCall != null)
                {
                    showStartDate = EMT.Tools.Date.DateHelper.ConvertStringToDateTime(thisCall.start_time);
                    showEndDate   = EMT.Tools.Date.DateHelper.ConvertStringToDateTime(thisCall.end_time);
                }
                if (!string.IsNullOrEmpty(Request.QueryString["chooseDate"]))
                {
                    showStartDate = DateTime.Parse(Request.QueryString["chooseDate"]);
                    showEndDate   = DateTime.Parse(Request.QueryString["chooseDate"]);
                }
            }
            catch (Exception msg)
            {
                Response.Write($"<script>alert('{msg.Message}');window.close();</script>");
            }
        }
コード例 #25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
                //var checkLimitType = Request.QueryString["type_id"];
                //if (checkLimitType == ((int)DicEnum.PROJECT_TYPE.ACCOUNT_PROJECT).ToString() || checkLimitType == ((int)DicEnum.PROJECT_TYPE.IN_PROJECT).ToString())
                //{
                //    var result = GetLimitValue(AuthLimitEnum.PROClientAdd);
                //    if (result == DicEnum.LIMIT_TYPE_VALUE.NO960)
                //    {
                //        Response.Write("alert(没有新增项目权限);window.close();");
                //        return;
                //    }

                //}
                //else if (checkLimitType == ((int)DicEnum.PROJECT_TYPE.PROJECT_DAY).ToString())
                //{
                //    var result = GetLimitValue(AuthLimitEnum.PROProposalAdd);
                //    if (result == DicEnum.LIMIT_TYPE_VALUE.NO960)
                //    {
                //        Response.Write("alert(没有新增项目提案权限);window.close();");
                //        return;
                //    }
                //}
                //else if (checkLimitType == ((int)DicEnum.PROJECT_TYPE.TEMP).ToString())
                //{
                //    var result = GetLimitValue(AuthLimitEnum.PROTemplatesAdd);
                //    if (result == DicEnum.LIMIT_TYPE_VALUE.NO960)
                //    {
                //        Response.Write("alert(没有新增项目模板权限);window.close();");
                //        return;
                //    }
                //}
                var accountIdString = Request.QueryString["account_id"];
                if (!string.IsNullOrEmpty(accountIdString))
                {
                    account = new CompanyBLL().GetCompany(long.Parse(accountIdString));
                }
                callBaclFunction = Request.QueryString["callFunc"];

                isFromTemp = Request.QueryString["isFromTemp"];
                isTemp     = Request.QueryString["isTemp"];


                var id = Request.QueryString["id"];
                project_udfList = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.PROJECTS);
                if (!string.IsNullOrEmpty(id))
                {
                    thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(id));
                    if (thisProject != null)
                    {
                        if (thisProject.contract_id != null)
                        {
                            contract = new ctt_contract_dal().FindNoDeleteById((long)thisProject.contract_id);
                        }
                        if (thisProject.type_id == (int)DicEnum.PROJECT_TYPE.TEMP)
                        {
                            isTemp = "1";
                        }
                        taskList             = new sdk_task_dal().GetProTask(thisProject.id);
                        account              = new crm_account_dal().FindNoDeleteById(thisProject.account_id);
                        project_udfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.PROJECTS, thisProject.id, project_udfList);
                        isAdd = false;
                    }
                }
                else
                {
                    if (!IsPostBack)
                    {
                        is_active.Checked      = true;
                        excludeWeekend.Checked = true;
                        excludeHoliday.Checked = true;
                        warnTime_off.Checked   = true;
                    }
                }
                if (!IsPostBack)
                {
                    PageDataBind();
                }

                if (thisProject != null)
                {
                    #region 根据项目信息为页面数据赋值
                    if (!IsPostBack)
                    {
                        line_of_business_id.SelectedValue      = thisProject.line_of_business_id == null ? "0" : thisProject.line_of_business_id.ToString();
                        type_id.SelectedValue                  = thisProject.type_id == null ? "0" : thisProject.type_id.ToString();
                        status_id.SelectedValue                = thisProject.status_id.ToString();
                        department_id.SelectedValue            = thisProject.department_id == null ? "0" : thisProject.department_id.ToString();
                        organization_location_id.SelectedValue = thisProject.organization_location_id.ToString();
                        template_id.SelectedValue              = thisProject.template_id == null ? "0" : thisProject.template_id.ToString();
                        useResource_daily_hours.Checked        = thisProject.use_resource_daily_hours == 1;
                        owner_resource_id.SelectedValue        = thisProject.owner_resource_id == null ? "0" : thisProject.owner_resource_id.ToString();
                        excludeWeekend.Checked                 = thisProject.exclude_weekend == 1;
                        excludeHoliday.Checked                 = thisProject.exclude_holiday == 1;
                        warnTime_off.Checked = thisProject.warn_time_off == 1;
                        if (!string.IsNullOrEmpty(isTemp))
                        {
                            is_active.Checked = thisProject.status_id == (int)DicEnum.PROJECT_STATUS.NEW;
                        }
                    }
                    #endregion
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }
コード例 #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var id = Request.QueryString["project_id"];
                thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(id));
                if (thisProject != null)
                {
                    //  if (!int.TryParse(Request.QueryString["cat"], out catId))
                    var catIdString = Request.QueryString["CatID"];
                    if (string.IsNullOrEmpty(catIdString))
                    {
                        catId = (int)DicEnum.QUERY_CATE.PROJECT_TASK;
                    }
                    else
                    {
                        catId = int.Parse(catIdString);
                    }

                    // if (!long.TryParse(Request.QueryString["type"], out queryTypeId))

                    var queryTypeIdString = Request.QueryString["QeryTypeId"];
                    if (string.IsNullOrEmpty(queryTypeIdString))
                    {
                        queryTypeId = (int)QueryType.PROJECT_TASK;
                        //queryTypeId = (int)QueryType.PROJECT_PHASE;
                    }
                    else
                    {
                        queryTypeId = int.Parse(queryTypeIdString);
                    }


                    if (catId == 0 || queryTypeId == 0)
                    {
                        Response.Close();
                        return;
                    }
                    // 一个query_type下只有一个group时可以不传参gruop_id
                    if (paraGroupId == 0)
                    {
                        var groups = bll.GetQueryGroup(catId);
                        foreach (var g in groups)
                        {
                            if (g.query_type_id == queryTypeId)
                            {
                                if (paraGroupId != 0)   // 一个query_type下有多个group,不能判断使用哪个
                                {
                                    Response.Close();
                                    return;
                                }
                                paraGroupId = g.id;
                            }
                        }
                    }
                    // if (!long.TryParse(Request.QueryString["id"], out objId))
                    if (thisProject.baseline_project_id != null)
                    {
                        objId = (long)thisProject.baseline_project_id;
                    }

                    QueryData();
                    CalcTableWidth();
                }
                else
                {
                    Response.End();
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }
コード例 #27
0
ファイル: ConfigItemWizard.aspx.cs プロジェクト: evelh/Done
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var cid        = Request.QueryString["contract_id"];
                var project_id = Request.QueryString["project_id"];
                var ccid       = Request.QueryString["cost_id"];
                if (!string.IsNullOrEmpty(cid))
                {
                    contract = new ctt_contract_dal().FindNoDeleteById(long.Parse(cid));
                }
                if (!string.IsNullOrEmpty(project_id))
                {
                    thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(project_id));
                }

                conCost = new ctt_contract_cost_dal().FindNoDeleteById(long.Parse(ccid));
                if (conCost != null)
                {
                    if (conCost.product_id != null)
                    {
                        product = new ivt_product_dal().FindNoDeleteById((long)conCost.product_id);
                    }
                    else
                    {
                        product = new ivt_product_dal().GetDefaultProduct();
                    }
                    if (conCost.quantity != null)
                    {
                        var thisSubList = new crm_installed_product_dal().GetInsProByCostId(conCost.id, (long)conCost.quantity);
                        int num         = (int)conCost.quantity;
                        if (thisSubList != null && thisSubList.Count > 0)
                        {
                            num          = (int)conCost.quantity - thisSubList.Count;
                            exisCostList = new ctt_contract_cost_dal().GetItemByNum(conCost.id, thisSubList.Count);
                        }
                        if (num > 0)
                        {
                            costList = new ctt_contract_cost_dal().GetItemByNum(conCost.id, num);
                        }
                    }
                    if (costList != null && costList.Count > 0)
                    {
                    }
                }
                if (conCost == null)
                {
                    Response.Write("<script>alert('未查询到成本');window.close();</script>");
                    return;
                }
                if (conCost.create_ci == 1)
                {
                    Response.Write("<script>alert('成本已创建配置项!');window.close();</script>");
                    return;
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }