• Javascript 弹出窗体


    JS代码:

    item.id = document.getElementById(id).value;

    myDialogArguments.items = new Array();

    if (item.id != "") {
    myDialogArguments.items[0] = item;
    }
    var url = 'http://www.cnblogs.com/_controls/lookup/lookupsingle.aspx?class=BasicOwner&objecttypes=8&browse=0&ShowNewButton=1&ShowPropButton=1&DefaultType=0';
    var obj = window.showModalDialog(url, myDialogArguments, "");

    try {
    if (obj.items != null && obj.items != undefined) {

    try {
    if (((obj.items[0].id).replace("{", "")).replace("}", "") == document.getElementById("txtCurrentid").value.toUpperCase()) {
    alert("不能转移待处理项给自己");
    return;
    }
    document.getElementById(id).value = obj.items[0].id
    document.getElementById(name).value = obj.items[0].name;
    $("#txtOtherUser").addClass("txtboxadd");

    } catch (e) {

    document.getElementById(id).value = "";
    document.getElementById(name).value = "";
    $("#txtOtherUser").removeClass("txtboxadd");
    }

    } else {

    document.getElementById(id).value = "";
    document.getElementById(name).value = "";
    ("#txtOtherUser").removeClass("txtboxadd");

    }

    } catch (e) {

    }
    }

    aspx:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="pendItemlist.aspx.cs" Inherits="Frensworkz.CRM.XCMGCC.Web.ISV.tanhua.pendItemlist" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title>待处理项</title>
    <script src="/ISV/tanhua/js/jquery-1.8.2.min.js" type="text/javascript"></script>
    <script src="/ISV/tanhua/js/setLookup.js" type="text/javascript"></script>
    <link href="/ISV/tanhua/style/noitem.css" rel="stylesheet" type="text/css" />
    <script src="/ISV/tanhua/js/juge.js" type="text/javascript"></script>
    <%-- <script src="../CTI/Scripts/JS/js/jquery.1.7.2.min.js" type="text/javascript"></script>--%>
    </head>

    <body>
    <form id="form1" runat="server">
    <div class="wrapmiddle">
    <ul style="margin:0; padding:0;">
    <li><asp:Label ID="Label1" runat="server" CssClass="labetop"></asp:Label></li>
    </ul>
    </div>

    <div class="wrapmiddle">
    <ul style="margin:0; padding:0;">
    <li><asp:Label ID="Label12" runat="server" Text="当前用户:" CssClass="labelp"> </asp:Label></li>
    <li> <asp:TextBox ID="txtCurrentUser" runat="server" ReadOnly="True" CssClass="txtboxlpcomm"></asp:TextBox></li>
    </ul>
    </div>

    <div class="wrapmiddle">
    <ul style="margin:0; padding:0;">
    <li><asp:Label ID="Label2" runat="server" Text="分派用户:" CssClass="labelp"></asp:Label></li>
    <li><asp:TextBox ID="txtOtherUser" runat="server" ReadOnly="True" CssClass="txtboxlp"></asp:TextBox></li>
    <li><img id="Img1" runat="server" src="/_imgs/btn_on_lookup.gif" class="imgok" onclick="OpenLookUp('txtOtherUser','txtOwnerId')"/></li>
    </ul>
    </div>

    <div class="wrapmiddle">
    <ul style="margin:0; padding:0;">
    <li><asp:Label ID="Label3" runat="server" Text="分派时间:" CssClass="labelp"></asp:Label></li>
    <li><asp:TextBox ID="txtAssginTime" runat="server" Text="" ReadOnly="True" CssClass="txtboxlpcomm"></asp:TextBox></li>
    </ul>
    </div>
    <div class="wrap">
    <asp:Button ID="btnAssgin" runat="server" Text="确认" OnClick="btnAssgin_Click" CssClass="buttonok" OnClientClick="return Juge();" />
    </div>

    <div class="wrapmiddle">
    <ul style="margin:0; padding:0;">
    <li><asp:Label ID="lbSuccessMsg" runat="server" Text="" CssClass="labebottom"></asp:Label></li>
    </ul>
    </div>

    <asp:HiddenField ID="txtCurrentid" runat="server" />
    <asp:HiddenField ID="txtOwnerId" runat="server"/>
    <asp:HiddenField ID="hfName" runat="server" />

    </form>
    </body>
    </html>

    using System;
    using System.Collections.Generic;

    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Collections;

    using Microsoft.Crm.Sdk;
    using Microsoft.Crm.Sdk.Utility;
    using Microsoft.Crm.Sdk.Query;
    using Microsoft.Crm.Sdk.Metadata;
    using Microsoft.Crm.SdkTypeProxy;
    using Frensworkz.CRM.XCMGCC.Web.Common;

    namespace Frensworkz.CRM.XCMGCC.Web.ISV.tanhua
    {
    public partial class pendItemlist : BasePage
    {
    protected void Page_Load(object sender, EventArgs e)
    {
    if (!IsPostBack)
    {
    IntiData(OrgService);
    }
    }

    #region 初始化数据
    /// <summary>
    /// 初始化数据
    /// </summary>
    /// <param name="service"></param>
    private void IntiData(CrmService service)
    {

    Guid ownid = Query.instance.GetUserId(service).UserId;

    txtCurrentid.Value = ownid.ToString();

    DynamicEntity dEntity = SystemUser;

    string name = Query.instance.GetAttributeValue<string>(dEntity, "fullname");

    txtCurrentUser.Text = name;

    GetToalCount(ownid, service);

    //获取当前日期
    txtAssginTime.Text = DateTime.Now.ToLocalTime().ToString();
    }
    #endregion

    #region 获取总记录数
    /// <summary>
    /// 获取总记录数
    /// </summary>
    /// <param name="ownid">负责人ID</param>
    /// <param name="service">服务</param>
    private void GetToalCount(Guid ownid, CrmService service)
    {

    int totalCount = GetCount(service, "task", ownid.ToString()) + GetCount(service, "fax", ownid.ToString()) + GetCount(service, "letter", ownid.ToString());
    Label1.Text = totalCount.ToString() + "条待处理项纪录";
    if (totalCount == 0)//当没有未处理项时,禁用确认按钮
    {
    this.btnAssgin.Enabled = false;
    }
    }
    #endregion

    #region 获取三个实体 派工提醒 响应回访 结案回访的信息
    /// <summary>
    /// 获取三个实体 派工提醒 响应回访 结案回访的信息
    /// </summary>
    /// <param name="owenid">负责人ID</param>
    /// <param name="statecode">状态</param>
    /// <param name="entityname">实体名称</param>
    public void GetFaxByOwenerid(CrmService service, Guid owenid, int statecode, string entityname)
    {

    //获取集合信息
    BusinessEntityCollection bussin = Query.instance.QueryByAttributee(service, entityname, new string[] { "ownerid", "statecode" }, new object[] { owenid, statecode }, null, null, new string[] { "ownerid", "activityid" });


    if (bussin.BusinessEntities.Count > 0)
    {
    //循环集合
    foreach (var item in bussin.BusinessEntities)
    {

    DynamicEntity td = (DynamicEntity)item;
    Key id = Query.instance.GetAttributeValue<Key>(td, "activityid");
    //实例化目标对象
    TargetOwnedDynamic target = new TargetOwnedDynamic();
    target.EntityId = id.Value;
    target.EntityName = td.Name;

    SecurityPrincipal securityPrincipal = new SecurityPrincipal();

    securityPrincipal.PrincipalId = new Guid(this.txtOwnerId.Value);
    securityPrincipal.Type = SecurityPrincipalType.User;

    Query.instance.AssignDynamicEntity(service, target, securityPrincipal);//分派记录

    }
    }

    }
    #endregion

    #region 转移待处理项
    protected void btnAssgin_Click(object sender, EventArgs e)
    {
    var service = OrgService;

    Guid ownid = new Guid(this.txtCurrentid.Value);//获取当前用户的ID
    int totalCount = GetCount(service, "task", ownid.ToString()) + GetCount(service, "fax", ownid.ToString()) + GetCount(service, "letter", ownid.ToString());

    if (ownid == Guid.Empty) return;
    if (!string.IsNullOrEmpty(txtCurrentid.Value) && !string.IsNullOrEmpty(txtOwnerId.Value))
    {
    GetFaxByOwenerid(service,ownid, 0, "task");
    GetFaxByOwenerid(service,ownid, 0, "fax");
    GetFaxByOwenerid(service,ownid, 0, "letter");

    this.lbSuccessMsg.Text = "成功转移" + totalCount.ToString()+"项";

    string to = Query.instance.GetEntityrAttr<string>(service, "systemuser", new Guid(this.txtOwnerId.Value), "fullname");

    PublishNew(Query.instance.GetAttributeValue<string>(SystemUser, "fullname"), to, totalCount, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
    IntiData(service);
    }

    }
    #endregion

    #region 获取每个实体的未处理项记录数
    /// <summary>
    /// 获取每个实体的未处理项记录数
    /// </summary>
    /// <param name="service">服务</param>
    /// <param name="entityName">实体名称</param>
    /// <param name="owenid">负责人ID</param>
    /// <returns>返回int</returns>
    public int GetCount(CrmService service, string entityName, string owenid)
    {
    //获取集合信息
    BusinessEntityCollection bussin = Query.instance.QueryByAttributee(service, entityName, new string[] { "ownerid", "statecode" }, new object[] { owenid, 0 }, null, null, new string[] { "ownerid", "activityid" });
    return bussin.BusinessEntities.Count;
    }
    #endregion

    #region 创建公告的方法
    /// <summary>
    /// 创建公告的方法
    /// </summary>
    /// <param name="from">当前人姓名</param>
    /// <param name="to">转移人姓名 </param>
    /// <param name="count">数量</param>
    /// <param name="dateTime">格式化后的时间</param>
    public void PublishNew(string from, string to, int count, string dateTime)
    {
    businessunitnewsarticle entity = new businessunitnewsarticle();
    entity.articletitle = dateTime + "转移任务";

    try
    {
    entity.newsarticle = string.Format("{0}转移了{1}项待处理任务给{2}", from, count, to);
    OrgService.Create(entity);
    }
    catch (System.Web.Services.Protocols.SoapException ex)
    {

    this.lbSuccessMsg.Text = ex.Detail.InnerText + ex.Detail.InnerXml;
    }
    catch (Exception ex)
    {
    this.lbSuccessMsg.Text =ex.Message+from+to;

    }

    }
    #endregion

    }
    }

    css:

    body{ background:#EAF3FF;}
    form{ margin:0; padding:0;}
    .wrap{ 100%; height:25px; line-height:25px; margin:0 auto 20px auto; padding-left:30px;}
    .wrapmiddle{ 100%; height:22px; line-height:20px; margin:0 auto 20px auto; padding-left:30px;}
    .wrapmiddle li{ list-style:none; float:left; line-height:20px; height:20px;}

    .buttonok{ background-color:rgb(206,231,255); background-image:url("/_imgs/btn_rest.gif"); background-repeat:repeat-x; border:1px solid #3366cc; cursor:pointer; direction:ltr; font-family:Tahoma; font-size:11px; height:20px; line-height:18px; overflow:visible; padding-left:5px; padding-right:5px; text-align:center; 84px;margin-top:1px;}
    .labelp{ font-family:Tahoma, Verdana, Arial; font-size:11px; cursor:hand;line-height:20px;height:20px;}
    .labetop{ font-family:Tahoma, Verdana, Arial; font-size:11px; cursor:hand; padding-left:5px;line-height:20px;height: 20px;}
    .labebottom{ font-family:Tahoma, Verdana, Arial; font-size:11px; cursor:hand; padding-left:5px;line-height:20px;height: 20px;}
    .imgok{cursor:hand; direction:ltr; font-family:Tahoma,Tahoma, Verdana, Arial; font-size:11px;ime-mode:auto; text-align:right; height:20px; line-height:20px; padding-top:1px;vertical-align:middle;}
    .txtboxlp{ border:solid #6699cc 1px; color:#000000;line-height:15px;height: 15px;padding-left:20px;font-family:Tahoma, Verdana, Arial; font-size:11px; 180px; padding-top:2px;}

    .txtboxadd{background:#FFFFFF;background:url(/_imgs/ico_16_8.gif) no-repeat; padding-left:20px;background-color:White;}

    .txtboxlpcomm{ border:solid #6699cc 1px; color:#000000;line-height:15px;height: 15px;font-family:Tahoma, Verdana, Arial; font-size:11px; 220px; padding-top:2px; background:#EAF3FF;}
    .ms_crm_lookupitem{ color:#0000ff; cursor:hand; direction:ltr; font-family:Tahoma, Verdana, Arial; font-size:11px; margin-right:5px; vertical-align:middle;}

  • 相关阅读:
    jstat使用
    oracle 定期copy 大表统计信息(分区表)
    PL/SQL注册码
    Linux系统--命令行安装weblogic10.3.6
    oracle 11.2.0.4 dbca创建数据库时 报错ORA-12532
    自动重建索引脚本
    oracle 添加登陆数据库触发器--记录IP 地址
    oracle 触发器
    oracle 定位SQL
    查询rman 备份信息集
  • 原文地址:https://www.cnblogs.com/allenhua/p/2748785.html
Copyright © 2020-2023  润新知