示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["User"] == null)
        {
            Response.End();
        }
        m_User = (CUser)Session["User"];

        string vid = Request["vid"];

        if (string.IsNullOrEmpty(vid))
        {
            Response.End();
        }

        m_View = (CView)Global.GetCtx(Session["TopCompany"].ToString()).ViewMgr.Find(new Guid(vid));
        if (m_View == null)
        {
            Response.End();
        }
        m_ViewDetail = (CViewDetail)m_View.ViewDetailMgr.GetFirstObj();
        if (m_ViewDetail == null)
        {
            Response.End();
        }
        m_Table = (CTable)Global.GetCtx(Session["TopCompany"].ToString()).TableMgr.Find(m_ViewDetail.FW_Table_id);

        m_sortRestrictColumnAccessType = m_User.GetRestrictColumnAccessTypeList(m_Table);

        string id = Request["id"];

        if (string.IsNullOrEmpty(id))
        {
            Response.End();
        }

        if (Session["EditMasterDetailViewRecord"] == null)
        {
            Response.End();
        }
        SortedList <Guid, CBaseObject> arrP = (SortedList <Guid, CBaseObject>)Session["EditMasterDetailViewRecord"];
        CBaseObject objP = arrP.Values[0];

        m_BaseObjectMgr = objP.GetSubObjectMgr(m_Table.Code, typeof(CBaseObjectMgr));

        m_BaseObject = m_BaseObjectMgr.Find(new Guid(id));
        if (m_BaseObject == null)
        {
            Response.Write("请选择记录!");
            Response.End();
        }

        if (!IsPostBack)
        {
            recordCtrl.m_ViewDetail = m_ViewDetail;
            recordCtrl.m_Table      = m_Table;
            recordCtrl.m_sortRestrictColumnAccessType = m_sortRestrictColumnAccessType;
            recordCtrl.m_BaseObject = m_BaseObject;
            if (!string.IsNullOrEmpty(Request["UIColCount"]))
            {
                recordCtrl.m_iUIColCount = Convert.ToInt32(Request["UIColCount"]);
            }
            //隐藏字段
            string sHideCols = Request["HideCols"];
            if (!string.IsNullOrEmpty(sHideCols))
            {
                string[] arr = sHideCols.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                foreach (string code in arr)
                {
                    recordCtrl.m_sortHideColumn.Add(code, code);
                }
            }
        }
        if (Request.Params["Action"] == "Cancel")
        {
            Response.End();
        }
        else if (Request.Params["Action"] == "PostData")
        {
            PostData();
            Response.End();
        }
    }
示例#2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string tid = Request["tid"];

        if (string.IsNullOrEmpty(tid))
        {
            Response.Write("请选择表!");
            Response.End();
        }
        m_Table = (CTable)Global.GetCtx(Session["TopCompany"].ToString()).TableMgr.Find(new Guid(tid));
        string id = Request["id"];

        if (string.IsNullOrEmpty(id))
        {
            Response.Write("请选择记录!");
            Response.End();
        }
        string ParentId = Request["ParentId"];

        if (!string.IsNullOrEmpty(ParentId))
        {
            m_guidParentId = new Guid(ParentId);
        }


        m_BaseObjectMgr = Global.GetCtx(Session["TopCompany"].ToString()).FindBaseObjectMgrCache(m_Table.Code, m_guidParentId);
        if (m_BaseObjectMgr == null)
        {
            m_BaseObjectMgr        = new CBaseObjectMgr();
            m_BaseObjectMgr.TbCode = m_Table.Code;
            m_BaseObjectMgr.Ctx    = Global.GetCtx(Session["TopCompany"].ToString());
            string sWhere = string.Format(" id='{0}'", id);
            m_BaseObjectMgr.GetList(sWhere);
        }
        m_BaseObject = m_BaseObjectMgr.Find(new Guid(id));
        if (m_BaseObject == null)
        {
            Response.Write("请选择记录!");
            Response.End();
        }

        //保存到编辑对象
        EditObject.Add(Session.SessionID, m_BaseObject);

        if (!IsPostBack)
        {
            recordCtrl.m_Table = m_Table;
            //recordCtrl.m_sortRestrictColumnAccessType = m_sortRestrictColumnAccessType;
            recordCtrl.m_BaseObject = m_BaseObject;
        }
        if (Request.Params["Action"] == "Cancel")
        {
            m_BaseObject.Cancel();
            Response.End();
        }
        else if (Request.Params["Action"] == "PostData")
        {
            PostData();
            //从编辑对象移除
            EditObject.Remove(Session.SessionID, m_BaseObject);

            Response.End();
        }
    }
示例#3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["User"] == null)
        {
            Response.Redirect("../Login.aspx");
            Response.End();
        }
        m_User = (CUser)Session["User"];

        m_Company = (CCompany)Global.GetCtx(Session["TopCompany"].ToString()).CompanyMgr.Find(m_User.B_Company_id);

        string TbCode         = Request["TbCode"];
        string id             = Request["id"];
        string WF_Workflow_id = Request["WF_Workflow_id"];

        if (string.IsNullOrEmpty(TbCode) ||
            string.IsNullOrEmpty(id) ||
            string.IsNullOrEmpty(WF_Workflow_id))
        {
            Response.Write("数据不完整!");
            Response.End();
            return;
        }

        string ParentId = Request["ParentId"];

        if (!string.IsNullOrEmpty(ParentId))
        {
            m_guidParentId = new Guid(ParentId);
        }

        m_BaseObjectMgr = Global.GetCtx(Session["TopCompany"].ToString()).FindBaseObjectMgrCache(TbCode, m_guidParentId);
        if (m_BaseObjectMgr == null)
        {
            m_BaseObjectMgr        = new CBaseObjectMgr();
            m_BaseObjectMgr.TbCode = TbCode;
            m_BaseObjectMgr.Ctx    = Global.GetCtx(Session["TopCompany"].ToString());
        }

        m_BaseObject = m_BaseObjectMgr.Find(new Guid(id));

        m_Workflow = (CWorkflow)m_BaseObjectMgr.WorkflowMgr.Find(new Guid(WF_Workflow_id));
        if (m_Workflow.State != enumApprovalState.Running)
        {
            Response.Write("只有进行中的工作流才能审批!");
            Response.End();
            return;
        }
        m_Actives = m_Workflow.ActivesMgr.FindNotApproval();
        if (m_Actives == null)
        {
            Response.Write("没有审批的活动!");
            Response.End();
            return;
        }

        if (m_Actives.AType == "按用户")
        {
            if (m_Actives.B_User_id != m_User.Id)
            {
                Response.Write("没有权限审批!");
                Response.End();
                return;
            }
        }
        else //按角色
        {
            CRole Role = (CRole)m_Company.RoleMgr.Find(m_Actives.B_Role_id);
            if (Role == null || Role.UserInRoleMgr.FindByUserid(m_User.Id) == null)
            {
                Response.Write("没有权限审批!");
                Response.End();
                return;
            }
        }

        if (Request.Params["Action"] == "Accept")
        {
            Accept();
            Response.End();
        }
        else if (Request.Params["Action"] == "Reject")
        {
            Reject();
            Response.End();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["User"] == null)
        {
            Response.Redirect("../Login.aspx");
            Response.End();
        }
        m_User = (CUser)Session["User"];

        m_Company = (CCompany)Global.GetCtx(Session["TopCompany"].ToString()).CompanyMgr.Find(m_User.B_Company_id);


        string TbCode = Request["TbCode"];
        string id     = Request["id"];

        if (string.IsNullOrEmpty(TbCode) ||
            string.IsNullOrEmpty(id))
        {
            Response.Write("数据不完整!");
            Response.End();
            return;
        }

        string ParentId = Request["ParentId"];

        if (!string.IsNullOrEmpty(ParentId))
        {
            m_guidParentId = new Guid(ParentId);
        }


        m_BaseObjectMgr = Global.GetCtx(Session["TopCompany"].ToString()).FindBaseObjectMgrCache(TbCode, m_guidParentId);
        if (m_BaseObjectMgr == null)
        {
            m_BaseObjectMgr        = new CBaseObjectMgr();
            m_BaseObjectMgr.TbCode = TbCode;
            m_BaseObjectMgr.Ctx    = Global.GetCtx(Session["TopCompany"].ToString());
        }
        m_BaseObjectMgr.GetList();

        m_BaseObject = m_BaseObjectMgr.Find(new Guid(id));

        if (Request.Params["Action"] == "GetData")
        {
            GetData();
            Response.End();
        }
        else if (Request.Params["Action"] == "GetActivesData")
        {
            GetActivesData();
            Response.End();
        }
        else if (Request.Params["Action"] == "CancelWF")
        {
            CancelWF();
            Response.End();
        }
        else if (Request.Params["Action"] == "CanApproval")
        {
            CanApproval();
            Response.End();
        }
    }
示例#5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["User"] == null)
        {
            Response.End();
        }
        m_User = (CUser)Session["User"];

        string vid = Request["vid"];

        if (string.IsNullOrEmpty(vid))
        {
            Response.End();
        }
        m_View = (CView)Global.GetCtx(Session["TopCompany"].ToString()).ViewMgr.Find(new Guid(vid));
        if (m_View == null)
        {
            Response.End();
        }
        m_Table = (CTable)Global.GetCtx(Session["TopCompany"].ToString()).TableMgr.Find(m_View.FW_Table_id);

        //检查权限
        if (!CheckAccess())
        {
            Response.End();
        }

        string ParentId = Request["ParentId"];

        if (!string.IsNullOrEmpty(ParentId))
        {
            m_guidParentId = new Guid(ParentId);
        }

        string id = Request["id"];

        if (string.IsNullOrEmpty(id))
        {
            Response.Write("请选择记录!");
            Response.End();
        }

        m_BaseObjectMgr = Global.GetCtx(Session["TopCompany"].ToString()).FindBaseObjectMgrCache(m_Table.Code, m_guidParentId);
        if (m_BaseObjectMgr == null)
        {
            m_BaseObjectMgr        = new CBaseObjectMgr();
            m_BaseObjectMgr.TbCode = m_Table.Code;
            m_BaseObjectMgr.Ctx    = Global.GetCtx(Session["TopCompany"].ToString());
            string sWhere = string.Format(" id='{0}'", id);
            m_BaseObjectMgr.GetList(sWhere);
        }
        m_BaseObject = m_BaseObjectMgr.Find(new Guid(id));
        if (m_BaseObject == null)
        {
            Response.Write("请选择记录!");
            Response.End();
        }

        //保存到编辑对象
        EditObject.Add(Session.SessionID, m_BaseObject);

        if (!IsPostBack)
        {
            recordCtrl.m_View  = m_View;
            recordCtrl.m_Table = m_Table;
            recordCtrl.m_sortRestrictColumnAccessType = m_sortRestrictColumnAccessType;
            recordCtrl.m_BaseObject = m_BaseObject;
            if (!string.IsNullOrEmpty(Request["UIColCount"]))
            {
                recordCtrl.m_iUIColCount = Convert.ToInt32(Request["UIColCount"]);
            }
        }
        if (Request.Params["Action"] == "Cancel")
        {
            m_BaseObject.Cancel();
            Response.End();
        }
        else if (Request.Params["Action"] == "PostData")
        {
            PostData();
            //从编辑对象移除
            EditObject.Remove(Session.SessionID, m_BaseObject);

            Response.End();
        }
    }