Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
     artList      = new KnowledgeBLL().GetArtList();
     if (artList == null)
     {
         artList = new List <sdk_kb_article>();
     }
 }
Exemplo n.º 2
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>");
                }
            }
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            thisBookMark  = new IndexBLL().GetSingBook(Request.Url.LocalPath, LoginUserId);
            refreshMin    = Request.QueryString["refreshMin"];
            allTicketList = ticBll.GetAllTicket();
            countDic      = ticBll.GetServiceDeskCount();
            if (allTicketList != null && allTicketList.Count > 0)
            {
                classTickDic = allTicketList.GroupBy(_ =>
                {
                    long classId = 0; var acc = comBll.GetCompany(_.account_id);
                    if (acc != null)
                    {
                        classId = acc.classification_id ?? 0;
                    }
                    return(classId);
                }).OrderBy(_ => _.Key).ToDictionary(_ => _.Key, _ => _.ToList());
                productTickDic = allTicketList.GroupBy(_ =>
                {
                    long productId = 0;
                    if (_.installed_product_id != null)
                    {
                        var insPro = insProBll.GetById((long)_.installed_product_id);
                        if (insPro != null)
                        {
                            productId = insPro.product_id;
                        }
                    }
                    return(productId);
                }).OrderBy(_ => _.Key).ToDictionary(_ => _.Key, _ => _.ToList());
            }
            // {"row":8,"t1":"t","col1":"71,72","col2":"71,72,73"}
            var ticketLimtJson = "{\"row\":\"8\",\"t1\":\"t\",\"col1\":\"71,72\",\"col2\":\"71,72,73\"}";
            var ticketLimitSql = Convert.ToString(new DAL.sdk_task_dal().GetSingle($"select f_rpt_getsql_limit('{ticketLimtJson}',{LoginUserId.ToString()})"));
            var limitTicket    = new DAL.v_ticket_dal().FindListBySql("SELECT * from v_ticket t where t.type_id = 1809 " + ticketLimitSql);
            var resIdList      = ticBll.ReturnResIdsByTicket(limitTicket);

            if (resIdList != null && resIdList.Count > 0 && resList != null && resList.Count > 0)
            {
                limitResList = new List <sys_resource>();
                resIdList.ForEach(_ =>
                {
                    var thisRes = resList.FirstOrDefault(r => r.id.ToString() == _);
                    if (thisRes != null)
                    {
                        limitResList.Add(thisRes);
                    }
                });
            }
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
            var groupId = Request.QueryString["groupId"];

            if (!string.IsNullOrEmpty(groupId))
            {
                thisGroup = new ContactBLL().GetGroupById(long.Parse(groupId));
            }

            if (thisGroup == null)
            {
                Response.Write("<script>alert('为获取到相应联系人组');window.close();</script>");
            }
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
            id           = Convert.ToInt32(Request.QueryString["id"]);
            if (!string.IsNullOrEmpty(Request.QueryString["op"]))
            {
                op = Request.QueryString["op"];
            }
            if (!IsPostBack)
            {
                Bind();
                if (id > 0)
                {
                    var tem = temp.GetQuoteTemplate(id);
                    this.Name.Text = tem.name;
                    if (tem.description != null)
                    {
                        this.Description.Text = tem.description;
                    }
                    if (tem.is_active != 1)
                    {
                        this.Active.Checked = false;
                    }
                    this.DateFormat.SelectedValue              = tem.date_display_format_id.ToString();
                    this.NumberFormat.SelectedValue            = tem.number_display_format_id.ToString();
                    this.CurrencyPositivePattern.SelectedValue = tem.currency_positive_format_id.ToString();
                    this.CurrencyNegativePattern.SelectedValue = tem.currency_negative_format_id.ToString();
                    this.Payment_terms.SelectedValue           = tem.payment_term_id.ToString();
                    switch (tem.page_number_location_id)
                    {
                    case (int)PAGE_NUMBER_LOCATION.NO: this.showNO.Checked = true; break;

                    case (int)PAGE_NUMBER_LOCATION.BOTTOMLEFT: this.showLeft.Checked = true; break;

                    case (int)PAGE_NUMBER_LOCATION.BOTTOMCENTER: this.showCenter.Checked = true; break;

                    case (int)PAGE_NUMBER_LOCATION.BOTTOMRIGHT: this.showRight.Checked = true; break;
                    }
                    switch (tem.paper_size_id)
                    {
                    case (int)PAGE_SIZE.LETTER: this.Letter.Checked = true; break;

                    case (int)PAGE_SIZE.A4: this.A4.Checked = true; break;
                    }
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 书签
        /// </summary>
        public bool BookMarkManage(string url, string title, long userId)
        {
            var sbDal   = new sys_bookmark_dal();
            var oldBook = sbDal.GetSingBook(url, userId);

            if (oldBook == null)
            {
                oldBook                = new sys_bookmark();
                oldBook.id             = sbDal.GetNextIdCom();
                oldBook.create_time    = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
                oldBook.create_user_id = userId;
                oldBook.url            = url;
                oldBook.title          = title;
                sbDal.Insert(oldBook);
            }
            else
            {
                return(sbDal.DeleteBook(oldBook.id.ToString(), userId));
            }
            return(true);
        }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath, LoginUserId);
            const string proLimitJson    = "{\"row\":\"7\",\"t1\":\"p\",\"col1\":\"0\",\"col2\":\"0\"}";
            var          projectLimitSql = Convert.ToString(ppDal.GetSingle($"select f_rpt_getsql_limit('{proLimitJson}',{LoginUserId.ToString()})"));


            myProjectList = ppDal.FindListBySql <pro_project>($"SELECT p.id,p.name from pro_project p where p.delete_time = 0 and p.owner_resource_id = {LoginUserId.ToString()} and p.status_id not in(1345,1352) " + projectLimitSql);
            //

            myTeamProjectList = ppDal.FindListBySql <pro_project>($"SELECT DISTINCT p.id,p.name from pro_project p INNER JOIN pro_project_team ppt on p.id =ppt.project_id where p.delete_time =0 and ppt.delete_time = 0 and ppt.resource_id ={LoginUserId.ToString()} and p.status_id not in(1345,1352) " + projectLimitSql);

            myDepProjectList = ppDal.FindListBySql <pro_project>($"SELECT p.id,p.name from pro_project p where p.delete_time = 0 and p.owner_resource_id = {LoginUserId.ToString()} and p.status_id not in(1345,1352) and p.department_id in ( SELECT DISTINCT department_id from sys_resource_department) " + projectLimitSql);

            // SELECT DISTINCT owner_resource_id from pro_project where delete_time =0 and owner_resource_id is not NULL
            var    priResIds = ppDal.GetRes($"SELECT DISTINCT owner_resource_id from pro_project p where p.delete_time =0 and p.owner_resource_id is not NULL " + projectLimitSql);
            var    otherIds  = ppDal.GetRes($"SELECT DISTINCT ppt.resource_id from pro_project p INNER JOIN pro_project_team ppt on p.id =ppt.project_id where p.delete_time =0 and ppt.delete_time = 0 and ppt.resource_id is not null " + projectLimitSql);
            string ids       = string.Empty;

            if (priResIds != null && priResIds.Count > 0)
            {
                priResIds.ForEach(_ => { ids += _.ToString() + ','; });
            }
            if (otherIds != null && otherIds.Count > 0)
            {
                otherIds.ForEach(_ => { ids += _.ToString() + ','; });
            }
            if (!string.IsNullOrEmpty(ids))
            {
                ids     = ids.Substring(0, ids.Length - 1);
                resList = new DAL.sys_resource_dal().GetListByIds(ids);
                if (resList != null && resList.Count > 0)
                {
                    resList = resList.Distinct().ToList();
                }
            }

            openIssueCount = Convert.ToInt32(ppDal.GetSingle("SELECT count(1) from sdk_task st INNER join pro_project p on st.project_id = p.id  where st.delete_time = 0 and p.delete_time = 0 and st.is_project_issue=1 and st.status_id <> 1894 and p.status_id <> 1352 "));
        }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var id = Request.QueryString["id"];
                thisTask = new sdk_task_dal().FindNoDeleteById(long.Parse(id));
                if (thisTask != null && thisTask.project_id != null)
                {
                    thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath + "?id=" + id, LoginUserId);
                    tvbDto.Add(new DictionaryEntryDto("type", "类型", 0));
                    tvbDto.Add(new DictionaryEntryDto("time", "操作时间", 0));
                    tvbDto.Add(new DictionaryEntryDto("resouName", "员工", 0));
                    tvbDto.Add(new DictionaryEntryDto("workHours", "实际工作时间", 0));
                    tvbDto.Add(new DictionaryEntryDto("notTiltle", "说明/标题", 0));
                    tvbDto.Add(new DictionaryEntryDto("billabled", "是否计费", 0));
                    tvbDto.Add(new DictionaryEntryDto("billed", "已计费", 0));

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


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

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

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

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

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

                                orderFile.select = orderFile != null ? 1 : orderFile.select;
                            }
                        }
                    }
                    #endregion
                }
                else
                {
                    Response.End();
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }
Exemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                // var account_id = Request.QueryString["account_id"];      // 客户ID
                var contact_id = Request.QueryString["id"];      // 联系人ID

                if (AuthBLL.GetUserContactAuth(LoginUserId, LoginUser.security_Level_id, Convert.ToInt64(contact_id)).CanView == false)
                {
                    Response.End();
                    return;
                }

                contact      = contactBLL.GetContact(Convert.ToInt64(contact_id));
                thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath + "?id=" + Convert.ToInt64(contact_id), LoginUserId);
                if (contact != null)
                {
                    account = companyBll.GetCompany(contact.account_id);
                }
                type = Request.QueryString["type"];
                if (string.IsNullOrEmpty(type))
                {
                    type = "activity";
                }
                if (type == "activity" || type == "note" || type == "todo")
                {
                    isHide.Value = "show";
                }
                switch (type)    // 根据传过来的不同的类型,为页面中的iframe控件选择不同的src
                {
                case "activity":
                    actType = "活动";
                    break;

                case "todo":
                    iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.TODOS + "&type=" + (int)QueryType.Todos + "&group=112&con659=" + contact_id + "&param1=contactId&param2=" + contact_id;      // 待办
                    actType   = "待办";
                    break;

                case "note":
                    iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CRM_NOTE_SEARCH + "&type=" + (int)QueryType.CRMNote + "&group=110&con646=" + contact_id + "&param1=contactId&param2=" + contact_id;      // 备注
                    actType   = "备注";
                    break;

                case "opportunity":
                    iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.OPPORTUNITY_CONTACT_VIEW + "&type=" + (int)QueryType.OpportunityContactView + "&id=" + contact_id;      // 商机
                    actType   = "商机";
                    break;

                case "configura":
                    iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.INSTALLEDPRODUCT + "&type=" + (int)QueryType.InstalledProductView + "&con966=" + contact_id;
                    actType   = "配置项";
                    break;

                case "ticket":
                    iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.MY_QUEUE_ACTIVE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.MY_QUEUE_ACTIVE + "&group=215&con5602=" + contact_id + "&param1=ShowPara";
                    actType   = "工单";
                    break;

                case "group":
                    actType   = "联系人组";
                    iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.ACCOUNT_CONTACT_GROUP_SEARCH + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.ACCOUNT_CONTACT_GROUP_SEARCH;      // todo 添加参数
                    break;

                default:
                    iframeSrc = "";      // 默认
                    break;
                }
                if (type.Equals("activity"))
                {
                    var typeList = new ActivityBLL().GetCRMActionType();
                    noteType.DataSource     = typeList;
                    noteType.DataTextField  = "name";
                    noteType.DataValueField = "id";
                    noteType.DataBind();
                }
                if (account != null && contact != null)
                {
                    dic                 = new CompanyBLL().GetField();
                    contactUDFList      = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.CONTACT);
                    contactEDFValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.CONTACT, contact.id, contactUDFList);
                }
                else
                {
                    Response.End();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            thisBookMark   = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
            actionTypeList = bll.GetCRMActionType();
            resourceList   = new UserResourceBLL().GetResourceList();

            if (!IsPostBack)
            {
                long noteid;
                if (!string.IsNullOrEmpty(Request.QueryString["id"]) && long.TryParse(Request.QueryString["id"], out noteid))
                {
                    if (AuthBLL.GetUserNoteAuth(LoginUserId, LoginUser.security_Level_id, noteid).CanEdit == false)
                    {
                        Response.Write("<script>alert('您不能编辑此备注');</script>");
                        Response.End();
                        return;
                    }

                    note            = bll.GetActivity(noteid);
                    contactList     = new ContactBLL().GetContactByCompany((long)note.account_id);
                    opportunityList = new OpportunityBLL().GetOpportunityByCompany((long)note.account_id);
                    var accountName = "";
                    if (note.account_id != null)
                    {
                        var account = new CompanyBLL().GetCompany((long)note.account_id);
                        accountName = account == null ? "" : account.name;
                    }
                    var history = new sys_windows_history()
                    {
                        title = "备注:" + note.description + ":" + accountName,
                        url   = Request.RawUrl,
                    };
                    new IndexBLL().BrowseHistory(history, LoginUserId);
                }

                if (long.TryParse(Request.QueryString["accountId"], out accountId))
                {
                    objType = (int)DicEnum.OBJECT_TYPE.CUSTOMER;
                    objId   = accountId;
                }
                if (long.TryParse(Request.QueryString["contactId"], out contactId))
                {
                    accountId = new ContactBLL().GetContact(contactId).account_id;
                    objType   = (int)DicEnum.OBJECT_TYPE.CONTACT;
                    objId     = contactId;
                }
                if (long.TryParse(Request.QueryString["opportunityId"], out opportunityId))
                {
                    objType = (int)DicEnum.OBJECT_TYPE.OPPORTUNITY;
                    objId   = opportunityId;
                    var opp = new OpportunityBLL().GetOpportunity(opportunityId).general;
                    accountId = opp.account_id;
                    if (opp.contact_id != null)
                    {
                        contactId = (long)opp.contact_id;
                    }
                }
                if (long.TryParse(Request.QueryString["saleorderId"], out saleOrderId))
                {
                    objType = (int)DicEnum.OBJECT_TYPE.SALEORDER;
                    objId   = saleOrderId;
                    var saleOrder = new SaleOrderBLL().GetSaleOrder(saleOrderId);
                    var opp       = new OpportunityBLL().GetOpportunity(saleOrder.opportunity_id).general;
                    opportunityId = opp.id;
                    accountId     = opp.account_id;
                    if (opp.contact_id != null)
                    {
                        contactId = (long)opp.contact_id;
                    }
                }
            }
            else
            {
                com_activity activity = AssembleModel <com_activity>();
                if (activity.contact_id == 0)
                {
                    activity.contact_id = null;
                }
                activity.start_date = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(Request.Form["start_date2"]));
                activity.end_date   = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(Request.Form["end_date2"]));

                com_activity todo = null;
                if (!string.IsNullOrEmpty(Request.Form["action_type_id1"]))
                {
                    todo = new com_activity();
                    todo.action_type_id = int.Parse(Request.Form["action_type_id1"]);
                    todo.start_date     = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(Request.Form["start_date1"]));
                    todo.end_date       = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(Request.Form["end_date1"]));
                    todo.description    = Request.Form["description1"];
                    if (!string.IsNullOrEmpty(Request.Form["resource_id1"]))
                    {
                        todo.resource_id = long.Parse(Request.Form["resource_id1"]);
                    }
                }

                if (string.IsNullOrEmpty(Request.Form["id"]))
                {
                    bll.AddCRMNote(activity, todo, GetLoginUserId());
                }
                else
                {
                    bll.EditCRMNote(activity, todo, GetLoginUserId());
                }

                if (Request.Form["action"] != null && Request.Form["action"].Equals("SaveNew"))
                {
                    Response.Write("<script>alert('保存备注成功');window.location.href='Notes.aspx';self.opener.location.reload();</script>");
                }
                else
                {
                    Response.Write("<script>alert('保存备注成功');window.close();self.opener.location.reload();</script>");
                }
            }
        }
Exemplo n.º 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                // todo - 商机的重新指派

                var sid = Request.QueryString["id"];
                if (AuthBLL.GetUserSaleorderAuth(LoginUserId, LoginUser.security_Level_id, Convert.ToInt64(sid)).CanView == false)
                {
                    Response.End();
                    return;
                }
                thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath + "?id=" + sid, LoginUserId);

                type        = Request.QueryString["type"];
                sale_order  = new crm_sales_order_dal().GetSingleSale(long.Parse(sid));
                opportunity = new crm_opportunity_dal().GetOpportunityById(sale_order.opportunity_id);
                account     = new CompanyBLL().GetCompany(opportunity.account_id);
                quote       = new QuoteBLL().GetPrimaryQuote(opportunity.id);
                if (sale_order.contact_id != null)
                {
                    contact = new ContactBLL().GetContact((long)sale_order.contact_id);
                }
                switch (type)
                {
                case "activity":
                    actType          = "活动";
                    isShowLeft.Value = "1";
                    break;

                case "todo":
                    actType          = "待办";
                    iframeSrc        = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.TODOS + "&type=" + (int)QueryType.Todos + "&group=131&con676=" + sale_order.id + "&param1=saleorderId&param2=" + sale_order.id;
                    isShowLeft.Value = "1";
                    break;

                case "note":
                    actType          = "备注";
                    iframeSrc        = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CRM_NOTE_SEARCH + "&type=" + (int)QueryType.CRMNote + "&group=129&con675=" + sale_order.id + "&param1=saleorderId&param2=" + sale_order.id;
                    isShowLeft.Value = "1";
                    break;

                case "ticket":
                    actType = "工单";
                    break;

                case "attachment":
                    actType   = "附件";
                    iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.SALES_ORDER_VIEW_ATTACHMENT + "&type=" + (int)QueryType.SalesOrderViewAttachment + "&con977=" + sale_order.id;
                    break;

                case "entry":
                    actType   = "报价项";
                    iframeSrc = "../QuoteItem/QuoteItemManage.aspx?isShow=1&quote_id=" + quote.id + "&isSaleOrder=1&sale_order_id=" + sale_order.id;
                    break;

                case "purchaseOrder":
                    actType = "采购订单";
                    break;

                default:
                    actType          = "活动";
                    type             = "activity";
                    isShowLeft.Value = "1";
                    break;
                }

                if (type.Equals("activity"))
                {
                    var typeList = new ActivityBLL().GetCRMActionType();
                    noteType.DataSource     = typeList;
                    noteType.DataTextField  = "name";
                    noteType.DataValueField = "id";
                    noteType.DataBind();
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
Exemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
            id           = Convert.ToInt64(Request.QueryString["id"]);
            if (!IsPostBack)
            {
                Bind();
                if (id > 0)  //修改
                {
                    var data = new QuoteTemplateBLL().GetQuoteTemplate(id);
                    if (data == null)
                    {
                        Response.Write("<script>alert('获取相关数据失败,返回上一个页面');window.close();self.opener.location.reload();</script>");
                    }
                    else
                    {
                        this.Name.Text        = data.name;
                        this.Description.Text = data.description;
                        if (data.is_active == 1)
                        {
                            this.Active.Checked = true;
                        }
                        if (data.show_each_tax_in_tax_group == 1)
                        {
                            this.show_each_tax_in_tax_group.Checked = true;
                        }
                        if (data.show_each_tax_in_tax_period == 1)
                        {
                            this.show_each_tax_in_tax_period.Checked = true;
                        }
                        if (data.show_tax_cate == 1)
                        {
                            this.show_tax_cate.Checked = true;
                        }
                        if (data.show_tax_cate_superscript == 1)
                        {
                            this.show_tax_cate_superscript.Checked = true;
                        }

                        var data_tax = new EMT.Tools.Serialize().DeserializeJson <QuoteTemplateAddDto.Tax_Total_Disp>(data.tax_total_disp);
                        this.SemiAnnualTotal.Text             = data_tax.Semi_Annual_Total;
                        this.IncludingOptionalQuoteItems.Text = data_tax.Including_Optional_Quote_Items;
                        this.ItemTotal.Text               = data_tax.Item_Total;
                        this.Subtotal.Text                = data_tax.Subtotal;
                        this.Total.Text                   = data_tax.Total;
                        this.TotalTaxes.Text              = data_tax.Total_Taxes;
                        this.YearlySubtotal.Text          = data_tax.Yearly_Subtotal;
                        this.YearlyTotal.Text             = data_tax.Yearly_Total;
                        this.ShippingTotal.Text           = data_tax.Shipping_Total;
                        this.ShippingSubtotal.Text        = data_tax.Shipping_Subtotal;
                        this.SemiAnnualSubtotal.Text      = data_tax.Semi_Annual_Subtotal;
                        this.QuarterlySubtotal.Text       = data_tax.Quarterly_Subtotal;
                        this.QuarterlyTotal.Text          = data_tax.Quarterly_Total;
                        this.MonthlySubtotal.Text         = data_tax.Monthly_Subtotal;
                        this.OptionalSubtotal.Text        = data_tax.Optional_Subtotal;
                        this.OptionalTotal.Text           = data_tax.Optional_Total;
                        this.MonthlyTotal.Text            = data_tax.Monthly_Total;
                        this.OneTimeDiscountSubtotal.Text = data_tax.One_Time_Discount_Subtotal;
                        this.OneTimeDiscountTotal.Text    = data_tax.One_Time_Discount_Total;
                        this.OneTimeSubtotal.Text         = data_tax.One_Time_Subtotal;
                        this.OneTimeTotal.Text            = data_tax.One_Time_Total;

                        switch (data.page_number_location_id)
                        {
                        case (int)PAGE_NUMBER_LOCATION.NO: this.showNO.Checked = true; break;

                        case (int)PAGE_NUMBER_LOCATION.BOTTOMLEFT: this.showLeft.Checked = true; break;

                        case (int)PAGE_NUMBER_LOCATION.BOTTOMCENTER: this.showCenter.Checked = true; break;

                        case (int)PAGE_NUMBER_LOCATION.BOTTOMRIGHT: this.showRight.Checked = true; break;
                        }

                        switch (data.paper_size_id)
                        {
                        case (int)PAGE_SIZE.LETTER: this.Letter.Checked = true; break;

                        case (int)PAGE_SIZE.A4: this.A4.Checked = true; break;
                        }
                    }
                }
            }
        }
Exemplo n.º 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool is_edit = long.TryParse(Request.QueryString["id"], out id);

            thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
            if (is_edit)
            {
                if (AuthBLL.GetUserContactAuth(LoginUserId, LoginUser.security_Level_id, id).CanEdit == false)
                {
                    Response.End();
                    return;
                }
            }

            try
            {
                var account_id = Request.QueryString["account_id"];
                if (!string.IsNullOrEmpty(account_id))
                {
                    account = new CompanyBLL().GetCompany(long.Parse(account_id));
                }
                callBackFiled = Request.QueryString["callback"];
            }
            catch (Exception)
            {
                Response.End();
            }

            if (IsPostBack)
            {
                SaveFormData();
            }
            else
            {
                var dic = new ContactBLL().GetField();
                // 称谓
                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
                });

                contact_udfList = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.CONTACT);

                if (is_edit)
                {
                    dto                  = new ContactBLL().GetContactDto(long.Parse(Request.QueryString["id"]));
                    active.Checked       = dto.contact.is_active == 1 ? true : false;
                    primary.Checked      = dto.contact.is_primary_contact == 1 ? true : false;
                    allowEmail.Checked   = dto.contact.allow_notify_email_task_ticket == 1 ? true : false;
                    optoutEmail.Checked  = dto.contact.is_optout_contact_group_email == 1 ? true : false;
                    optoutSurvey.Checked = dto.contact.is_optout_survey == 1 ? true : false;
                    if (!string.IsNullOrEmpty(dto.contact.avatar))
                    {
                        avatarPath = dto.contact.avatar;
                    }
                }
                else
                {
                    dto.contact        = new crm_contact();
                    dto.udf            = new List <UserDefinedFieldValue>();
                    dto.location       = new crm_location();
                    dto.location2      = new crm_location();
                    active.Checked     = true;
                    allowEmail.Checked = true;
                }
            }
        }
Exemplo n.º 14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
                tmplList     = new FormTemplateBLL().GetTmplByType((int)DicEnum.FORM_TMPL_TYPE.QUOTE, LoginUserId);
                var id = Request.QueryString["id"];
                dic = new QuoteBLL().GetField();
                #region  拉框配置数据源
                tax_region_id.DataValueField = "val";
                tax_region_id.DataTextField  = "show";
                tax_region_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "taxRegion").Value;
                tax_region_id.DataBind();
                tax_region_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });

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


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

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

                quote_tmpl_id.DataValueField = "id";
                quote_tmpl_id.DataTextField  = "name";
                quote_tmpl_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "quote_tmpl").Value;
                quote_tmpl_id.DataBind();
                quote_tmpl_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });
                var prolist = new pro_project_dal().GetProjectList();
                // project_id
                //project_id.DataValueField = "id";
                //project_id.DataTextField = "name";
                //project_id.DataSource = prolist;
                //project_id.DataBind();
                //project_id.Items.Insert(0, new ListItem() { Value = "0", Text = "   ", Selected = true });
                #endregion

                if (!string.IsNullOrEmpty(id))
                {
                    if (AuthBLL.GetUserQuoteAuth(LoginUserId, LoginUser.security_Level_id, Convert.ToInt64(id)).CanEdit == false)
                    {
                        Response.End();
                        return;
                    }
                    quote = new crm_quote_dal().GetQuote(Convert.ToInt64(id));
                    if (quote != null)
                    {
                        if (string.IsNullOrEmpty(Request.QueryString["copy"]))
                        {
                            isAdd = false;
                        }
                    }
                }
                else
                {
                    var opportunity_id = Request.QueryString["quote_opportunity_id"];
                    if (!string.IsNullOrEmpty(opportunity_id))
                    {
                        opportunity = new crm_opportunity_dal().GetOpportunityById(long.Parse(opportunity_id));
                        account     = new CompanyBLL().GetCompany(opportunity.account_id);
                    }
                }
                if (!IsPostBack)
                {
                    if (!isAdd)
                    {
                        account = new CompanyBLL().GetCompany(quote.account_id);
                        if (account != null)
                        {
                            tax_region_id.SelectedValue = account.tax_region_id != null?account.tax_region_id.ToString() : "0";

                            payment_term_id.SelectedValue = quote.payment_term_id != null?quote.payment_term_id.ToString() : "0";

                            payment_type_id.SelectedValue = quote.payment_type_id != null?quote.payment_type_id.ToString() : "0";   //shipping_type_id

                            shipping_type_id.SelectedValue = quote.shipping_type_id != null?quote.shipping_type_id.ToString() : "0";

                            quote_tmpl_id.SelectedValue = quote.quote_tmpl_id != null?quote.quote_tmpl_id.ToString() : "0";

                            //project_id.SelectedValue = quote.project_id!=null ?  quote.project_id.ToString() : "0";
                            BillLocation.Checked = quote.bill_to_location_id == quote.sold_to_location_id;
                            ShipLocation.Checked = quote.ship_to_location_id == quote.sold_to_location_id;
                        }
                        #region 记录浏览历史
                        var history = new sys_windows_history()
                        {
                            title = $"编辑报价:" + quote.name + " " + (account != null ? account.name : ""),
                            url   = Request.RawUrl,
                        };
                        new IndexBLL().BrowseHistory(history, LoginUserId);
                        #endregion
                    }
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
Exemplo n.º 15
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>");
            }
        }
Exemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var id = Request.QueryString["id"];
                type = Request.QueryString["type"];
                if (id != null)
                {
                    thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath + "?id=" + id, LoginUserId);
                    var src = Request.QueryString["src"];
                    if (!string.IsNullOrEmpty(src))
                    {
                        crm_account = companyBll.GetCompanyByOtherId(Convert.ToInt64(id), src);
                    }
                    else
                    {
                        crm_account = companyBll.GetCompanyByOtherId(Convert.ToInt64(id));
                    }
                    if (crm_account != null)
                    {
                        if (AuthBLL.GetUserCompanyAuth(LoginUserId, LoginUser.security_Level_id, crm_account.id).CanView == false)     // 权限验证
                        {
                            Response.End();
                            return;
                        }
                        #region 记录浏览历史
                        var history = new sys_windows_history()
                        {
                            title = "客户:" + crm_account.name,
                            url   = Request.Url.LocalPath + "?id=" + id,
                        };
                        new IndexBLL().BrowseHistory(history, LoginUserId);
                        #endregion
                        dic = new CompanyBLL().GetField();    // 获取字典
                        if (string.IsNullOrEmpty(type))
                        {
                            type = "activity";
                        }
                        if (type == "activity" || type == "note" || type == "todo")
                        {
                            isHide.Value = "show";
                            //  Response.Write("<script>document.getElementById('showCompanyGeneral').style.display='none';</script>");
                        }
                        switch (type)    // 根据传过来的不同的类型,为页面中的iframe控件选择不同的src
                        {
                        case "activity":
                            var typeList = new ActivityBLL().GetCRMActionType();
                            noteType.DataSource     = typeList;
                            noteType.DataTextField  = "name";
                            noteType.DataValueField = "id";
                            noteType.DataBind();
                            actType = "活动";
                            break;

                        case "todo":                // 待办
                            iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.TODOS + "&type=" + (int)QueryType.Todos + "&group=112&con658=" + crm_account.id + "&param1=accountId&param2=" + crm_account.id;
                            actType   = "待办";
                            break;

                        case "note":                // 备注
                            iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CRM_NOTE_SEARCH + "&type=" + (int)QueryType.CRMNote + "&group=110&con645=" + crm_account.id + "&param1=accountId&param2=" + crm_account.id;
                            actType   = "备注";
                            break;

                        case "opportunity":
                            iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.OPPORTUNITY_COMPANY_VIEW + "&type=" + (int)QueryType.OpportunityCompanyView + "&id=" + id;
                            actType   = "商机";
                            break;    //

                        case "contact":
                            iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CONTACT_COMPANY_VIEW + "&type=" + (int)QueryType.ContactCompanyView + "&id=" + id; // 联系人
                            actType   = "联系人";
                            break;                                                                                                                                                         //

                        case "Subsidiaries":
                            iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.SUBCOMPANY_COMPANY_VIEW + "&type=" + (int)QueryType.SubcompanyCompanyView + "&id=" + id; // 子公司
                            actType   = "子客户";
                            break;                                                                                                                                                               //Subsidiaries

                        case "saleOrder":                                                                                                                                                        // 销售订单
                            iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.SALEORDER + "&type=" + (int)QueryType.SaleOrder + "&group=42&con385=" + id;
                            actType   = "销售订单";
                            break;

                        case "contract":            // 合同
                            iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.COMPANY_VIEW_CONTRACT + "&type=" + (int)QueryType.CompanyViewContract + "&con933=" + id;
                            actType   = "合同";
                            break;

                        case "confirgItem":
                            iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.INSTALLEDPRODUCT + "&type=" + (int)QueryType.InstalledProductView + "&con358=" + id;
                            actType   = "配置项";
                            break;

                        case "invoice":
                            iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.COMPANY_VIEW_INVOICE + "&type=" + (int)QueryType.CompanyViewInvoice + "&con934=" + id;
                            actType   = "发票";
                            break;

                        case "attachment":
                            iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.COMPANY_VIEW_ATTACHMENT + "&type=" + (int)QueryType.CompanyViewAttachment + "&con674=" + id;
                            actType   = "附件";
                            break;

                        case "project":
                            iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.PROJECT_SEARCH + "&type=" + (int)QueryType.PROJECT_SEARCH + "&con630=" + crm_account.id;
                            actType   = "项目";
                            break;

                        case "finance":
                            actType = "财务";
                            break;

                        case "ticket":
                            actType   = "工单";
                            iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.MY_QUEUE_ACTIVE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.MY_QUEUE_ACTIVE + "&group=215&con2627=" + crm_account.id + "&param1=ShowPara";
                            break;

                        case "contactGroup":
                            actType   = "联系人组";
                            iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.ACCOUNT_CONTACT_GROUP_SEARCH + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.ACCOUNT_CONTACT_GROUP_SEARCH + "&con3961=" + crm_account.id.ToString();
                            break;

                        default:
                            iframeSrc = "";      // 默认  project_search
                            actType   = "活动";

                            break;
                        }
                        //viewCompany_iframe.Src = "";  //
                    }
                    else
                    {
                        Response.Write("<script>alert('未获取到客户信息');window.close();</script>");
                    }
                }
                else
                {
                    Response.Write("<script>alert('未获取到客户信息');window.close();</script>");
                }
            }
            catch (Exception msg)
            {
                Response.Write($"<script>alert('{msg.Message}');window.close();</script>");
            }
        }
Exemplo n.º 17
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
         var callId   = Request.QueryString["callId"];
         var tickeTId = Request.QueryString["ticketId"];
         if (!string.IsNullOrEmpty(callId))
         {
             thisCall = new sdk_service_call_dal().FindNoDeleteById(long.Parse(callId));
         }
         if (!string.IsNullOrEmpty(tickeTId))
         {
             thisTicket = new sdk_task_dal().FindNoDeleteById(long.Parse(tickeTId));
         }
         if (thisTicket != null)
         {
             thisAccount = new CompanyBLL().GetCompany(thisTicket.account_id);
             if (thisTicket.contact_id != null)
             {
                 ticketCon = new crm_contact_dal().FindNoDeleteById((long)thisTicket.contact_id);
             }
             resList = new List <sys_resource>();
             var srDal = new sys_resource_dal();
             if (thisTicket.owner_resource_id != null)
             {
                 var priRes = srDal.FindNoDeleteById((long)thisTicket.owner_resource_id);
                 if (priRes != null)
                 {
                     resList.Add(priRes);
                 }
             }
             var other = srDal.GetResByTicket(thisTicket.id);
             if (other != null && other.Count > 0)
             {
                 resList.AddRange(other);
             }
         }
         if (thisCall != null && thisTicket != null)
         {
             thisCallTask = new sdk_service_call_task_dal().GetSingTaskCall(thisCall.id, thisTicket.id);
             thisAccount  = new CompanyBLL().GetCompany(thisCall.account_id);
         }
         var callTaskId = Request.Form["id"];
         if (!string.IsNullOrEmpty(callTaskId))
         {
             thisCallTask = new sdk_service_call_task_dal().FindNoDeleteById(long.Parse(callTaskId));
         }
         if (thisCallTask != null)
         {
             isAdd       = false;
             serResList  = new sdk_service_call_task_resource_dal().GetTaskResList(thisCallTask.id);
             callCreater = new sys_resource_dal().FindNoDeleteById(thisCallTask.id);
         }
         var timeNow = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
         if (thisAccount != null)
         {
             if (thisAccount.resource_id != null)
             {
                 accMan = new sys_resource_dal().FindNoDeleteById((long)thisAccount.resource_id);
             }
             accCallList = new sdk_service_call_dal().GetCallByAccount(thisAccount.id);
             if (accCallList != null && accCallList.Count > 0)
             {
                 pageCallList = (from a in accCallList
                                 join b in statusList on a.status_id equals b.id
                                 select new CallDto {
                     id = a.id, startDate = EMT.Tools.Date.DateHelper.ConvertStringToDateTime(a.start_time).ToString("yyyy-MM-dd HH:mm"), endDate = EMT.Tools.Date.DateHelper.ConvertStringToDateTime(a.end_time).ToString("yyyy-MM-dd HH:mm"), statusId = a.status_id, statusName = b.name, isLimtThri = (timeNow - a.start_time) > (2592000000)
                 }).ToList();
                 // 2592000000 = 30 * 24 * 60 * 60 * 1000  30天的毫秒数
             }
         }
         else
         {
             Response.Write($"<script>alert('为获取到相关客户信息,请重新打开!');window.close();</script>");
             return;
         }
     }
     catch (Exception msg)
     {
         Response.Write($"<script>alert('{msg.Message}!');window.close();</script>");
     }
 }
Exemplo n.º 18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                thisBookMark     = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
                iProduct_udfList = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.CONFIGURATION_ITEMS);
                var contract_id = Request.QueryString["contract_id"];
                if (!string.IsNullOrEmpty(contract_id))
                {
                    contract = new ctt_contract_dal().FindNoDeleteById(long.Parse(contract_id));
                    if (contract != null)
                    {
                        account = new CompanyBLL().GetCompany(contract.account_id);
                    }
                }
                var contactId = Request.QueryString["contact_id"];
                if (!string.IsNullOrEmpty(contactId))
                {
                    contact = new ContactBLL().GetContact(long.Parse(contactId));
                    if (contact != null)
                    {
                        account = new CompanyBLL().GetCompany(contact.account_id);
                    }
                }


                var id = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(id))
                {
                    iProduct = new crm_installed_product_dal().GetInstalledProduct(long.Parse(id));
                    if (iProduct != null)
                    {
                        account = new CompanyBLL().GetCompany((long)iProduct.account_id);
                        product = new ivt_product_dal().FindNoDeleteById(iProduct.product_id);
                    }
                }
                var account_id = Request.QueryString["account_id"];
                if (!string.IsNullOrEmpty(account_id))
                {
                    account = new CompanyBLL().GetCompany(long.Parse(account_id));
                }
                //var contactList = new crm_contact_dal().GetContactByAccountId(account.id);
                //var serviceList = new ivt_service_dal().GetServiceList($" and vendor_id = {account.id}");
                #region 配置下拉框数据源

                var udfGroup = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.UDF_FILED_GROUP);
                List <d_general> cateList = null;
                if (udfGroup != null && udfGroup.Count > 0)
                {
                    cateList = udfGroup.Where(_ => _.parent_id == (int)UDF_CATE.CONFIGURATION_ITEMS).ToList();
                }
                installed_product_cate_id.DataTextField  = "name";
                installed_product_cate_id.DataValueField = "id";
                installed_product_cate_id.DataSource     = cateList;
                installed_product_cate_id.DataBind();
                installed_product_cate_id.Items.Insert(0, new ListItem()
                {
                    Value = "", Text = "   ", Selected = true
                });

                //contact_id.DataTextField = "name";
                //contact_id.DataValueField = "id";
                //contact_id.DataSource = contactList;
                //contact_id.DataBind();
                //contact_id.Items.Insert(0, new ListItem() { Value = "", Text = "   ", Selected = true });

                //
                //service.DataTextField = "name";
                //service.DataValueField = "id";
                //service.DataSource = serviceList;
                //service.DataBind();
                //service.Items.Insert(0, new ListItem() { Value = "0", Text = "   ", Selected = true });
                //service.Enabled = false; // 所选合同如果是服务类型的,则此下拉框可选。可选内容为合同项
                #endregion
                if (iProduct != null)
                {
                    //account_id = iProduct.account_id.ToString();
                    iProduct_udfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.CONFIGURATION_ITEMS, iProduct.id, iProduct_udfList);
                    var isCopy = Request.QueryString["isCopy"];

                    product = new EMT.DoneNOW.BLL.ProductBLL().GetProduct(iProduct.product_id);

                    isAdd = false;
                    if (!string.IsNullOrEmpty(isCopy) && isCopy == "1")
                    {
                        isAdd = true;
                    }
                    if (!isAdd)
                    {
                        #region 记录浏览历史
                        var history = new sys_windows_history()
                        {
                            title = "配置项:" + (product == null ? "" : product.name) + account.name,
                            url   = Request.RawUrl,
                        };
                        new IndexBLL().BrowseHistory(history, LoginUserId);
                        #endregion
                    }


                    if (iProduct.contract_id != null)
                    {
                        contract = new ctt_contract_dal().FindNoDeleteById((long)iProduct.contract_id);
                    }
                    if (iProduct.cate_id != null)
                    {
                        installed_product_cate_id.SelectedValue = iProduct.cate_id.ToString();
                    }


                    if (iProduct.contact_id != null)
                    {
                        contact_id.SelectedValue = iProduct.contact_id.ToString();
                    }
                    viewSubscription_iframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.CONFIGSUBSCRIPTION + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.CONFIGSUBSCRIPTION + "&id=" + iProduct.id;

                    view_ticket_iframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.MY_QUEUE_ACTIVE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.MY_QUEUE_ACTIVE + "&group=215&con3962=" + iProduct.id + "&param1=ShowPara";
                    // todo 订阅的通用查询
                    // "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.CONTACT_COMPANY_VIEW + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.ContactCompanyView + "&id=" + id;
                    thisNoteAtt = new com_attachment_dal().GetAttListByOid(iProduct.id);
                    if (!isAdd)
                    {
                        if (iProduct.parent_id != null)
                        {
                            parentInsPro = new crm_installed_product_dal().GetInstalledProduct((long)iProduct.parent_id);
                        }
                        childInsProList = new crm_installed_product_dal().GetChildInsPro(iProduct.id);
                    }
                }
                if (!IsPostBack)
                {
                    is_active_.Checked = true;
                    if (iProduct != null)
                    {
                        is_active_.Checked = iProduct.is_active == 1;
                    }
                }
            }
            catch (Exception msg)
            {
                Response.Write("<script>alert('" + msg.Message + "');window.close();</script>");
            }
        }
Exemplo n.º 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
            var company_id = Convert.ToInt64(Request.QueryString["id"]);

            if (AuthBLL.GetUserCompanyAuth(LoginUserId, LoginUser.security_Level_id, company_id).CanEdit == false)  // 权限验证
            {
                Response.End();
                return;
            }
            try
            {
                company_udfList      = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.COMPANY);
                company_udfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.COMPANY, company_id, company_udfList);
                site_udfList         = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.SITE);
                site_udfValueList    = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.SITE, company_id, site_udfList);
                account       = new CompanyBLL().GetCompany(company_id);
                location_list = new LocationBLL().GetLocationByCompany(company_id);
                // defaultLocation = new LocationBLL().GetLocationByAccountId(company_id);
                //if (!IsPostBack)
                //{
                // var company_id = Convert.ToInt64(Request.QueryString["id"]);

                if (account != null)
                {
                    subCompanyList = new crm_account_dal().GetMyCompany(account.id);
                    //searchCompany = new crm_account_dal().GetSubCompanys();
                    #region 为下拉框获取数据源
                    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
                    });
                    // 公司类型
                    CompanyType.DataTextField  = "show";
                    CompanyType.DataValueField = "val";
                    CompanyType.DataSource     = dic.FirstOrDefault(_ => _.Key == "company_type").Value;
                    CompanyType.DataBind();
                    CompanyType.Items.Insert(0, new ListItem()
                    {
                        Value = "0", Text = "   ", Selected = true
                    });

                    // 市场领域
                    MarketSegment.DataTextField  = "show";
                    MarketSegment.DataValueField = "val";
                    MarketSegment.DataSource     = dic.FirstOrDefault(_ => _.Key == "market_segment").Value;
                    MarketSegment.DataBind();
                    MarketSegment.Items.Insert(0, new ListItem()
                    {
                        Value = "0", Text = "   ", Selected = true
                    });
                    // 销售区域
                    TerritoryName.DataTextField  = "show";
                    TerritoryName.DataValueField = "val";
                    TerritoryName.DataSource     = dic.FirstOrDefault(_ => _.Key == "territory").Value;
                    TerritoryName.DataBind();
                    TerritoryName.Items.Insert(0, new ListItem()
                    {
                        Value = "0", Text = "   ", Selected = true
                    });
                    // 客户经理
                    AccountManger.DataTextField  = "show";
                    AccountManger.DataValueField = "val";
                    AccountManger.DataSource     = dic.FirstOrDefault(_ => _.Key == "sys_resource").Value;
                    AccountManger.DataBind();
                    AccountManger.Items.Insert(0, new ListItem()
                    {
                        Value = "0", Text = "   ", Selected = true
                    });
                    // 税区
                    TaxRegion.DataTextField  = "show";
                    TaxRegion.DataValueField = "val";
                    TaxRegion.DataSource     = dic.FirstOrDefault(_ => _.Key == "taxRegion").Value;
                    TaxRegion.DataBind();
                    TaxRegion.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
                    });
                    #endregion

                    company_name.Text = account.name;
                    //isactive.Checked = account.is_active == 1;

                    CompanyNumber.Text          = account.no;
                    Phone.Text                  = account.phone;
                    AlternatePhone1.Text        = account.alternate_phone1;
                    AlternatePhone2.Text        = account.alternate_phone2;
                    Fax.Text                    = account.fax;
                    WebSite.Text                = account.web_site;
                    is_optoutSurvey.Checked     = account.is_optout_survey == 1;
                    mileage.Text                = account.mileage == null ? "" : account.mileage.ToString();// todo decmail? 保留两位小数点??
                    stock_symbol.Text           = account.stock_symbol;
                    sic_code.Text               = account.sic_code;
                    stock_market.Text           = account.stock_market;
                    weibo_url.Text              = account.weibo_url;
                    wechat_mp_service.Text      = account.wechat_mp_service;
                    wechat_mp_subscription.Text = account.wechat_mp_subscription;

                    CompanyType.SelectedValue    = account.type_id == null ? "0" : account.type_id.ToString();
                    AccountManger.SelectedValue  = account.resource_id == null ? "0" : account.resource_id.ToString();
                    TerritoryName.SelectedValue  = account.territory_id == null ? "0" : account.territory_id.ToString();
                    MarketSegment.SelectedValue  = account.market_segment_id == null ? "0" : account.market_segment_id.ToString();
                    Competitor.SelectedValue     = account.competitor_id == null ? "0" : account.competitor_id.ToString();
                    Tax_Exempt.Checked           = account.is_tax_exempt == 1;
                    TaxRegion.SelectedValue      = account.tax_region_id == null ? "0" : account.tax_region_id.ToString();
                    classification.SelectedValue = account.classification_id == null ? "0" : account.classification_id.ToString();

                    if (Tax_Exempt.Checked)
                    {
                        TaxRegion.Enabled = true;
                    }
                    TaxId.Text = account.tax_identification;
                    if (account.parent_id != null)
                    {
                        var parCompany = new CompanyBLL().GetCompany((long)this.account.parent_id);
                        ParentComoanyName.Text = parCompany == null ? "" : parCompany.name;  //父客户
                    }
                    asset_value.Text = account.asset_value.ToString();

                    location = new LocationBLL().GetLocationByAccountId(account.id);
                    if (location != null)        // 如果该客户的地址是默认地址,不可更改为非默认,只能通过添加别的地址设置为默认这种方式去更改默认地址
                    {
                        country_idInit.Value   = location.country_id.ToString();
                        province_idInit.Value  = location.province_id.ToString();
                        city_idInit.Value      = location.city_id.ToString();
                        district_idInit.Value  = location.district_id.ToString();
                        address.Text           = location.address;
                        AdditionalAddress.Text = location.additional_address;
                    }

                    var company_detail_alert = new EMT.DoneNOW.DAL.crm_account_alert_dal().FindAlert(account.id, EMT.DoneNOW.DTO.DicEnum.ACCOUNT_ALERT_TYPE.COMPANY_DETAIL_ALERT);
                    var new_ticket_alert     = new EMT.DoneNOW.DAL.crm_account_alert_dal().FindAlert(account.id, EMT.DoneNOW.DTO.DicEnum.ACCOUNT_ALERT_TYPE.NEW_TICKET_ALERT);
                    var ticket_detail_alert  = new EMT.DoneNOW.DAL.crm_account_alert_dal().FindAlert(account.id, EMT.DoneNOW.DTO.DicEnum.ACCOUNT_ALERT_TYPE.TICKET_DETAIL_ALERT);

                    if (company_detail_alert != null)
                    {
                        Company_Detail_Alert.Text = company_detail_alert.alert_text;
                    }
                    if (new_ticket_alert != null)
                    {
                        New_Ticket_Alert.Text = new_ticket_alert.alert_text;
                    }
                    if (ticket_detail_alert != null)
                    {
                        Ticket_Detail_Alert.Text = ticket_detail_alert.alert_text;
                    }
                }
                else
                {
                    Response.End();
                }
                //}
            }
            catch (Exception)
            {
                Response.End();
            }
        }
Exemplo n.º 20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath, LoginUserId);
            // 今天生成的待办数量
            // 过期的待办
            // 打开的指派给其他人的待办
            // sys_resource_sales_quota
            //  需要更新的商机
            // 昨天的工单 | 今天的工单
            queryType = Request.QueryString["queryType"];
            if (string.IsNullOrEmpty(queryType))
            {
                queryType = "R|" + LoginUserId.ToString();
            }
            var queryArr = queryType.Split('|');

            if (queryArr[0] == "T" && queryArr.Count() == 2)
            {
                terrId = long.Parse(queryArr[1]);
            }
            else if (queryArr[0] == "R" && queryArr.Count() == 2)
            {
                resourceId = long.Parse(queryArr[1]);
            }
            else
            {
                resourceId = LoginUserId;
            }
            // 今天的开始结束时间
            var start = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " " + "00:00:00");
            var end   = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " " + "23:59:59");
            // 昨天的开始结束时间
            var yesStart = DateTime.Parse(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + " " + "00:00:00");
            var yesEnd   = DateTime.Parse(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + " " + "23:59:59");
            var timeNow  = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
            // 本月的开始结束时间
            var monthStart = DateTime.Parse(DateTime.Now.AddDays(-1).ToString("yyyy-MM") + "-01 " + "00:00:00");
            var monthDay   = DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month);
            var monthEnd   = DateTime.Parse(DateTime.Now.AddDays(-1).ToString("yyyy-MM") + "-" + monthDay.ToString() + " " + "23:59:59");

            string accClassWhere = "";

            var aa    = Tools.Date.DateHelper.ToUniversalTimeStamp();
            var caDal = new DAL.com_activity_dal();
            // 客户: {"row":"1","t1":"ca","col1":"1,2,3","col2":"1,2"}
            var accLimitJson = "{\"row\":\"1\",\"t1\":\"ca\",\"col1\":\"1,2,3\",\"col2\":\"1,2\"}";
            // 商机: {"row":"2","t1":"o","col1":"11"}
            var oppoLimtJson = "{\"row\":\"2\",\"t1\":\"cp\",\"col1\":\"11\"}";

            var accountLimitSql = Convert.ToString(caDal.GetSingle($"select f_rpt_getsql_limit('{accLimitJson}',{LoginUserId.ToString()})"));
            var oppoLimitSql    = Convert.ToString(caDal.GetSingle($"select f_rpt_getsql_limit('{oppoLimtJson}',{LoginUserId.ToString()})"));

            if (terrId != null)
            {
                var terResList = new DAL.sys_resource_territory_dal().GetByTerrId((long)terrId);
                if (terResList != null && terResList.Count > 0)
                {
                    terResList.ForEach(_ => { terResIds += _.resource_id.ToString() + ","; });
                }
                if (!string.IsNullOrEmpty(terResIds))
                {
                    terResIds = terResIds.Substring(0, terResIds.Length - 1);
                }
                string terrResWhere = "";
                if (terrId != 0)
                {
                    if (!string.IsNullOrEmpty(terResIds))
                    {
                        terrResWhere = $" and ca.resource_id in({terResIds})";
                    }
                    else
                    {
                        terrResWhere = $" and ca.resource_id in('')";
                    }
                }

                #region 摘要查询数量


                overdueTodoCount    = Convert.ToInt32(caDal.GetSingle($"SELECT count(1) from com_activity act INNER JOIN crm_account ca on act.account_id = ca.id  where act.cate_id = {(int)DTO.DicEnum.ACTIVITY_CATE.TODO} and ca.delete_time = 0 and act.delete_time = 0  and act.status_id = {(int)DTO.DicEnum.ACTIVITY_STATUS.NOT_COMPLETED} and act.end_date<={timeNow} " + accountLimitSql + (terrId == 0 ? $"" : $" and act.resource_id in({(string.IsNullOrEmpty(terResIds) ? "''" : terResIds)})")));
                myAsignToOtherCount = Convert.ToInt32(caDal.GetSingle($"SELECT count(1) from com_activity act INNER JOIN crm_account ca on act.account_id = ca.id  where act.cate_id = {(int)DTO.DicEnum.ACTIVITY_CATE.TODO} and ca.delete_time = 0 and act.delete_time = 0 " + accountLimitSql + (terrId == 0?$" and act.create_user_id <> act.resource_id" : $" and act.create_user_id in({(string.IsNullOrEmpty(terResIds)?"''": terResIds)})")));

                needEditOppoCount = Convert.ToInt32(caDal.GetSingle($"SELECT count(1) from crm_opportunity cp inner join crm_account ca on cp.account_id = ca.id  where cp.delete_time = 0  and projected_close_date < '{DateTime.Now.ToString("yyyy-MM-dd")}' and status_id ={(int)DicEnum.OPPORTUNITY_STATUS.ACTIVE} " + accountLimitSql + oppoLimitSql + (terrId == 0 ? "" : (string.IsNullOrEmpty(terResIds) ? " and cp.resource_id in('')" : $" and cp.resource_id in({terResIds})"))));
                yesTicketCount    = Convert.ToInt32(caDal.GetSingle($"SELECT count(1) FROM sdk_task st INNER JOIN crm_account ca on st.account_id = ca.id where st.type_id in (1809,1818)  and st.create_time <={Tools.Date.DateHelper.ToUniversalTimeStamp(yesEnd)} and st.create_time>={Tools.Date.DateHelper.ToUniversalTimeStamp(yesStart)}" + (string.IsNullOrEmpty(terResIds) ? "" : $" and ca.resource_id in({terResIds})")));

                todayTicketCount = Convert.ToInt32(caDal.GetSingle($"SELECT count(1) FROM sdk_task st INNER JOIN crm_account ca on st.account_id = ca.id where st.type_id in (1809,1818)  and st.create_time <={Tools.Date.DateHelper.ToUniversalTimeStamp(end)} and st.create_time>={Tools.Date.DateHelper.ToUniversalTimeStamp(start)}" + terrResWhere));

                monthLostOppo = Convert.ToInt32(caDal.GetSingle($"SELECT count(1) from crm_opportunity cp inner join crm_account ca on cp.account_id = ca.id where cp.delete_time = 0 and actual_closed_time <= {Tools.Date.DateHelper.ToUniversalTimeStamp(monthEnd)} and actual_closed_time >= {Tools.Date.DateHelper.ToUniversalTimeStamp(monthStart)} and status_id ={(int)DicEnum.OPPORTUNITY_STATUS.LOST} " + accountLimitSql + oppoLimitSql + (terrId == 0 ? "" : (string.IsNullOrEmpty(terResIds) ? " and cp.resource_id in('')" : $" and cp.resource_id in({terResIds})"))));

                //monthClosedOppo = Convert.ToInt32(caDal.GetSingle($"SELECT count(1) from crm_opportunity where delete_time = 0 and actual_closed_time <= {Tools.Date.DateHelper.ToUniversalTimeStamp(monthEnd)} and actual_closed_time >= {Tools.Date.DateHelper.ToUniversalTimeStamp(monthStart)} and status_id ={(int)DicEnum.OPPORTUNITY_STATUS.CLOSED}" + (terrId == 0 ? "" : (string.IsNullOrEmpty(terResIds) ? "''" : $" and resource_id in({terResIds})"))));

                monthCloseOppo = Convert.ToInt32(caDal.GetSingle($"SELECT count(1) from crm_opportunity cp inner join crm_account ca on cp.account_id = ca.id  where cp.delete_time = 0 and projected_close_date <= {monthEnd.ToString("yyyy-MM-dd")} and projected_close_date >= {monthStart.ToString("yyyy-MM-dd")} and cp.status_id ={(int)DicEnum.OPPORTUNITY_STATUS.ACTIVE} " + accountLimitSql + oppoLimitSql + (terrId == 0 ? "" : (string.IsNullOrEmpty(terResIds) ? " and cp.resource_id in('')" : $" and cp.resource_id in({terResIds})"))));

                monthClosedOppoList = caDal.FindListBySql <crm_opportunity>($"SELECT * from crm_opportunity  cp inner join crm_account ca on cp.account_id = ca.id  where cp.delete_time = 0 and actual_closed_time <= {Tools.Date.DateHelper.ToUniversalTimeStamp(monthEnd)} and actual_closed_time >= {Tools.Date.DateHelper.ToUniversalTimeStamp(monthStart)} and cp.status_id ={(int)DicEnum.OPPORTUNITY_STATUS.CLOSED} " + accountLimitSql + " " + oppoLimitSql + (terrId == 0 ? "" : (string.IsNullOrEmpty(terResIds) ? " and cp.resource_id in('')" : $" and cp.resource_id in({terResIds})")));
                #endregion

                accountCount      = Convert.ToInt32(caDal.GetSingle($"SELECT COUNT(1) from crm_account ca where delete_time = 0 " + accountLimitSql + (terrId == 0 ? "" : (string.IsNullOrEmpty(terResIds) ? " and resource_id in('')" : $" and resource_id in({terResIds})"))));
                activeOppoList    = caDal.FindListBySql <crm_opportunity>($"SELECT * from crm_opportunity cp inner join crm_account ca on cp.account_id = ca.id  where cp.delete_time = 0 and cp.status_id = {(int)DicEnum.OPPORTUNITY_STATUS.ACTIVE} " + accountLimitSql + " " + oppoLimitSql + (terrId == 0 ? "" : (string.IsNullOrEmpty(terResIds) ? " and cp.resource_id in('')" : $" and cp.resource_id in({terResIds})")));
                newOppoMonthCount = Convert.ToInt32(caDal.GetSingle($"SELECT COUNT(1) from crm_opportunity cp inner join crm_account ca on cp.account_id = ca.id  where cp.delete_time = 0 and cp.create_time>={Tools.Date.DateHelper.ToUniversalTimeStamp(monthStart)} and cp.create_time<={Tools.Date.DateHelper.ToUniversalTimeStamp(monthEnd)} " + (terrId == 0 ? "" : (string.IsNullOrEmpty(terResIds) ? " and cp.resource_id in('')" : $" and cp.resource_id in({terResIds})"))));

                //
                updateOppoNoteCount = Convert.ToInt32(caDal.GetSingle($"SELECT * from com_activity ca INNER JOIN crm_opportunity co on ca.opportunity_id = co.id where ca.action_type_id = {(int)DicEnum.ACTIVITY_TYPE.OPPORTUNITYUPDATE} and ca.cate_id = {(int)DicEnum.ACTIVITY_CATE.NOTE} and ca.delete_time = 0 and co.delete_time = 0 and ca.create_time>{Tools.Date.DateHelper.ToUniversalTimeStamp(monthStart)} and ca.create_time<={Tools.Date.DateHelper.ToUniversalTimeStamp(monthEnd)} " + (terrId == 0 ? "" : (string.IsNullOrEmpty(terResIds) ? " and co.resource_id in('')" : $" and co.resource_id in({terResIds})"))));
                if (terrId == 0)
                {
                    if (terrList != null && terrList.Count > 0)
                    {
                        terrList.ForEach(_ => {
                            terrAccDic.Add(_.id, Convert.ToInt32(caDal.GetSingle($"SELECT COUNT(1) from crm_account where delete_time = 0 and territory_id =" + _.id.ToString())));
                        });
                    }
                }
                else
                {
                    terrAccDic.Add((long)terrId, Convert.ToInt32(caDal.GetSingle($"SELECT COUNT(1) from crm_account where delete_time = 0 and territory_id =" + terrId.ToString())));
                }
                if (terrId != 0)
                {
                    if (!string.IsNullOrEmpty(terResIds))
                    {
                        accClassWhere = " " + accountLimitSql + $" and resource_id in({terResIds})";
                    }
                    else
                    {
                        accClassWhere = $" and resource_id in('')";
                    }
                }
                if (!string.IsNullOrEmpty(terResIds))
                {
                    resQuotaList = new DAL.sys_resource_sales_quota_dal().GetQuotaByResIds(terResIds, DateTime.Now.Year, DateTime.Now.Month);
                }
            }
            else if (resourceId != null)
            {
                string terIds  = ""; // 该负责人下的所有区域的Id 集合
                var    terList = new DAL.sys_resource_territory_dal().GetListByResourceId((long)resourceId);
                if (terList != null && terList.Count > 0)
                {
                    terList.ForEach(_ => { terIds += _.resource_id.ToString() + ","; });
                }
                if (!string.IsNullOrEmpty(terIds))
                {
                    terIds = terIds.Substring(0, terIds.Length - 1);
                }
                #region 摘要查询数量
                todayTodoCount      = caDal.GetTodoCountByRes((long)resourceId, $" and start_date <={Tools.Date.DateHelper.ToUniversalTimeStamp(end)} and start_date>={Tools.Date.DateHelper.ToUniversalTimeStamp(start)}");
                overdueTodoCount    = caDal.GetTodoCountByRes((long)resourceId, $" and status_id = {(int)DTO.DicEnum.ACTIVITY_STATUS.NOT_COMPLETED} and end_date<={timeNow}");
                myAsignToOtherCount = caDal.GetTodoCountByRes(0, resourceId == 0?$" and create_user_id <> resource_id" :$" and create_user_id= {resourceId} and resource_id<>{resourceId}");

                needEditOppoCount = Convert.ToInt32(caDal.GetSingle($"SELECT count(1) from crm_opportunity cp inner join crm_account ca on cp.account_id = ca.id where  cp.delete_time = 0 and projected_close_date < '{DateTime.Now.ToString("yyyy-MM-dd")}' and cp.status_id ={(int)DicEnum.OPPORTUNITY_STATUS.ACTIVE} " + accountLimitSql + oppoLimitSql + (resourceId == 0?"":$" and cp.resource_id = {(long)resourceId}")));

                yesTicketCount = Convert.ToInt32(caDal.GetSingle($"SELECT count(1) FROM sdk_task st INNER JOIN crm_account ca on st.account_id = ca.id where st.type_id in (1809,1818)  and st.create_time <={Tools.Date.DateHelper.ToUniversalTimeStamp(yesEnd)} and st.create_time>={Tools.Date.DateHelper.ToUniversalTimeStamp(yesStart)}" + (resourceId == 0 ? "" : $" and ca.resource_id = {(long)resourceId}")));

                todayTicketCount = Convert.ToInt32(caDal.GetSingle($"SELECT count(1) FROM sdk_task st INNER JOIN crm_account ca on st.account_id = ca.id where st.type_id in (1809,1818)  and st.create_time <={Tools.Date.DateHelper.ToUniversalTimeStamp(end)} and st.create_time>={Tools.Date.DateHelper.ToUniversalTimeStamp(start)}" + (resourceId == 0 ? "" : $" and ca.resource_id = {(long)resourceId}")));

                //
                monthLostOppo = Convert.ToInt32(caDal.GetSingle($"SELECT count(1) from crm_opportunity where delete_time = 0 and actual_closed_time <= {Tools.Date.DateHelper.ToUniversalTimeStamp(monthEnd)} and actual_closed_time >= {Tools.Date.DateHelper.ToUniversalTimeStamp(monthStart)} and status_id ={(int)DicEnum.OPPORTUNITY_STATUS.LOST}" + (resourceId == 0 ? "" : $" and resource_id = {(long)resourceId}")));

                monthClosedOppo = Convert.ToInt32(caDal.GetSingle($"SELECT count(1) from crm_opportunity where delete_time = 0 and actual_closed_time <= {Tools.Date.DateHelper.ToUniversalTimeStamp(monthEnd)} and actual_closed_time >= {Tools.Date.DateHelper.ToUniversalTimeStamp(monthStart)} and status_id ={(int)DicEnum.OPPORTUNITY_STATUS.CLOSED}" + (resourceId == 0 ? "" : $" and resource_id = {(long)resourceId}")));

                monthCloseOppo = Convert.ToInt32(caDal.GetSingle($"SELECT count(1) from crm_opportunity where delete_time = 0 and projected_close_date <= {monthEnd.ToString("yyyy-MM-dd")} and projected_close_date >= {monthStart.ToString("yyyy-MM-dd")} and status_id ={(int)DicEnum.OPPORTUNITY_STATUS.ACTIVE}" + (resourceId == 0 ? "" : $" and resource_id = {(long)resourceId}")));

                monthClosedOppoList = caDal.FindListBySql <crm_opportunity>($"SELECT * from crm_opportunity where delete_time = 0 and actual_closed_time <= {Tools.Date.DateHelper.ToUniversalTimeStamp(monthEnd)} and actual_closed_time >= {Tools.Date.DateHelper.ToUniversalTimeStamp(monthStart)} and status_id ={(int)DicEnum.OPPORTUNITY_STATUS.CLOSED}" + (resourceId == 0 ? "" : $" and resource_id = {(long)resourceId}"));
                #endregion

                accountCount      = Convert.ToInt32(caDal.GetSingle($"SELECT COUNT(1) from crm_account ca where delete_time = 0 " + accountLimitSql + (resourceId != 0? "  and resource_id =" + resourceId.ToString() : "")));
                activeOppoList    = caDal.FindListBySql <crm_opportunity>($"SELECT * from crm_opportunity cp inner join crm_account ca on cp.account_id = ca.id where cp.delete_time = 0 and cp.status_id = {(int)DicEnum.OPPORTUNITY_STATUS.ACTIVE} " + accountLimitSql + " " + oppoLimitSql + (resourceId != 0 ? "  and cp.resource_id =" + resourceId.ToString() : ""));
                newOppoMonthCount = Convert.ToInt32(caDal.GetSingle($"SELECT COUNT(1) from crm_opportunity where delete_time = 0 and create_time>={Tools.Date.DateHelper.ToUniversalTimeStamp(monthStart)} and create_time<={Tools.Date.DateHelper.ToUniversalTimeStamp(monthEnd)} " + (resourceId != 0 ? "  and resource_id =" + resourceId.ToString() : "")));

                updateOppoNoteCount = Convert.ToInt32(caDal.GetSingle($"SELECT * from com_activity ca INNER JOIN crm_opportunity co on ca.opportunity_id = co.id where ca.action_type_id = {(int)DicEnum.ACTIVITY_TYPE.OPPORTUNITYUPDATE} and ca.cate_id = {(int)DicEnum.ACTIVITY_CATE.NOTE} and ca.delete_time = 0 and co.delete_time = 0 and ca.create_time>{Tools.Date.DateHelper.ToUniversalTimeStamp(monthStart)} and ca.create_time<={Tools.Date.DateHelper.ToUniversalTimeStamp(monthEnd)} " + (resourceId != 0 ? "  and co.resource_id =" + resourceId.ToString() : "")));
                if (resourceId == 0)
                {
                    // 全部员工时获取所有的区域信息
                    if (terrList != null && terrList.Count > 0)
                    {
                        terrList.ForEach(_ => {
                            terrAccDic.Add(_.id, Convert.ToInt32(caDal.GetSingle($"SELECT COUNT(1) from crm_account where delete_time = 0 and territory_id =" + _.id.ToString())));
                        });
                    }
                }
                else
                {
                    accClassWhere = accountLimitSql + $" and resource_id ={resourceId.ToString()}";
                    // 单个员工时,获取单个员工下的所有区域信息
                    if (terList != null && terList.Count > 0)
                    {
                        terList.ForEach(_ => {
                            terrAccDic.Add(_.territory_id, Convert.ToInt32(caDal.GetSingle($"SELECT COUNT(1) from crm_account where delete_time = 0 and territory_id =" + _.id.ToString())));
                        });
                    }
                }
                resQuotaList = new DAL.sys_resource_sales_quota_dal().GetQuotaByResIds(resourceId.ToString(), DateTime.Now.Year, DateTime.Now.Month);
            }
            if (monthClosedOppoList != null && monthClosedOppoList.Count > 0)
            {
                monthClosedOppo = monthClosedOppoList.Count;
                monthClosedOppoList.ForEach(_ => {
                    prodessAmount  += _.ext1;
                    trainsAmount   += _.ext2;
                    hardwareAmount += _.ext3;
                    monthFeeAmount += _.ext4;
                    otherAmount    += _.ext5;
                    monthAmount    += oppBLl.ReturnOppoRevenue(_.id);
                });
            }
            if (activeOppoList != null && activeOppoList.Count > 0)
            {
                activeOppoCount = activeOppoList.Count;
            }

            if (accClassList != null && accClassList.Count > 0)
            {
                accClassList.ForEach(_ => {
                    classAccDic.Add(_.id, Convert.ToInt32(caDal.GetSingle($"SELECT COUNT(1) from crm_account ca where delete_time = 0 and classification_id =" + _.id.ToString() + " " + accClassWhere)));
                })
                ;
            }

            if (resQuotaList != null && resQuotaList.Count > 0)
            {
                quotaAmount   = resQuotaList.Sum(_ => _.amount ?? 0);
                quotaProdess  = resQuotaList.Sum(_ => _.opportunity_ext1 ?? 0);
                quotaTrains   = resQuotaList.Sum(_ => _.opportunity_ext2 ?? 0);
                quotaHardware = resQuotaList.Sum(_ => _.opportunity_ext3 ?? 0);
                quotaMonthFee = resQuotaList.Sum(_ => _.opportunity_ext4 ?? 0);
                quotaOther    = resQuotaList.Sum(_ => _.opportunity_ext5 ?? 0);
            }
        }
Exemplo n.º 21
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();
            }
        }
Exemplo n.º 22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
            var id     = Request.QueryString["id"];
            var isCopy = Request.QueryString["copy"];

            if (!string.IsNullOrEmpty(id))
            {
                thisCall = new sdk_service_call_dal().FindNoDeleteById(long.Parse(id));
            }
            if (thisCall != null)
            {
                if (!string.IsNullOrEmpty(isCopy))
                {
                    isCop = true;
                }
                else
                {
                    isAdd = false;
                }
                thisAccount = new CompanyBLL().GetCompany(thisCall.account_id);
                taskSerList = new sdk_service_call_task_dal().GetTaskCall(thisCall.id);
                if (taskSerList != null && taskSerList.Count > 0)
                {
                    taskSerList.ForEach(_ => {
                        ticketIds += _.task_id.ToString() + ',';
                    });
                    if (!string.IsNullOrEmpty(ticketIds))
                    {
                        ticketIds = ticketIds.Substring(0, ticketIds.Length - 1);
                    }
                }
                if (!isAdd)
                {
                    #region 记录浏览历史
                    var history = new sys_windows_history()
                    {
                        title = "服务预定:" + Tools.Date.DateHelper.ConvertStringToDateTime(thisCall.start_time).ToString("yyyy-MM-dd HH:mm") + "~" + Tools.Date.DateHelper.ConvertStringToDateTime(thisCall.end_time).ToString("yyyy-MM-dd HH:mm") + thisAccount.name,
                        url   = Request.RawUrl,
                    };
                    new IndexBLL().BrowseHistory(history, LoginUserId);
                    #endregion
                }
            }

            if (!IsPostBack)
            {
            }
            else
            {
                var param = GetParam();
                if (param != null)
                {
                    bool result = false;
                    if (isAdd)
                    {
                        result = new TicketBLL().AddServiceCall(param, LoginUserId);
                    }
                    else
                    {
                        result = new TicketBLL().EditServiceCall(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 == "save_close")
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "关闭窗口", $"<script>window.close();</script>");
                    }
                    else if (saveType == "save_new")
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "跳转", $"<script>location.href='ServiceCall';</script>");
                    }
                    else if (saveType == "work_book")  // todo 跳转到生成工作说明书界面
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "关闭窗口", $"<script>window.close();</script>");
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "跳转到编辑页面", $"<script>location.href='ServiceCall?id={param.call.id.ToString()}';</script>");
                    }
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "提示", $"<script>alert('必填项丢失,请重新填写!');</script>");
                }
            }
        }
Exemplo n.º 23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var id = Request.QueryString["id"];
                thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(id));
                if (thisProject != null)
                {
                    //  校验 是否有权限进行查看
                    if (AuthBLL.GetUserProjectAuth(LoginUserId, LoginUser.security_Level_id, thisProject.id).CanView == false)
                    {
                        Response.Write("<script>alert('无权查看');window.close();</script>");
                        Response.End();
                        return;
                    }
                    thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath + "?id=" + id, LoginUserId);


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

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

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

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

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

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

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

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

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

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

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

                    #region 记录浏览历史
                    var history = new sys_windows_history()
                    {
                        title = $"项目:" + thisProject.name + " " + (thisAccount != null? thisAccount.name:""),
                        url   = Request.RawUrl,
                    };
                    new IndexBLL().BrowseHistory(history, LoginUserId);
                    #endregion
                }
                else
                {
                    Response.End();
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }
Exemplo n.º 24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var contract_id = Request.QueryString["id"];
                contract = new ctt_contract_dal().FindNoDeleteById(long.Parse(contract_id));
                var conAccount = new CompanyBLL().GetCompany(contract.account_id);

                thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath + "?id=" + contract_id, LoginUserId);
                #region 记录浏览历史
                var history = new sys_windows_history()
                {
                    title = "合同详情:" + contract.name + conAccount.name,
                    url   = Request.RawUrl,
                };
                new IndexBLL().BrowseHistory(history, LoginUserId);
                #endregion
                var type = Request.QueryString["type"];
                switch (type)
                {
                case "InternalCost":
                    viewContractIframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.CONTRACT_INTERNAL_COST + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.InternalCost + "&id=" + contract.id;
                    ShowTitle.Text         = "内部成本-" + contract.name;
                    break;

                case "item":
                    viewContractIframe.Style["height"] = "300";
                    second.Style["height"]             = "600";
                    viewContractIframe.Src             = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.RELATION_CONFIGITEM + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.Relation_ConfigItem + "&id=" + contract_id;
                    second.Src     = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.NORELATION_CONFIGITEM + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.Norelation_ConfigItem + "&id=" + contract.account_id + "&contract_id=" + contract.id;
                    ShowTitle.Text = "配置项-" + contract.name;
                    break;

                case "charge":
                    viewContractIframe.Src = "../Common/SearchBodyFrame.aspx?isCheck=1&cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.CONTRACT_CHARGE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.Contract_Charge + "&id=" + contract.id;
                    ShowTitle.Text         = "成本-" + contract.name;
                    break;

                case "defaultCost":
                    viewContractIframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.CONTRACT_DEFAULT_COST + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.CONTRACT_DEFAULT_COST + "&id=" + contract.id;
                    ShowTitle.Text         = "默认成本-" + contract.name;
                    break;

                case "rate":
                    viewContractIframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.CONTRACT_TIME_RATE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.CONTRACT_RATE + "&id=" + contract.id;
                    ShowTitle.Text         = "预付时间系数-" + contract.name;
                    break;

                case "udf":
                    viewContractIframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CONTRACT_UDF + "&type=" + (int)QueryType.ContractUDF + "&id=" + contract.id;
                    ShowTitle.Text         = "自定义字段-" + contract.name;
                    break;

                case "block":
                    viewContractIframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CONTRACT_BLOCK + "&type=" + (int)QueryType.ContractBlock + "&id=" + contract.id;
                    ShowTitle.Text         = "预付费用-" + contract.name;
                    break;

                case "blockTime":
                    viewContractIframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CONTRACT_BLOCK_TIME + "&type=" + (int)QueryType.ContractBlockTime + "&id=" + contract.id;
                    ShowTitle.Text         = "预付时间-" + contract.name;
                    break;

                case "blockTicket":
                    viewContractIframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CONTRACT_BLOCK_TICKET + "&type=" + (int)QueryType.ContractBlockTicket + "&id=" + contract.id;
                    ShowTitle.Text         = "事件-" + contract.name;
                    break;

                case "roleRate":
                    viewContractIframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CONTRACT_RATE + "&type=" + (int)QueryType.ContractRate + "&id=" + contract.id;
                    ShowTitle.Text         = "费率-" + contract.name;
                    break;

                case "milestone":
                    viewContractIframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CONTRACT_MILESTONES + "&type=" + (int)QueryType.ContractMilestone + "&id=" + contract.id;
                    ShowTitle.Text         = "里程碑-" + contract.name;
                    break;

                case "service":
                    viewContractIframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CONTRACT_SERVICE + "&type=" + (int)QueryType.ContractService + "&id=" + contract.id;
                    second.Src             = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CONTRACT_SERVICE_TRANS_HISTORY + "&type=" + (int)QueryType.ContractServiceTransHistory + "&id=" + contract.id;
                    ShowTitle.Text         = "服务-" + contract.name;
                    break;

                case "note":

                    ShowTitle.Text         = "合同备注-" + contract.name + (conAccount == null?"":$"({conAccount.name})");
                    viewContractIframe.Src = "ContractNoteShow?contract_id=" + contract.id;
                    break;

                case "rule":
                    viewContractIframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CONTRACT_NOTIFY_RULE + "&type=" + (int)QueryType.CONTRACT_NOTIFY_RULE + "&id=" + contract.id;
                    // 通知发送规则 - 合同名称(客户名称); contract_notify_rule
                    ShowTitle.Text = "通知发送规则-" + contract.name + (conAccount == null ? "" : $"({conAccount.name})");
                    break;

                case "project":
                    viewContractIframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CONTRACT_PROJECT + "&type=" + (int)QueryType.CONTRACT_PROJECT + "&con1175=" + contract.id;
                    ShowTitle.Text         = "合同项目-" + contract.name + (conAccount == null ? "" : $"({conAccount.name})");
                    break;

                case "exclusions":
                    ShowTitle.Text         = "例外因素-" + contract.name + (conAccount == null ? "" : $"({conAccount.name})");
                    viewContractIframe.Src = "ContractExclusions?contract_id=" + contract.id;
                    break;

                case "ticket":
                    ShowTitle.Text         = "合同工单";
                    viewContractIframe.Src = "../Common/SearchFrameSet.aspx?cat=" + (int)DicEnum.QUERY_CATE.MY_QUEUE_ACTIVE + "&type=" + (int)QueryType.MY_QUEUE_ACTIVE + "&group=215&param1=4876&param2=" + contract.id + "&param4=AddHidden";
                    break;

                default:
                    ShowTitle.Text         = "摘要-" + contract.name;
                    viewContractIframe.Src = "ContractSummary.aspx?id=" + contract.id;

                    break;
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
Exemplo n.º 25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
                var soid = Request.QueryString["id"];
                if (AuthBLL.GetUserSaleorderAuth(LoginUserId, LoginUser.security_Level_id, Convert.ToInt64(soid)).CanEdit == false)
                {
                    Response.End();
                    return;
                }

                sale_order = new crm_sales_order_dal().GetSingleSalesOrderByWhere($" and id = {soid}");
                if (sale_order != null)
                {
                    sale_udfList      = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.SALES);
                    sale_udfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.SALES, sale_order.id, sale_udfList);
                    opportunity       = new crm_opportunity_dal().GetOpportunityById(sale_order.opportunity_id);
                    if (!IsPostBack)
                    {
                        var contactList = new crm_contact_dal().GetContactByAccountId(opportunity.account_id);


                        #region  拉赋值
                        status_id.DataTextField  = "show";
                        status_id.DataValueField = "val";
                        status_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "sales_order_status").Value;
                        status_id.DataBind();
                        status_id.Items.Insert(0, new ListItem()
                        {
                            Value = "0", Text = "   ", Selected = true
                        });

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

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

                        ship_country_id.DataTextField  = "show";
                        ship_country_id.DataValueField = "val";
                        ship_country_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "country").Value;
                        ship_country_id.DataBind();
                        ship_country_id.Items.Insert(0, new ListItem()
                        {
                            Value = "0", Text = "   ", Selected = true
                        });
                        ship_country_id.SelectedValue = "1";
                        // contact_id
                        contact_id.DataTextField  = "name";
                        contact_id.DataValueField = "id";
                        contact_id.DataSource     = contactList.Where(_ => _.is_active == 1).ToList();
                        contact_id.DataBind();
                        contact_id.Items.Insert(0, new ListItem()
                        {
                            Value = "0", Text = "   ", Selected = true
                        });
                        if (sale_order.contact_id != null)
                        {
                            contact_id.SelectedValue = sale_order.contact_id.ToString();
                        }

                        #endregion
                        billTo_use_account_address.Checked = sale_order.bill_to_use_account_address == 1;
                        shipTo_use_account_address.Checked = sale_order.ship_to_use_account_address == 1;
                        shipTo_use_bill_to_address.Checked = sale_order.ship_to_use_bill_to_address == 1;

                        status_id.SelectedValue         = sale_order.status_id.ToString();
                        owner_resource_id.SelectedValue = sale_order.owner_resource_id.ToString();
                    }
                }
                else
                {
                    Response.End();
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
Exemplo n.º 26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var id = Request.QueryString["id"];

                if (AuthBLL.GetUserOppAuth(LoginUserId, LoginUser.security_Level_id, Convert.ToInt64(id)).CanView == false)
                {
                    Response.End();
                    return;
                }

                opportunity = new crm_opportunity_dal().GetOpportunityByOtherId(Convert.ToInt64(id));
                type        = Request.QueryString["type"];

                if (opportunity != null)
                {
                    dic       = new OpportunityBLL().GetField();
                    quoteList = new crm_quote_dal().GetQuoteByOpportunityId(opportunity.id);
                    account   = new CompanyBLL().GetCompany(opportunity.account_id);
                    if (opportunity.contact_id != null)
                    {
                        contact = new ContactBLL().GetContact((long)opportunity.contact_id);
                    }
                    thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath + "?id=" + opportunity.id, LoginUserId);



                    switch (type)    // 根据传过来的不同的类型,为页面中的iframe控件选择不同的src
                    {
                    case "todo":
                        iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.TODOS + "&type=" + (int)QueryType.Todos + "&group=112&con660=" + opportunity.id + "&param1=opportunityId&param2=" + opportunity.id;                                  // 待办
                        actType   = "待办";
                        break;

                    case "note":
                        iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CRM_NOTE_SEARCH + "&type=" + (int)QueryType.CRMNote + "&group=110&con647=" + opportunity.id + "&param1=opportunityId&param2=" + opportunity.id;                                 // 备注
                        actType   = "备注";
                        break;

                    case "activity":
                        iframeSrc = "";                                  // 活动
                        actType   = "活动";
                        break;

                    case "ticket":
                        iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.MY_QUEUE_ACTIVE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.MY_QUEUE_ACTIVE + "&group=215&con5603=" + opportunity.id + "&param1=ShowPara";
                        actType   = "工单";
                        break;

                    case "quoteItem":
                        var oppoQuoteList = new crm_quote_dal().GetQuoteByWhere($" and opportunity_id = {opportunity.id} ");

                        if (oppoQuoteList != null && oppoQuoteList.Count > 0)
                        {
                            iframeSrc        = "../QuoteItem/QuoteItemManage?isShow=show&opportunity_id=" + opportunity.id; // 报价项
                            isAddQuote.Value = "0";
                        }
                        else
                        {
                            isAddQuote.Value = "1";
                            //ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script>if(confirm('商机尚未创建报价,需要现在创建吗?')){window.open('../Quote/QuoteAddAndUpdate.aspx?quote_opportunity_id=" + opportunity.id + "', '" + (int)EMT.DoneNOW.DTO.OpenWindow.QuoteAdd + "', 'left=200,top=200,width=960,height=750', false);}</script>");
                            //Response.Write("<script>debugger;</script>");
                        }

                        actType = "报价项";
                        break;

                    case "att":
                        iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.OPPORTUNITY_VIEW_ATTACHMENT + "&type=" + (int)QueryType.OpportunityViewAttachment + "&con976=" + opportunity.id;
                        actType   = "附件";
                        break;

                    default:
                        iframeSrc = "";      // 默认
                        actType   = "活动";
                        type      = "activity";
                        break;
                    }
                    if (type == "activity" || type == "note" || type == "todo")
                    {
                        isHide.Value = "show";
                    }
                    if (type.Equals("activity"))
                    {
                        var typeList = new ActivityBLL().GetCRMActionType();
                        noteType.DataSource     = typeList;
                        noteType.DataTextField  = "name";
                        noteType.DataValueField = "id";
                        noteType.DataBind();
                    }
                }
                else
                {
                    Response.End();
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
Exemplo n.º 27
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);
        }
Exemplo n.º 28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
                //var checkLimitType = Request.QueryString["type_id"];
                //if (checkLimitType == ((int)DicEnum.PROJECT_TYPE.ACCOUNT_PROJECT).ToString() || checkLimitType == ((int)DicEnum.PROJECT_TYPE.IN_PROJECT).ToString())
                //{
                //    var result = GetLimitValue(AuthLimitEnum.PROClientAdd);
                //    if (result == DicEnum.LIMIT_TYPE_VALUE.NO960)
                //    {
                //        Response.Write("alert(没有新增项目权限);window.close();");
                //        return;
                //    }

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

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


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

                if (thisProject != null)
                {
                    #region 根据项目信息为页面数据赋值
                    if (!IsPostBack)
                    {
                        line_of_business_id.SelectedValue      = thisProject.line_of_business_id == null ? "0" : thisProject.line_of_business_id.ToString();
                        type_id.SelectedValue                  = thisProject.type_id == null ? "0" : thisProject.type_id.ToString();
                        status_id.SelectedValue                = thisProject.status_id.ToString();
                        department_id.SelectedValue            = thisProject.department_id == null ? "0" : thisProject.department_id.ToString();
                        organization_location_id.SelectedValue = thisProject.organization_location_id.ToString();
                        template_id.SelectedValue              = thisProject.template_id == null ? "0" : thisProject.template_id.ToString();
                        useResource_daily_hours.Checked        = thisProject.use_resource_daily_hours == 1;
                        owner_resource_id.SelectedValue        = thisProject.owner_resource_id == null ? "0" : thisProject.owner_resource_id.ToString();
                        excludeWeekend.Checked                 = thisProject.exclude_weekend == 1;
                        excludeHoliday.Checked                 = thisProject.exclude_holiday == 1;
                        warnTime_off.Checked = thisProject.warn_time_off == 1;
                        if (!string.IsNullOrEmpty(isTemp))
                        {
                            is_active.Checked = thisProject.status_id == (int)DicEnum.PROJECT_STATUS.NEW;
                        }
                    }
                    #endregion
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }
Exemplo n.º 29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
                // quote_group_by

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


                isShow      = Request.QueryString["isShow"];
                IssaleOrder = !string.IsNullOrEmpty(Request.QueryString["isSaleOrder"]);
                var sid = Request.QueryString["sale_order_id"];
                if (!string.IsNullOrEmpty(sid))
                {
                    sale_order_id = long.Parse(sid);
                }


                var quote_id = Request.QueryString["quote_id"];
                if (!string.IsNullOrEmpty(quote_id))
                {
                    quote = new QuoteBLL().GetQuote(Convert.ToInt64(quote_id));

                    if (quote.quote_tmpl_id != null)
                    {
                        var sys_quote_temp = new QuoteTemplateBLL().GetQuoteTemplate((long)quote.quote_tmpl_id);
                        if (sys_quote_temp != null)
                        {
                            // 获取到该报价的报价模板用于设置税的显示方式和汇总名称
                            show_each_tax_in_tax_group.Value  = sys_quote_temp.show_each_tax_in_tax_group.ToString();
                            show_each_tax_in_tax_period.Value = sys_quote_temp.show_each_tax_in_tax_period.ToString(); // 选中第一个:按照周期分组时起作用,每个周期后显示税 最后的汇总也有税)
                                                                                                                       // var a3 =sys_quote_temp.show_labels_when_grouped;  // 预留字段
                            show_tax_cate.Value             = sys_quote_temp.show_tax_cate.ToString();
                            show_tax_cate_superscript.Value = sys_quote_temp.show_tax_cate_superscript.ToString();
                        }
                    }
                }
                var opportunity_id = Request.QueryString["opportunity_id"];  // 这里是通过商机查看报价项的情况
                if (!string.IsNullOrEmpty(opportunity_id))
                {
                    var oppoQuoteList = new crm_quote_dal().GetQuoteByWhere($" and opportunity_id = {opportunity_id} ");

                    if (oppoQuoteList != null && oppoQuoteList.Count > 0)
                    {
                        quote = oppoQuoteList.FirstOrDefault(_ => _.is_primary_quote == 1);  // 如果该商机下有报价则一定会有主报价
                    }
                }

                if (quote != null)
                {
                    quoteItemList = new crm_quote_item_dal().GetQuoteItems($" and quote_id={quote.id} ");
                    // quoteItemList.Sort(SortCycle);  // 自定义排序测试
                    quoteItemList = quoteItemList.OrderBy(_ => SortQuoteItem(_.period_type_id)).ToList();
                    quoteList     = new crm_quote_dal().GetQuoteByWhere($" and opportunity_id = {quote.opportunity_id} ");
                    var primaryQuote = quoteList.FirstOrDefault(_ => _.is_primary_quote == 1);
                    if (primaryQuote != null)
                    {
                        var thisQuoteItemList = new crm_quote_item_dal().GetQuoteItems($" and quote_id={primaryQuote.id} ");


                        var thisDiscountQIList   = thisQuoteItemList.Where(_ => _.type_id == (int)DTO.DicEnum.QUOTE_ITEM_TYPE.DISCOUNT && _.optional == 0).ToList();
                        var thisOneTimeQTList    = thisQuoteItemList.Where(_ => _.period_type_id == (int)DTO.DicEnum.QUOTE_ITEM_PERIOD_TYPE.ONE_TIME && _.optional == 0).ToList();
                        var thisOptionalItemList = thisQuoteItemList.Where(_ => _.optional == 1).ToList();

                        var totalPrice = ((decimal)((thisQuoteItemList.Sum(_ => (_.unit_discount != null && _.unit_price != null && _.quantity != null) ? (_.unit_price - _.unit_discount) * _.quantity : 0) - thisDiscountQIList.Where(_ => _.discount_percent != null).ToList().Sum(_ => (_.unit_discount != null && _.quantity != null) ? _.unit_discount * _.quantity : 0) - (thisOneTimeQTList != null && thisOneTimeQTList.Count > 0 ? thisDiscountQIList.Where(_ => _.discount_percent != null).ToList().Sum(_ => thisOneTimeQTList.Sum(one => (one.unit_discount != null && one.unit_price != null && one.quantity != null) ? (one.unit_price - one.unit_discount) * one.quantity : 0) * _.discount_percent) : 0)))).ToString("#0.00");
                        quoteList.Remove(primaryQuote);
                        primaryQuote.name = "PRIMARY:" + primaryQuote.name + "(" + totalPrice + ")";
                        quoteList.Add(primaryQuote);
                    }


                    #region // 为报价下拉框赋值
                    quoteDropList.DataValueField = "id";
                    quoteDropList.DataTextField  = "name";
                    quoteDropList.DataSource     = quoteList;
                    quoteDropList.DataBind();
                    quoteDropList.SelectedValue = quote.id.ToString();
                    #endregion
                    if (quoteItemList != null && quoteItemList.Count > 0)
                    {
                        // 用户需要添加折扣类型的报价项,然后可以针对付费周期类型为一次性的报价项进行折扣
                        // 折扣只针对一次性周期的报价项折扣
                        oneTimeList = quoteItemList.Where(_ => _.period_type_id == (int)DTO.DicEnum.QUOTE_ITEM_PERIOD_TYPE.ONE_TIME && _.optional == 0 && _.type_id != (int)DTO.DicEnum.QUOTE_ITEM_TYPE.DISCOUNT && _.type_id != (int)DTO.DicEnum.QUOTE_ITEM_TYPE.DISTRIBUTION_EXPENSES).ToList();

                        discountQIList = quoteItemList.Where(_ => _.type_id == (int)DTO.DicEnum.QUOTE_ITEM_TYPE.DISCOUNT && _.optional == 0).ToList();

                        //  获取到可选的报价项,
                        optionalItemList = quoteItemList.Where(_ => _.optional == 1).ToList();   // 获取到可选的报价项
                        // optionalItemList.Sort();

                        // &&optionalItemList.Any(op=>op.id!=_.id)&&oneTimeList.Any(one=>one.id!=_.id)  满足多个报价项过滤条件的,选择其中的一个
                        distributionList = quoteItemList.Where(_ => _.type_id == (int)DTO.DicEnum.QUOTE_ITEM_TYPE.DISTRIBUTION_EXPENSES && _.optional == 0).ToList();   // 配送类型的报价项

                        // 配送,一次性,可选的配置项独立显示,所以在这里分离出来,传到前台后单独处理

                        //  获取到筛选后报价项列表方便分组管理  筛选后的列表不包括可选,一次性的折扣和配送
                        var screenList = quoteItemList.Where(_ => _.type_id != (int)EMT.DoneNOW.DTO.DicEnum.QUOTE_ITEM_TYPE.DISTRIBUTION_EXPENSES && _.optional != 1 && _.type_id != (int)DTO.DicEnum.QUOTE_ITEM_TYPE.DISCOUNT).ToList();

                        if (!string.IsNullOrEmpty(Request.QueryString["group_by"]))
                        {
                            groupByType = Request.QueryString["group_by"];
                        }
                        else
                        {
                            if (quote.group_by_id != null)
                            {
                                groupByType = ((long)quote.group_by_id).ToString();
                            }
                        }
                        //  groupByType = ?((long)quote.group_by_id).ToString():Request.QueryString["group_by"];
                        if (groupByType == ((int)EMT.DoneNOW.DTO.DicEnum.QUOTE_GROUP_BY.CYCLE).ToString())                                                                      // 按周期分组
                        {
                            groupList = screenList.GroupBy(_ => _.period_type_id == null ? "" : _.period_type_id.ToString()).ToDictionary(_ => (object)_.Key, _ => _.ToList()); // as Dictionary<long?,
                            new QuoteBLL().UpdateGroup(quote.id, (int)QUOTE_GROUP_BY.CYCLE, GetLoginUserId());
                            groupBy.SelectedValue = ((int)QUOTE_GROUP_BY.CYCLE).ToString();
                        }
                        else if (groupByType == ((int)QUOTE_GROUP_BY.PRODUCT).ToString())  // 按产品分组
                        {
                            groupList = screenList.GroupBy(_ => _.object_id == null ? "" : ReturnProductID((long)_.object_id)).ToDictionary(_ => (object)_.Key, _ => _.ToList());
                            new QuoteBLL().UpdateGroup(quote.id, (int)QUOTE_GROUP_BY.PRODUCT, GetLoginUserId());
                            groupBy.SelectedValue = ((int)QUOTE_GROUP_BY.PRODUCT).ToString();
                        }
                        else if (groupByType == ((int)QUOTE_GROUP_BY.CYCLE_PRODUCT).ToString())   // 按周期产品分组
                        {
                            new QuoteBLL().UpdateGroup(quote.id, (int)QUOTE_GROUP_BY.CYCLE_PRODUCT, GetLoginUserId());
                            groupBy.SelectedValue = ((int)QUOTE_GROUP_BY.CYCLE_PRODUCT).ToString();
                            doubleGroupList       = screenList.GroupBy(d => d.period_type_id == null ? "" : d.period_type_id.ToString()).ToDictionary(_ => (object)_.Key, _ => _.ToList().GroupBy(d => d.object_id == null ? "" : ReturnProductID((long)d.object_id)).ToDictionary(d => (object)d.Key, d => d.ToList()));
                        }
                        else if (groupByType == ((int)QUOTE_GROUP_BY.PRODUCT_CYCLE).ToString()) // 按产品周期分组
                        {
                            new QuoteBLL().UpdateGroup(quote.id, (int)QUOTE_GROUP_BY.PRODUCT_CYCLE, GetLoginUserId());
                            groupBy.SelectedValue = ((int)QUOTE_GROUP_BY.PRODUCT_CYCLE).ToString();
                            doubleGroupList       = screenList.GroupBy(_ => _.object_id == null ? "" : ReturnProductID((long)_.object_id)).ToDictionary(_ => (object)_.Key, _ => _.ToList().GroupBy(d => d.period_type_id == null ? "" : d.period_type_id.ToString()).ToDictionary(d => (object)d.Key, d => d.ToList()));
                        }
                        else // 不分组
                        {
                            new QuoteBLL().UpdateGroup(quote.id, (int)QUOTE_GROUP_BY.NO, GetLoginUserId());
                            groupBy.SelectedValue = ((int)QUOTE_GROUP_BY.NO).ToString();
                        }
                        //switch (groupByType)
                        //{
                        //    case "cycle":
                        //        // 按照周期分组
                        //        break;
                        //    case "product":
                        //        break;
                        //    default:
                        //        groupByType = "no";
                        //        break;
                        //}
                        // ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script> $(\"#groupBy\").val('"+groupBy+"')</script>");
                        if (discountQIList != null && discountQIList.Count > 0)
                        {
                            discountQIList.ForEach(_ => { if (_.discount_percent != null)
                                                          {
                                                              _.discount_percent = _.discount_percent / 100;
                                                          }
                                                   });
                        }
                    }
                }
                else
                {
                    Response.End();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var contract_id = Convert.ToInt64(Request.QueryString["id"]);

            thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
            contract     = bll.GetContractEdit(contract_id);

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

            contractCate     = dics["cate"] as List <DictionaryEntryDto>;
            periodType       = dics["periodType"] as List <DictionaryEntryDto>;
            billPostType     = dics["billPostType"] as List <DictionaryEntryDto>;
            contractTypeName = bll.GetContractTypeName(contract.contract.type_id);
            slaList          = bll.GetSLAList();
            udfList          = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.CONTRACTS);
            udfValues        = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.CONTRACTS, contract_id, udfList);

            if (!IsPostBack)
            {
                // 绑定联系人列表
                var contactList = new ContactBLL().GetContactByCompany(contract.contract.account_id);
                contact_id.DataTextField  = "name";
                contact_id.DataValueField = "id";
                contact_id.DataSource     = contactList;
                contact_id.DataBind();
                if (contract.contract.contact_id == null)
                {
                    contact_id.Items.Insert(0, new ListItem()
                    {
                        Value = "", Text = "   ", Selected = true
                    });
                }
                else
                {
                    contact_id.Items.Insert(0, new ListItem()
                    {
                        Value = "", Text = "   "
                    });
                    contact_id.SelectedValue = ((long)contract.contract.contact_id).ToString();
                }

                // 绑定商机列表
                var oppList = new OpportunityBLL().GetOpportunityByCompany(contract.contract.account_id);
                opportunity_id.DataTextField  = "name";
                opportunity_id.DataValueField = "id";
                opportunity_id.DataSource     = oppList;
                opportunity_id.DataBind();
                if (contract.contract.opportunity_id == null)
                {
                    opportunity_id.Items.Insert(0, new ListItem()
                    {
                        Value = "", Text = "   ", Selected = true
                    });
                }
                else
                {
                    opportunity_id.Items.Insert(0, new ListItem()
                    {
                        Value = "", Text = "   "
                    });
                    opportunity_id.SelectedValue = ((long)contract.contract.opportunity_id).ToString();
                }

                // 绑定通知联系人列表
                if (contract.contract.type_id == (int)DicEnum.CONTRACT_TYPE.SERVICE)
                {
                    if (contract.contract.bill_to_account_id == null)
                    {
                        bill_to_contact_id.Enabled = false;
                    }
                    else
                    {
                        var billContact = new ContactBLL().GetContactByCompany(contract.contract.account_id);
                        bill_to_contact_id.DataTextField  = "name";
                        bill_to_contact_id.DataValueField = "id";
                        bill_to_contact_id.DataSource     = billContact;
                        bill_to_contact_id.DataBind();
                        if (contract.contract.bill_to_contact_id == null)
                        {
                            bill_to_contact_id.Items.Insert(0, new ListItem()
                            {
                                Value = "", Text = "   ", Selected = true
                            });
                        }
                        else
                        {
                            bill_to_contact_id.Items.Insert(0, new ListItem()
                            {
                                Value = "", Text = "   "
                            });
                            bill_to_contact_id.SelectedValue = ((long)contract.contract.bill_to_contact_id).ToString();
                        }
                    }
                }
                else
                {
                    if (contract.contract.bill_to_account_id == null)
                    {
                        bill_to_contact_id1.Enabled = false;
                    }
                    else
                    {
                        var billContact = new ContactBLL().GetContactByCompany(contract.contract.account_id);
                        bill_to_contact_id1.DataTextField  = "name";
                        bill_to_contact_id1.DataValueField = "id";
                        bill_to_contact_id1.DataSource     = billContact;
                        bill_to_contact_id1.DataBind();
                        if (contract.contract.bill_to_contact_id == null)
                        {
                            bill_to_contact_id1.Items.Insert(0, new ListItem()
                            {
                                Value = "", Text = "   ", Selected = true
                            });
                        }
                        else
                        {
                            bill_to_contact_id1.Items.Insert(0, new ListItem()
                            {
                                Value = "", Text = "   "
                            });
                            bill_to_contact_id1.SelectedValue = ((long)contract.contract.bill_to_contact_id).ToString();
                        }
                    }
                }
            }
            else
            {
                SaveClose_Click();
            }
        }