Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            long id = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["id"]) && long.TryParse(Request.QueryString["id"], out id))
            {
                thisActivity = new ActivityBLL().GetActivity(id);
            }


            if (thisActivity == null)
            {
                Response.Write("<script>alert('为获取到相关信息!请刷新页面后重试!');window.close();</script>");
            }
            else
            {
                if (thisActivity.account_id != null)
                {
                    account = new CompanyBLL().GetCompany((long)thisActivity.account_id);
                }
                if (thisActivity.resource_id != null)
                {
                    assignUser = new UserResourceBLL().GetResourceById((long)thisActivity.resource_id);
                }
                createUser = new UserResourceBLL().GetResourceById(thisActivity.create_user_id);

                actType = new GeneralBLL().GetSingleGeneral(thisActivity.action_type_id, true);

                if (thisActivity.action_type_id == (int)DTO.DicEnum.ACTIVITY_CATE.TODO)
                {
                    isTodo = true;
                }
            }
        }
Ejemplo n.º 2
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));
                }
                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();
            }
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var account_id = Request.QueryString["account_id"];

            if (!string.IsNullOrEmpty(account_id))
            {
                thisAccount = new CompanyBLL().GetCompany(long.Parse(account_id));
            }
            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);
                }
            }

            var info = new BLL.QueryCommonBLL().GetQueryGroup((int)DicEnum.QUERY_CATE.TICKET_ACCOUNT_LIST);

            if (info != null && info.Count > 0)
            {
                groupId = info[0].id;
            }
            if (thisAccount == null)
            {
                Response.Write("<script>alert('未查询到该客户信息!');window.close();</script>");
            }
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var id = Request.QueryString["id"];

            if (id != null)
            {
                if (AuthBLL.GetUserCompanyAuth(LoginUserId, LoginUser.security_Level_id, Convert.ToInt64(id)).CanDelete == false)  // 权限验证
                {
                    Response.End();
                    return;
                }
                crm_account = new CompanyBLL().GetCompany(Convert.ToInt64(id));
                dic         = companyBll.GetField();
                if (crm_account != null)
                {
                    contactList     = new ContactBLL().GetContactByCompany(crm_account.id);
                    opportunityList = new OpportunityBLL().GetOpportunityByCompany(crm_account.id);
                    todoList        = new DAL.com_activity_dal().GetNoteByAccount(crm_account.id, (int)DicEnum.ACTIVITY_CATE.TODO);
                    noteList        = new DAL.com_activity_dal().GetNoteByAccount(crm_account.id);
                    insProList      = new DAL.crm_installed_product_dal().FindByAccountId(crm_account.id);
                }
                else
                {
                    Response.End();
                }
            }
            else
            {
                Response.End();
            }
        }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var thisContractId = Request.QueryString["contract_id"];
                if (!string.IsNullOrEmpty(thisContractId))
                {
                    thisContract = new ctt_contract_dal().FindNoDeleteById(long.Parse(thisContractId));
                }
                if (thisContract != 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=" + thisContract.id;
                }

                var taskId = Request.QueryString["task_id"];
                if (!string.IsNullOrEmpty(taskId))
                {
                    thisTask = new sdk_task_dal().FindNoDeleteById(long.Parse(taskId));
                }
                if (thisTask != 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=" + thisTask.id;
                    thisAccount      = new BLL.CompanyBLL().GetCompany(thisTask.account_id);
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            long fromAccId = 0; long toAccId = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["fromAccId"]))
            {
                if (long.TryParse(Request.QueryString["fromAccId"], out fromAccId))
                {
                    fromAccount = accBll.GetCompany(fromAccId);
                }
            }
            if (!string.IsNullOrEmpty(Request.QueryString["toAccId"]))
            {
                if (long.TryParse(Request.QueryString["toAccId"], out toAccId))
                {
                    toAccount = accBll.GetCompany(toAccId);
                }
            }
            if (!string.IsNullOrEmpty(Request.QueryString["isDel"]) && Request.QueryString["isDel"] == "1")
            {
                isDel = true;
            }

            if (fromAccount != null)
            {
                liLeft.Text = GetDetailByAccount(fromAccount.id);
            }
            if (toAccount != null)
            {
                liRight.Text = GetDetailByAccount(toAccount.id);
            }
        }
Ejemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var updateLocationContact = Request.QueryString["updateLocationContact"];
                var updateFaxPhoneContact = Request.QueryString["updateFaxPhoneContact"];
                var account_id            = Request.QueryString["account_id"];

                // GetContactByIds
                if (!string.IsNullOrEmpty(updateLocationContact))
                {
                    locationContactList = new ContactBLL().GetContactByIds(updateLocationContact);
                }
                if (!string.IsNullOrEmpty(updateFaxPhoneContact))
                {
                    faxPhoneContactList = new ContactBLL().GetContactByIds(updateFaxPhoneContact);
                }

                account         = new CompanyBLL().GetCompany(Convert.ToInt64(account_id));
                defaultLocation = new LocationBLL().GetLocationByAccountId(Convert.ToInt64(account_id));
                if (account != null)
                {
                    Phone.Text = account.phone;
                    Fax.Text   = account.fax;
                }
                else
                {
                    Response.End();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 8
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
");
        }
Ejemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
            var artId = Request.QueryString["id"];

            if (!string.IsNullOrEmpty(artId))
            {
                thisArt = new DAL.sdk_kb_article_dal().FindNoDeleteById(long.Parse(artId));
            }
            long reqAddTicId = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["ticketId"]) && long.TryParse(Request.QueryString["ticketId"], out reqAddTicId))
            {
                kbTicketList = new List <sdk_kb_article_ticket>()
                {
                    new sdk_kb_article_ticket()
                    {
                        task_id = reqAddTicId
                    },
                }
            }
            ;
            if (thisArt != null)
            {
                isAdd = false;
                if (thisArt.account_id != null)
                {
                    thisAccount = new CompanyBLL().GetCompany((long)thisArt.account_id);
                }
                objectId     = thisArt.id;
                thisNoteAtt  = new DAL.com_attachment_dal().GetAttListByOid(thisArt.id);
                kbTicketList = new DAL.sdk_kb_article_ticket_dal().GetArtTicket(thisArt.id);
            }
            if (!IsPostBack)
            {
            }
            else
            {
                var param  = GetParam();
                var result = new KnowledgeBLL().KnowManage(param, LoginUserId);
                ClientScript.RegisterStartupScript(this.GetType(), "刷新父页面", $"<script>self.opener.location.reload();</script>");
                ClientScript.RegisterStartupScript(this.GetType(), "提示信息", $"<script>alert('保存{(result ? "成功" : "失败")}!');</script>");
                var saveType = Request.Form["SaveType"];
                if (saveType == "SaveClose")
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "跳转操作", $"<script>window.close();</script>");
                }
                else if (saveType == "Save")
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "跳转操作", $"<script>location.href='AddRepository?id={param.thisArt.id}';</script>");
                }
            }
        }
Ejemplo n.º 10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         var accountId = Request.QueryString["accountId"];
         if (!string.IsNullOrEmpty(accountId))
         {
             pageAccount = new CompanyBLL().GetCompany(long.Parse(accountId));
         }
         if (pageAccount == null)
         {
             Response.Write($"<script>alert('为获取到联系人信息!');window.close();</script>");
             return;
         }
         pageGroupList = conBll.GetAllGroup();
         var groupId = Request.QueryString["groupId"];
         if (!string.IsNullOrEmpty(groupId))
         {
             pageGroup = conBll.GetGroupById(long.Parse(groupId));
         }
         var accContactList = conBll.GetContactByCompany(pageAccount.id);
         if (pageGroup == null)
         {
             notInContract = accContactList;
         }
         else
         {
             var groupContracList = conBll.GetAccountGroupContact(pageGroup.id, pageAccount.id);
             if (groupContracList != null && groupContracList.Count > 0)
             {
                 if (accContactList != null && accContactList.Count > 0)
                 {
                     INContract    = accContactList.Where(_ => groupContracList.Any(g => g.contact_id == _.id)).ToList();
                     notInContract = accContactList.Where(_ => !groupContracList.Any(g => g.contact_id == _.id)).ToList();
                 }
             }
             else
             {
                 notInContract = accContactList;
             }
         }
         if (!string.IsNullOrEmpty(Request.QueryString["isDisGroup"]) && Request.QueryString["isDisGroup"] == "dis")
         {
             isDisGroup = true;
         }
     }
     catch (Exception msg)
     {
         Response.Write($"<script>alert('{msg.Message}');window.close();</script>");
     }
 }
Ejemplo n.º 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            long ticketId = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["ticketId"]) && long.TryParse(Request.QueryString["ticketId"], out ticketId))
            {
                ticket = new TicketBLL().GetTask(ticketId);
            }

            if (ticket != null)
            {
                account = new CompanyBLL().GetCompany(ticket.account_id);
            }
        }
Ejemplo n.º 12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         var ticketIds = Request.QueryString["ticketIds"];
         if (!IsPostBack)
         {
             if (!string.IsNullOrEmpty(ticketIds))
             {
                 ticketList = new sdk_task_dal().GetTicketByIds(ticketIds);
             }
             if (ticketList == null || ticketList.Count == 0)
             {
                 Response.Write($"<script>alert('未查询到相关工单信息');window.close();</script>");
             }
             else if (ticketList.Count == 0)
             {
                 thisAccount = new CompanyBLL().GetCompany(ticketList[0].account_id);
             }
         }
         else
         {
             var  accountId    = Request.Form["accountId"];
             var  projectId    = Request.Form["projectId"];
             var  departmentId = Request.Form["departmentId"];
             long?phaseId      = null;
             if (!string.IsNullOrEmpty(Request.Form["phaseId"]))
             {
                 phaseId = long.Parse(Request.Form["phaseId"]);
             }
             if (!string.IsNullOrEmpty(accountId) && !string.IsNullOrEmpty(projectId) && !string.IsNullOrEmpty(departmentId))
             {
                 var result = new TicketBLL().CopyToProject(ticketIds, long.Parse(projectId), long.Parse(departmentId), phaseId, LoginUserId);
                 ClientScript.RegisterStartupScript(this.GetType(), "提示信息", $"<script>alert('保存{(result ? "成功" : "失败")}!');self.opener.location.reload();window.close();</script>");
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "提示信息", $"<script>alert('必填参数丢失');</script>");
             }
         }
     }
     catch (Exception msg)
     {
         Response.Write($"<script>alert('{msg.Message}');window.close();</script>");
     }
 }
Ejemplo n.º 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var  insProId = Request.QueryString["insProId"];
            long id       = 0;

            if (!string.IsNullOrEmpty(insProId) && long.TryParse(insProId, out id))
            {
                thisInsPro = insProBll.GetById(id);
            }
            if (thisInsPro == null)
            {
                Response.Write("<script>alert('未获取到相关配置项!');window.close();</script>");
                return;
            }
            noCloseTicket = new DAL.sdk_task_dal().GetNoDoneByInsPro(thisInsPro.id);
            thisProduct   = new ProductBLL().GetProduct(thisInsPro.product_id);
            wareList      = new DAL.ivt_warehouse_dal().GetAllWareList();
            if (thisInsPro.account_id != null)
            {
                thisAccount = new CompanyBLL().GetCompany((long)thisInsPro.account_id);
                contactList = new ContactBLL().GetContactByCompany((long)thisInsPro.account_id);
            }
            if (thisInsPro.contract_id != null)
            {
                thisContract = new ContractBLL().GetContract((long)thisInsPro.contract_id);
            }
            var thisSubAllList = new DAL.crm_subscription_dal().GetSubByInsProId(thisInsPro.id);

            thisSubList = new InstalledProductBLL().ReturnSubIds(thisSubAllList);
            if (thisSubList != null && thisSubList.Count > 0)
            {
                thisSubList.ForEach(_ => {
                    subNames += _.name + ',';
                });
                if (!string.IsNullOrEmpty(subNames))
                {
                    subNames = subNames.Substring(0, subNames.Length - 1);
                }
            }

            if (IsPostBack)
            {
                var result = new InstalledProductBLL().SwapConfigItem(GetParam(), LoginUserId);
                Response.Write($"<script>self.opener.location.reload();alert('替换{(result?"成功":"失败")}!');window.close();</script>");
            }
        }
Ejemplo n.º 14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var accountId = Request.QueryString["accountId"];

            if (!string.IsNullOrEmpty(accountId))
            {
                account = comBll.GetCompany(long.Parse(accountId));
            }
            if (account == null)
            {
                Response.Write("<script>alert('为获取到客户信息');window.close();</script>");
                return;
            }
            accLocation = new crm_location_dal().GetLocationByAccountId(account.id);
            if (accLocation != null)
            {
                var disDal = new d_district_dal();
                if (accLocation.country_id != null)
                {
                    var country = new DAL.d_country_dal().FindById((long)accLocation.country_id);
                    countryName = country != null?country.country_name_display:"";
                }
                var province = disDal.FindById((long)accLocation.province_id);
                provinceName = province != null ? province.name : "";
                var city = disDal.FindById((long)accLocation.city_id);
                cityName = city != null ? city.name : "";
                var district = disDal.FindById((long)accLocation.district_id);
                districtName = district != null ? district.name : "";
            }
            subAccountList      = new crm_account_dal().GetSubsidiariesById(account.id);
            contactList         = new crm_contact_dal().GetContactByAccountId(account.id);
            oppoList            = new crm_opportunity_dal().FindOpHistoryByAccountId(account.id);
            companyUdfList      = udfBLL.GetUdf(DicEnum.UDF_CATE.COMPANY);
            companyUdfValueList = udfBLL.GetUdfValue(DicEnum.UDF_CATE.COMPANY, account.id, companyUdfList);
            insProList          = new crm_installed_product_dal().GetInsProAccoByProName(account.id);
            todoList            = new com_activity_dal().GetNoCompleteTodo(account.id);
            noteList            = new com_activity_dal().GetNoteByAccount(account.id);
            oppoUdfList         = udfBLL.GetUdf(DicEnum.UDF_CATE.OPPORTUNITY);


            //var arr = new string[][] { new string[] { "上海", "张耀", "1" }, new string[] { "北京", "张耀", "1" }, new string[] { "上海", "朱飞", "1" } };
            //var test = from i in Enumerable.Range(0, (int)arr.GetLongLength(0))
            //           from j in Enumerable.Range(0, (int)arr.GetLongLength(1))
            //           from k in Enumerable.Range(0, (int)arr.GetLongLength(2))
            //           select arr[i,j,k];
        }
Ejemplo n.º 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var ticketId = Request.QueryString["ticket_id"];

            if (!string.IsNullOrEmpty(ticketId))
            {
                thisTicket = new sdk_task_dal().FindNoDeleteById(long.Parse(ticketId));
            }

            if (thisTicket != null)
            {
                thisAccount = new CompanyBLL().GetCompany(thisTicket.account_id);
            }
            else
            {
                Response.Write("<script>alert('未查询到该工单信息!');window.close();</script>");
            }
        }
Ejemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var accountId = Request.QueryString["accountId"];

            if (!string.IsNullOrEmpty(accountId))
            {
                account = comBll.GetCompany(long.Parse(accountId));
            }
            if (account == null)
            {
                Response.Write("<script>alert('未获取到客户信息');window.close();</script>");
                return;
            }
            accLocation = new DAL.crm_location_dal().GetLocationByAccountId(account.id);
            if (accLocation != null)
            {
                var disDal = new DAL.d_district_dal();
                if (accLocation.country_id != null)
                {
                    var country = new DAL.d_country_dal().FindById((long)accLocation.country_id);
                    countryName = country != null ? country.country_name_display : "";
                }
                var province = disDal.FindById((long)accLocation.province_id);
                provinceName = province != null ? province.name : "";
                var city = disDal.FindById((long)accLocation.city_id);
                cityName = city != null ? city.name : "";
                var district = disDal.FindById((long)accLocation.district_id);
                districtName = district != null ? district.name : "";
            }
            if (account.resource_id != null)
            {
                accMan = new DAL.sys_resource_dal().FindNoDeleteById((long)account.resource_id);
            }
            startDate = DateTime.Parse(DateTime.Now.AddMonths(-1).ToString("yyyy-MM") + "-01");
            endDate   = startDate.AddMonths(1).AddDays(-1);

            contractMoney = new DAL.crm_account_deduction_dal().GetContractSum(account.id, startDate, endDate);
            projectMoney  = new DAL.crm_account_deduction_dal().GetProjectSum(account.id, startDate, endDate);
            if (account.classification_id != null)
            {
                accClass = new DAL.d_account_classification_dal().FindNoDeleteById((long)account.classification_id);
            }
        }
Ejemplo n.º 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var thisType   = Request.QueryString["thisType"];
                var account_id = Request.QueryString["account_id"];
                if (!string.IsNullOrEmpty(account_id))
                {
                    account = new CompanyBLL().GetCompany(long.Parse(account_id));
                }
                var resouIds       = Request.QueryString["resouIds"];
                var projectLeadIds = Request.QueryString["projectLeadIds"];
                if (!string.IsNullOrEmpty(resouIds))
                {
                    resouList = new sys_resource_dal().GetListByIds(resouIds);
                }

                var conIds = Request.QueryString["conIds"];
                if (!string.IsNullOrEmpty(conIds))
                {
                    conList = new crm_contact_dal().GetContactByIds(conIds);
                }

                var depIds = Request.QueryString["depIds"];
                if (!string.IsNullOrEmpty(depIds))
                {
                    depList = new sys_department_dal().GetDepartment($" and id in ({depIds})");
                }

                var workIds = Request.QueryString["workIds"];
                if (!string.IsNullOrEmpty(workIds))
                {
                    worList = new sys_workgroup_dal().GetList($" and id in ({workIds})");
                }
                otherEmail = Request.QueryString["otherEmail"];
            }
            catch (Exception)
            {
                Response.Write("");
                Response.End();
            }
        }
Ejemplo n.º 18
0
        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();
            }
        }
Ejemplo n.º 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var company_id = Convert.ToInt64(Request.QueryString["id"]);

                account = new CompanyBLL().GetCompany(company_id);
                if (account != null)
                {
                    site_udfList      = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.SITE);
                    site_udfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.SITE, company_id, site_udfList);
                }
                else
                {
                    Response.End();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 20
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();
     }
 }
Ejemplo n.º 21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var thisId = Request.QueryString["id"];

            if (!string.IsNullOrEmpty(thisId))
            {
                thisReport = new sdk_expense_report_dal().FindNoDeleteById(long.Parse(thisId));
            }
            if (thisReport == null)
            {
                Response.Write("<script>alert('报表已删除');window.close();</script>");
            }
            else
            {
                defAcc = cBLL.GetDefaultAccount();
                if (thisReport.status_id == (int)DTO.DicEnum.EXPENSE_REPORT_STATUS.REJECTED || thisReport.status_id == (int)DTO.DicEnum.EXPENSE_REPORT_STATUS.HAVE_IN_HAND)
                {
                    isSubmit = true;
                    if (thisReport.status_id == (int)DTO.DicEnum.EXPENSE_REPORT_STATUS.REJECTED)
                    {
                        isRefuse = true;
                    }
                }
                var isAtt = Request.QueryString["ShowAtt"];
                if (!string.IsNullOrEmpty(isAtt))
                {
                    isReport = false;
                }
                var isCk = Request.QueryString["isCheck"];
                if (!string.IsNullOrEmpty(isCk))
                {
                    isCheck = true;
                }
                attList = new com_attachment_dal().GetAttListByOid(thisReport.id);
                expList = new sdk_expense_dal().GetExpByReport(thisReport.id);
            }
        }
Ejemplo n.º 22
0
        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();
            }
        }
Ejemplo n.º 23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var thisId = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(thisId))
                {
                    thisExp = new sdk_expense_dal().FindNoDeleteById(long.Parse(thisId));
                    if (thisExp != null)
                    {
                        thisAcc = new CompanyBLL().GetCompany(thisExp.account_id);
                    }
                }

                if (thisExp == null || thisAcc == null)
                {
                    Response.Write("<script>alert('未找到该工时信息!');window.close();self.opener.location.reload();</script>");
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
Ejemplo n.º 24
0
        protected List <crm_quote_item> degressionItem    = null; // 成本的配置项
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                #region  拉框赋值
                stage_id.DataTextField  = "show";
                stage_id.DataValueField = "val";
                stage_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "opportunity_stage").Value;
                stage_id.DataBind();

                win_reason_type_id.DataTextField  = "show";
                win_reason_type_id.DataValueField = "val";
                win_reason_type_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "oppportunity_win_reason_type").Value;
                win_reason_type_id.DataBind();
                win_reason_type_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });

                resource_id.DataTextField  = "show";
                resource_id.DataValueField = "val";
                resource_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "sys_resource").Value;
                resource_id.DataBind();

                competitor_id.DataTextField  = "show";
                competitor_id.DataValueField = "val";
                competitor_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "competition").Value;
                competitor_id.DataBind();
                competitor_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });

                // period_type
                period_type.DataTextField  = "show";
                period_type.DataValueField = "val";
                period_type.DataSource     = dic.FirstOrDefault(_ => _.Key == "period_type").Value;
                period_type.DataBind();
                period_type.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });

                // notifi_temp 通知模板
                var tempList = new sys_notify_tmpl_dal().GetTempByEvent(DicEnum.NOTIFY_EVENT.OPPORTUNITY_CLOSED);
                notifi_temp.DataTextField  = "name";
                notifi_temp.DataValueField = "id";
                notifi_temp.DataSource     = tempList;
                notifi_temp.DataBind();
                #endregion
                var id         = Request.QueryString["id"];
                var account_id = Request.QueryString["account_id"];
                if (!string.IsNullOrEmpty(id))
                {
                    if (string.IsNullOrEmpty(account_id))
                    {
                        if (!IsPostBack)
                        {
                            opportunity_id.Enabled = false;
                        }
                    }
                    opportunity = new crm_opportunity_dal().GetOpportunityById(long.Parse(id));
                    if (opportunity != null)
                    {
                        account    = new CompanyBLL().GetCompany(opportunity.account_id);
                        account_id = account.id.ToString();
                    }
                }
                if (!string.IsNullOrEmpty(account_id))
                {
                    account = new CompanyBLL().GetCompany(long.Parse(account_id));
                    var oppoList = new crm_opportunity_dal().FindOpHistoryByAccountId(long.Parse(account_id));
                    if (oppoList != null && oppoList.Count > 0)
                    {
                        opportunity_id.DataTextField  = "name";
                        opportunity_id.DataValueField = "id";
                        opportunity_id.DataSource     = oppoList;
                        opportunity_id.DataBind();
                    }
                    else
                    {
                        Response.Write("<script>alert('该客户还没有商机!');window.close();</script>");
                    }

                    //opportunity_id.Items.Insert(0, new ListItem() { Value = "0", Text = "   ", Selected = true });
                    if (string.IsNullOrEmpty(id))
                    {
                        opportunity = oppoList[0];
                    }
                    opportunity_id.SelectedValue = opportunity.id.ToString();
                }

                if (!IsPostBack)
                {
                    if (opportunity != null)
                    {
                        if (opportunity.status_id == (int)OPPORTUNITY_STATUS.CLOSED)
                        {
                            Response.Write("<script>if(!confirm('商机已被关闭,如果继续,系统会重复创建计费项和合同?')){window.close();}</script>");
                        }
                    }
                    if (opportunity.stage_id != null)
                    {
                        stage_id.SelectedValue = opportunity.stage_id.ToString();
                    }
                    else
                    {
                        var stageList    = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.OPPORTUNITY_STATUS);
                        var defaultStage = stageList.FirstOrDefault(_ => _.ext1 == "1");
                        if (defaultStage != null)
                        {
                            stage_id.SelectedValue = defaultStage.id.ToString();
                        }
                    }
                    // stage_id.SelectedValue = opportunity.stage_id == null ? "0" : opportunity.stage_id.ToString();
                    resource_id.SelectedValue        = opportunity.resource_id.ToString();
                    competitor_id.SelectedValue      = opportunity.competitor_id == null ? "0" : opportunity.competitor_id.ToString();
                    win_reason_type_id.SelectedValue = opportunity.win_reason_type_id == null ? "0" : opportunity.win_reason_type_id.ToString();
                }
                // 折扣的下拉框不同于别的下拉框-- 需要去两个数据源去赋值
                StringBuilder text     = new StringBuilder();
                var           costCode = new d_cost_code_dal().GetListCostCode((int)COST_CODE_CATE.MATERIAL_COST_CODE);
                text.Append($"<option value='0'>   </option>");
                if (costCode != null && costCode.Count > 0)
                {
                    foreach (var item in costCode)
                    {
                        text.Append($"<option value='{item.id}'>{item.name}</option>");
                    }
                }
                codeSelect.Value = text.ToString();
                var disSource   = "";
                var disCostCode = costCode.Where(_ => _.id == (int)CostCode.NOTAXDISCOUNT || _.id == (int)CostCode.DISCOUNT).ToList();
                if (disCostCode != null && disCostCode.Count > 0)
                {
                    foreach (var item in disCostCode)
                    {
                        disSource += $"<option value='{item.id}'>{item.name}</option>";
                    }
                }
                disCodeSelct.Value        = disSource;
                period_type.SelectedValue = ((int)QUOTE_ITEM_PERIOD_TYPE.MONTH).ToString();
                primaryQuote = new QuoteBLL().GetPrimaryQuote(opportunity.id);


                if (primaryQuote != null)
                {
                    if (!IsPostBack)
                    {
                        if (primaryQuote.project_id != null) // 判断该报价是否关联项目提案,如果关联,默认选中,不关联,灰掉,不可选
                        {
                            activeproject.Checked = true;
                            activeproject.Enabled = true;
                            addRequest.Enabled    = false;
                            isaddRequest.Value    = "1";
                        }
                        else
                        {
                            activeproject.Checked = false;
                            addRequest.Enabled    = true;

                            activeproject.Enabled = false;
                            isactiveproject.Value = "1";
                        }
                    }
                    quoteItemList = new crm_quote_item_dal().GetQuoteItems($" and quote_id = {primaryQuote.id}");
                    if (quoteItemList != null && quoteItemList.Count > 0)
                    {
                        // 如果报价项中包含了服务 / 服务包、初始费用,则可以选中(默认不选)
                        // 此功能需要具有合同模块权限以及修改合同服务/包权限

                        var isServiceChargeItem = quoteItemList.Where(_ => _.type_id == (int)QUOTE_ITEM_TYPE.SERVICE || _.type_id == (int)QUOTE_ITEM_TYPE.SERVICE_PACK || _.type_id == (int)QUOTE_ITEM_TYPE.START_COST).ToList();
                        if (!IsPostBack)
                        {
                            if (isServiceChargeItem != null && isServiceChargeItem.Count > 0)
                            {
                                // todo--需要判断用户权限
                            }
                            else
                            {
                                addContractRequest.Enabled  = false;
                                isAddContractRequest.Value  = "1";
                                addContractServices.Enabled = false;
                                isaddContractServices.Value = "1";
                            }
                        }
                        proAndOneTimeItem = quoteItemList.Where(_ => _.optional != 1).Where(_ => _.type_id == (int)QUOTE_ITEM_TYPE.PRODUCT || _.type_id == (int)QUOTE_ITEM_TYPE.DISCOUNT).ToList();
                        if (!IsPostBack)
                        {
                            if (proAndOneTimeItem != null && proAndOneTimeItem.Count > 0)
                            {
                                isIncludePO.Checked = true;
                            }
                            else
                            {
                                IncludePO.Value     = "1";
                                isIncludePO.Enabled = false;
                            }
                        }
                        shipItem = quoteItemList.Where(_ => _.type_id == (int)QUOTE_ITEM_TYPE.DISTRIBUTION_EXPENSES && _.optional != 1).ToList();
                        if (!IsPostBack)
                        {
                            if (shipItem != null && shipItem.Count > 0)
                            {
                                isIncludeShip.Checked = true;
                            }
                            else
                            {
                                IncludeShip.Value     = "1";
                                isIncludeShip.Enabled = false;
                            }
                        }
                        degressionItem = quoteItemList.Where(_ => _.type_id == (int)QUOTE_ITEM_TYPE.DEGRESSION & _.optional != 1).ToList();
                        if (!IsPostBack)
                        {
                            if (degressionItem != null && degressionItem.Count > 0)
                            {
                                isIncludeCharges.Checked = true;
                            }
                            else
                            {
                                IncludeCharges.Value     = "1";
                                isIncludeCharges.Enabled = false;
                            }
                        }
                        jqueryCode.Value = ReturnJquery();
                    }
                    else
                    {
                        // activeproject.Enabled = false;
                        //isactiveproject.Value = "1";
                        addContractRequest.Enabled  = false;
                        isAddContractRequest.Value  = "1";
                        addContractServices.Enabled = false;
                        isaddContractServices.Value = "1";
                        IncludePO.Value             = "1";
                        isIncludePO.Enabled         = false;
                        IncludeShip.Value           = "1";
                        isIncludeShip.Enabled       = false;
                        IncludeCharges.Value        = "1";
                        isIncludeCharges.Enabled    = false;
                    }
                }
                else
                {
                    activeproject.Enabled       = false;
                    isactiveproject.Value       = "1";
                    addContractRequest.Enabled  = false;
                    isAddContractRequest.Value  = "1";
                    addContractServices.Enabled = false;
                    isaddContractServices.Value = "1";
                    IncludePO.Value             = "1";
                    isIncludePO.Enabled         = false;
                    IncludeShip.Value           = "1";
                    isIncludeShip.Enabled       = false;
                    IncludeCharges.Value        = "1";
                    isIncludeCharges.Enabled    = false;
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }
Ejemplo n.º 25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            udfList      = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.CONTRACTS);
            resourceList = new DAL.sys_resource_dal().GetSourceList();
            roleList     = new DAL.sys_role_dal().GetList();
            long quoteId = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["quoteId"]) && long.TryParse(Request.QueryString["quoteId"], out quoteId))
            {
                quote = new QuoteBLL().GetQuote(quoteId);
                if (quote != null)
                {
                    account = new CompanyBLL().GetCompany(quote.account_id);
                }
            }

            if (IsPostBack)
            {
                ContractAddDto dto = new ContractAddDto();
                dto.contract = AssembleModel <ctt_contract>();

                if (!string.IsNullOrEmpty(Request.Form["isSdtDefault"]) && Request.Form["isSdtDefault"].Equals("on"))
                {
                    dto.contract.is_sdt_default = 1;
                }

                if (!string.IsNullOrEmpty(Request.Form["needTimeSheet"]) && Request.Form["needTimeSheet"].Equals("on"))
                {
                    dto.contract.timeentry_need_begin_end = 1;
                }
                else
                {
                    dto.contract.timeentry_need_begin_end = 0;
                }

                if (dto.contract.type_id == (int)DicEnum.CONTRACT_TYPE.BLOCK_HOURS)
                {
                    if (!string.IsNullOrEmpty(Request.Form["enableOverage"]) && Request.Form["enableOverage"].Equals("on"))
                    {
                        dto.contract.enable_overage_billing_rate = 1;
                    }
                }

                if (dto.contract.type_id == (int)DicEnum.CONTRACT_TYPE.FIXED_PRICE)
                {
                    if (!string.IsNullOrEmpty(Request.Form["applyPayment"]) && Request.Form["applyPayment"].Equals("on"))
                    {
                        decimal price = 0;
                        if (decimal.TryParse(Request.Form["alreadyReceived"], out price) && price > 0)
                        {
                            dto.alreadyReceived = price;
                        }
                        if (decimal.TryParse(Request.Form["toBeInvoiced"], out price) && price > 0)
                        {
                            dto.toBeInvoiced = price;
                        }
                        long code = 0;
                        if (long.TryParse(Request.Form["defaultCostCode"], out code))
                        {
                            dto.defaultCostCode = code;
                        }
                    }
                }

                if (udfList != null && udfList.Count > 0)                      // 首先判断是否有自定义信息
                {
                    var list = new List <UserDefinedFieldValue>();
                    foreach (var udf in udfList)                            // 循环添加
                    {
                        var new_udf = new UserDefinedFieldValue()
                        {
                            id    = udf.id,
                            value = Request.Form[udf.id.ToString()] == "" ? null : Request.Form[udf.id.ToString()],
                        };
                        list.Add(new_udf);
                    }
                    dto.udf = list;
                }

                // 服务
                dto.serviceList = new List <ServiceInfoDto>();
                if (dto.contract.type_id == (int)DicEnum.CONTRACT_TYPE.SERVICE)
                {
                    if (!string.IsNullOrEmpty(Request.Form["AddServiceIds"]))   // 服务
                    {
                        string[] ids = Request.Form["AddServiceIds"].Split(',');
                        foreach (string id in ids)
                        {
                            ServiceInfoDto si = new ServiceInfoDto();
                            si.price     = decimal.Parse(Request.Form["price" + id]);
                            si.number    = decimal.Parse(Request.Form["num" + id]);
                            si.serviceId = long.Parse(id);
                            si.type      = 1;
                            dto.serviceList.Add(si);
                        }
                    }
                    if (!string.IsNullOrEmpty(Request.Form["AddSerBunIds"]))    // 服务包
                    {
                        string[] ids = Request.Form["AddSerBunIds"].Split(',');
                        foreach (string id in ids)
                        {
                            ServiceInfoDto si = new ServiceInfoDto();
                            si.price     = decimal.Parse(Request.Form["price" + id]);
                            si.number    = decimal.Parse(Request.Form["num" + id]);
                            si.serviceId = long.Parse(id);
                            si.type      = 2;
                            dto.serviceList.Add(si);
                        }
                    }
                }

                // 里程碑
                dto.milestone = new List <ctt_contract_milestone>();
                if (dto.contract.type_id == (int)DicEnum.CONTRACT_TYPE.FIXED_PRICE && (!string.IsNullOrEmpty(Request.Form["milestoneAddList"])))
                {
                    string[] ids = Request.Form["milestoneAddList"].Split(',');
                    foreach (string id in ids)
                    {
                        ctt_contract_milestone mil = new ctt_contract_milestone();
                        mil.name        = Request.Form["MilName" + id];
                        mil.description = Request.Form["MilDetail" + id];
                        decimal dollar = 0;
                        if (!decimal.TryParse(Request.Form["MilAmount" + id], out dollar))
                        {
                            dollar = 0;
                        }
                        mil.dollars      = dollar;
                        mil.due_date     = DateTime.Parse(Request.Form["MilDate" + id]);
                        mil.cost_code_id = long.Parse(Request.Form["MilCode" + id]);
                        mil.status_id    = int.Parse(Request.Form["isBill" + id]);
                        dto.milestone.Add(mil);
                    }
                }

                // 角色费率
                dto.rateList = new List <ContractRateDto>();
                if (dto.contract.type_id != (int)DicEnum.CONTRACT_TYPE.SERVICE &&
                    dto.contract.type_id != (int)DicEnum.CONTRACT_TYPE.PER_TICKET)
                {
                    foreach (var role in roleList)
                    {
                        if (Request.Form["cbRoleRate" + role.id] != null && Request.Form["cbRoleRate" + role.id].Equals("on"))
                        {
                            var roleRate = new ContractRateDto();
                            roleRate.roleId = role.id;
                            roleRate.rate   = decimal.Parse(Request.Form["txtRoleRate" + role.id]);
                            dto.rateList.Add(roleRate);
                        }
                    }
                }

                // 邮件通知
                dto.notifyUserIds = new List <long>();
                foreach (var res in resourceList)
                {
                    if (Request.Form["notify" + res.id] != null && Request.Form["notify" + res.id].Equals("on"))
                    {
                        dto.notifyUserIds.Add(res.id);
                    }
                }
                if (dto.notifyUserIds.Count != 0)
                {
                    dto.notifySubject = Request.Form["notifyTitle"];
                    dto.notifyMessage = Request.Form["notifyContent"];
                    dto.notifyEmails  = Request.Form["notifyEmails"];
                }

                contractId   = bll.Insert(dto, GetLoginUserId());
                contractType = dto.contract.type_id;
                isFinish     = 1;
            }
            else
            {
                if (!int.TryParse(Request.QueryString["type"], out contractType))
                {
                    contractType = 0;
                }
                isFinish = 0;
            }

            Dictionary <string, object> dics = bll.GetField();

            contractCate = dics["cate"] as List <DictionaryEntryDto>;
            periodType   = dics["periodType"] as List <DictionaryEntryDto>;
            periodType.Remove(periodType.Find(pt => pt.val.Equals(((int)DicEnum.QUOTE_ITEM_PERIOD_TYPE.ONE_TIME).ToString())));
            billPostType = dics["billPostType"] as List <DictionaryEntryDto>;
            slaList      = bll.GetSLAList();

            contractTypeName = bll.GetContractTypeName(contractType);
        }
Ejemplo n.º 26
0
        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>");
            }
        }
Ejemplo n.º 27
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();
            }
        }
Ejemplo n.º 28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
            #region  拉框赋值
            CallBack = Request.QueryString["CallBack"];
            var dic = new CompanyBLL().GetField();

            // 分类类别
            classification.DataTextField  = "show";
            classification.DataValueField = "val";
            classification.DataSource     = dic.FirstOrDefault(_ => _.Key == "classification").Value;
            classification.DataBind();
            classification.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "   ", Selected = true
            });
            // 公司类型
            company_type.DataTextField  = "show";
            company_type.DataValueField = "val";
            company_type.DataSource     = dic.FirstOrDefault(_ => _.Key == "company_type").Value;
            company_type.DataBind();
            company_type.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "   ", Selected = true
            });

            // 市场领域
            market_segment.DataTextField  = "show";
            market_segment.DataValueField = "val";
            market_segment.DataSource     = dic.FirstOrDefault(_ => _.Key == "market_segment").Value;
            market_segment.DataBind();
            market_segment.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "   ", Selected = true
            });
            // 销售区域
            territory_name.DataTextField  = "show";
            territory_name.DataValueField = "val";
            territory_name.DataSource     = dic.FirstOrDefault(_ => _.Key == "territory").Value;
            territory_name.DataBind();
            territory_name.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "   ", Selected = true
            });
            // 客户经理
            account_manage.DataTextField  = "show";
            account_manage.DataValueField = "val";
            account_manage.DataSource     = dic.FirstOrDefault(_ => _.Key == "sys_resource").Value;
            account_manage.DataBind();
            account_manage.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "   ", Selected = true
            });
            // 税区
            tax_region.DataTextField  = "show";
            tax_region.DataValueField = "val";
            tax_region.DataSource     = dic.FirstOrDefault(_ => _.Key == "taxRegion").Value;
            tax_region.DataBind();
            tax_region.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "   ", Selected = true
            });
            // 竞争对手
            competitor.DataTextField  = "show";
            competitor.DataValueField = "val";
            competitor.DataSource     = dic.FirstOrDefault(_ => _.Key == "competition").Value;
            competitor.DataBind();
            competitor.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "   ", Selected = true
            });
            // 称谓
            sufix.DataTextField  = "show";
            sufix.DataValueField = "val";
            sufix.DataSource     = dic.FirstOrDefault(_ => _.Key == "sufix").Value;
            sufix.DataBind();
            sufix.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "   ", Selected = true
            });

            // note_action_type
            note_action_type.DataTextField  = "show";
            note_action_type.DataValueField = "val";
            note_action_type.DataSource     = dic.FirstOrDefault(_ => _.Key == "action_type").Value;
            note_action_type.DataBind();
            note_action_type.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "   ", Selected = true
            });

            // todo_action_type
            //todo_action_type.DataTextField = "show";
            //todo_action_type.DataValueField = "val";
            //todo_action_type.DataSource = dic.FirstOrDefault(_ => _.Key == "action_type").Value;
            //todo_action_type.DataBind();
            //todo_action_type.Items.Insert(0, new ListItem() { Value = "0", Text = "   ", Selected = true });
            #endregion
            try
            {
                var parent_id = Request.QueryString["parent_id"];
                if (!string.IsNullOrEmpty(parent_id))
                {
                    parent_account = new CompanyBLL().GetCompany(Convert.ToInt64(parent_id));
                    if (parent_account != null && parent_account.parent_id == null)
                    {
                    }
                    else
                    {
                        Response.End();
                    }
                }
                else
                {
                    searchCompany = new crm_account_dal().GetSubCompanys();
                }
            }
            catch (Exception)
            {
                throw;
            }

            company_udfList = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.COMPANY);
            contact_udfList = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.CONTACT);
            site_udfList    = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.SITE);
        }
Ejemplo n.º 29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    Bind();  // 绑定页面下拉数据
                }
                CallBack = Request.QueryString["CallBack"];

                var accountId = Request.QueryString["account_id"];
                if (!string.IsNullOrEmpty(accountId))
                {
                    thisAccount = new CompanyBLL().GetCompany(long.Parse(accountId));
                }
                var contractId = Request.QueryString["contract_id"];
                if (!string.IsNullOrEmpty(contractId))
                {
                    thisContract = new ctt_contract_dal().FindNoDeleteById(long.Parse(contractId));
                }
                var insProId = Request.QueryString["insProId"];
                if (!string.IsNullOrEmpty(insProId))
                {
                    insPro = new crm_installed_product_dal().FindNoDeleteById(long.Parse(insProId));
                    if (insPro != null && insPro.account_id != null)
                    {
                        thisAccount = new CompanyBLL().GetCompany((long)insPro.account_id);
                    }
                }

                var taskId = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(taskId))
                {
                    thisTicket = new sdk_task_dal().FindNoDeleteById(long.Parse(taskId));
                    if (thisTicket != null)
                    {
                        thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
                        var isCopyString = Request.QueryString["isCopy"];
                        if (string.IsNullOrEmpty(isCopyString))
                        {
                            isAdd = false;
                        }
                        else
                        {
                            isCopy = true;
                        }
                        if (!IsPostBack)
                        {
                            cate_id.ClearSelection();
                            cate_id.SelectedValue             = thisTicket.cate_id.ToString();
                            this.ticket_type_id.SelectedValue = thisTicket.ticket_type_id.ToString();
                            this.status_id.SelectedValue      = thisTicket.status_id.ToString();
                            if (isCopy)
                            {
                                this.status_id.ClearSelection(); this.status_id.SelectedValue = ((int)DicEnum.TICKET_STATUS.NEW).ToString();
                            }
                            if (thisTicket.priority_type_id != null)
                            {
                                priority_type_id.SelectedValue = thisTicket.priority_type_id.ToString();
                            }
                            if (thisTicket.issue_type_id != null)
                            {
                                issue_type_id.SelectedValue = thisTicket.issue_type_id.ToString();
                            }
                            if (thisTicket.source_type_id != null)
                            {
                                source_type_id.SelectedValue = thisTicket.source_type_id.ToString();
                            }
                            if (thisTicket.issue_type_id != null)
                            {
                                issue_type_id.SelectedValue = thisTicket.issue_type_id.ToString();
                            }
                            if (thisTicket.sla_id != null)
                            {
                                sla_id.SelectedValue = thisTicket.sla_id.ToString();
                            }
                            if (thisTicket.department_id != null)
                            {
                                department_id.SelectedValue = thisTicket.department_id.ToString();
                            }
                        }
                        ticketUdfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.TASK, thisTicket.id, tickUdfList);

                        thisAccount = new CompanyBLL().GetCompany(thisTicket.account_id);
                        if (thisTicket.contact_id != null)
                        {
                            thisContact = new crm_contact_dal().FindNoDeleteById((long)thisTicket.contact_id);
                        }

                        if (thisTicket.owner_resource_id != null && thisTicket.role_id != null)
                        {
                            var resDepList = new sys_resource_department_dal().GetResDepByResAndRole((long)thisTicket.owner_resource_id, (long)thisTicket.role_id);
                            if (resDepList != null && resDepList.Count > 0)
                            {
                                proResDep = resDepList[0];
                                priRes    = new sys_resource_dal().FindNoDeleteById((long)thisTicket.owner_resource_id);
                            }
                        }

                        if (thisTicket.installed_product_id != null)
                        {
                            insPro = new crm_installed_product_dal().FindNoDeleteById((long)thisTicket.installed_product_id);
                        }

                        if (thisTicket.contract_id != null)
                        {
                            thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisTicket.contract_id);
                        }

                        if (thisTicket.cost_code_id != null)
                        {
                            thisCostCode = new d_cost_code_dal().FindNoDeleteById((long)thisTicket.cost_code_id);
                        }
                        var otherResList = new sdk_task_resource_dal().GetTaskResByTaskId(thisTicket.id);
                        if (otherResList != null && otherResList.Count > 0)
                        {
                            foreach (var item in otherResList)
                            {
                                if (item.resource_id != null && item.role_id != null)
                                {
                                    var resDepList = new sys_resource_department_dal().GetResDepByResAndRole((long)item.resource_id, (long)item.role_id);
                                    if (resDepList != null && resDepList.Count > 0)
                                    {
                                        ticketResIds += resDepList[0].id + ",";
                                    }
                                }
                            }

                            if (ticketResIds != "")
                            {
                                ticketResIds = ticketResIds.Substring(0, ticketResIds.Length - 1);
                            }
                        }

                        ticketCheckList = new sdk_task_checklist_dal().GetCheckByTask(thisTicket.id);
                        if (ticketCheckList != null && ticketCheckList.Count > 0)
                        {
                            ticketCheckList = ticketCheckList.OrderBy(_ => _.sort_order).ToList();
                        }
                        #region 时间轴显示相关 工单备注类型获取
                        var    slaValue     = new sdk_task_dal().GetSlaTime(thisTicket);
                        string slaTimeValue = "";
                        if (slaValue != null)
                        {
                            slaTimeValue = slaValue.ToString();
                        }
                        if (!string.IsNullOrEmpty(slaTimeValue))
                        {
                            if (slaTimeValue.Substring(0, 1) == "{")
                            {
                                slaDic = new EMT.Tools.Serialize().JsonToDictionary(slaTimeValue);
                            }
                        }
                        var actList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.ACTION_TYPE);
                        if (actList != null && actList.Count > 0)
                        {
                            ticketNoteTypeList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList();
                        }
                        #endregion
                        entryList = new sdk_work_entry_dal().GetList(thisTicket.id);
                    }
                }


                var ticket_type_id = Request.QueryString["ticket_type_id"];
                if (!string.IsNullOrEmpty(ticket_type_id))
                {
                    this.ticket_type_id.ClearSelection();
                    this.ticket_type_id.SelectedValue = ticket_type_id;
                }
            }
            catch (Exception msg)
            {
                Response.Write("<script>alert('" + msg.Message + "');window.close();</script>");
            }
        }
Ejemplo n.º 30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                thisBookMark  = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
                callBackFiled = Request.QueryString["callBackFiled"];

                var opportunity_id = Request.QueryString["opportunity_id"];
                if (!string.IsNullOrEmpty(opportunity_id))
                {
                    if (AuthBLL.GetUserOppAuth(LoginUserId, LoginUser.security_Level_id, Convert.ToInt64(opportunity_id)).CanEdit == false)
                    {
                        Response.End();
                        return;
                    }

                    opportunity = new crm_opportunity_dal().GetOpportunityById(Convert.ToInt64(opportunity_id));
                }
                dic = new OpportunityBLL().GetField();

                #region 配置下拉框的数据源
                // 商机负责人
                resource_id.DataTextField  = "show";
                resource_id.DataValueField = "val";
                resource_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "sys_resource").Value;
                resource_id.DataBind();
                resource_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });
                // 当前阶段
                stage_id.DataTextField  = "show";
                stage_id.DataValueField = "val";
                stage_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "opportunity_stage").Value;
                stage_id.DataBind();
                stage_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });
                stage_id.SelectedValue = ((int)OPPORTUNITY_STAGE.NEW_CLUE).ToString();
                // 感兴趣等级
                interest_degree_id.DataTextField  = "show";
                interest_degree_id.DataValueField = "val";
                interest_degree_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "opportunity_interest_degree").Value;
                interest_degree_id.DataBind();
                interest_degree_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });
                // 商机来源
                source_id.DataTextField  = "show";
                source_id.DataValueField = "val";
                source_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "opportunity_source").Value;
                source_id.DataBind();
                source_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });
                // 状态
                status_id.DataTextField  = "show";
                status_id.DataValueField = "val";
                status_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "oppportunity_status").Value;
                status_id.DataBind();
                status_id.SelectedValue = ((int)OPPORTUNITY_STATUS.ACTIVE).ToString();
                //status_id.Items.Insert(0, new ListItem() { Value = "0", Text = "   ", Selected = true });
                // 主要竞争对手
                competitor_id.DataTextField  = "show";
                competitor_id.DataValueField = "val";
                competitor_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "competition").Value;
                competitor_id.DataBind();
                competitor_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });
                // 赢单原因
                win_reason_type_id.DataTextField  = "show";
                win_reason_type_id.DataValueField = "val";
                win_reason_type_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "oppportunity_win_reason_type").Value;
                win_reason_type_id.DataBind();
                win_reason_type_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });
                // 丢单原因
                loss_reason_type_id.DataTextField  = "show";
                loss_reason_type_id.DataValueField = "val";
                loss_reason_type_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "oppportunity_loss_reason_type").Value;
                loss_reason_type_id.DataBind();
                loss_reason_type_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });
                // 通知模板   --todo 需要过滤商机创建或编辑相关的通知模板
                //notify_tmpl_id.DataTextField = "show";
                //notify_tmpl_id.DataValueField = "val";
                //notify_tmpl_id.DataSource = dic.FirstOrDefault(_ => _.Key == "notify_tmpl").Value;
                //notify_tmpl_id.DataBind();
                //notify_tmpl_id.Items.Insert(0, new ListItem() { Value = "0", Text = "   ", Selected = true });


                var formTemplateList = new FormTemplateBLL().GetTemplateOpportunityByUser(GetLoginUserId());
                formTemplate.DataTextField  = "speed_code";
                formTemplate.DataValueField = "id";
                formTemplate.DataSource     = formTemplateList;
                formTemplate.DataBind();
                formTemplate.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });
                #endregion


                opportunity_udfList = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.OPPORTUNITY);
                if (opportunity != null)
                {
                    isAdd = false;

                    //company_udfList = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.COMPANY);
                }

                if (!isAdd)
                {
                    opportunity_udfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.OPPORTUNITY, opportunity.id, opportunity_udfList);
                    if (!IsPostBack)
                    {
                        resource_id.SelectedValue         = opportunity.resource_id.ToString();
                        stage_id.SelectedValue            = opportunity.stage_id == null ? "0" : opportunity.stage_id.ToString();
                        interest_degree_id.SelectedValue  = opportunity.interest_degree_id == null ? "0" : opportunity.interest_degree_id.ToString();
                        source_id.SelectedValue           = opportunity.source_id == null ? "0" : opportunity.source_id.ToString();
                        status_id.SelectedValue           = opportunity.status_id == null ? "0" : opportunity.status_id.ToString();
                        competitor_id.SelectedValue       = opportunity.competitor_id == null ? "0" : opportunity.competitor_id.ToString();
                        win_reason_type_id.SelectedValue  = opportunity.win_reason_type_id == null ? "0" : opportunity.win_reason_type_id.ToString();
                        loss_reason_type_id.SelectedValue = opportunity.loss_reason_type_id == null ? "0" : opportunity.loss_reason_type_id.ToString();


                        is_use_quote.Checked = opportunity.use_quote == 1;
                    }
                }
                else
                {
                    //  联系人查看的时候穿过来客户ID,和联系人ID,联系人不能更改,只有更改客户才可以更改联系人
                    var contact_id = Request.QueryString["oppo_contact_id"];
                    if (!string.IsNullOrEmpty(contact_id))
                    {
                        contact = new ContactBLL().GetContact(Convert.ToInt64(contact_id));
                    }

                    var account_id = Request.QueryString["oppo_account_id"];
                    if (!string.IsNullOrEmpty(account_id))
                    {
                        account = new CompanyBLL().GetCompany(Convert.ToInt64(account_id));
                    }
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }