コード例 #1
0
ファイル: CompanyGeneral.aspx.cs プロジェクト: PulseCRM/Pulse
    /// <summary>
    /// Saves this instance.
    /// </summary>
    /// <returns></returns>
    private bool Save()
    {
        bool status = false;
        try
        {
            if (isNew)
            {
                bllCompanyGeneral.Add(modCompanyGeneral);
            }
            else
            {
                //Get old group id (Rocky - 2011-1-30)
                LPWeb.BLL.Groups groupMgr = new LPWeb.BLL.Groups();
                LPWeb.Model.Groups model = groupMgr.GetCompanyGroup();
                this.iOldGroupID = model.GroupId;
                bllCompanyGeneral.Update(modCompanyGeneral);
            }


            status = true;
        }
        catch (Exception exception)
        {
            status = false;
            LPLog.LogMessage(exception.Message);
        }
        return status;
    }
コード例 #2
0
ファイル: CompanyGeneral.aspx.cs プロジェクト: PulseCRM/Pulse
    /// <summary>
    /// Inits the group access.
    /// </summary>
    private void InitGroupAccess()
    {
        var bllGroup = new LPWeb.BLL.Groups();
        DataSet dsGroups = null;
        try
        {
            //get data from database
            dsGroups = bllGroup.GetCompanyRelGroups();
        }
        catch (Exception exception)
        {
            //log the error
            LPLog.LogMessage(exception.Message);
            return;
        }

        if (dsGroups != null && dsGroups.Tables.Count > 0 && dsGroups.Tables[0].Rows.Count > 0)
        {
            ddlGroupAccess.DataSource = dsGroups;
            ddlGroupAccess.DataTextField = "GroupName";
            ddlGroupAccess.DataValueField = "GroupId";
            ddlGroupAccess.DataBind();

            //set selected item
            foreach (DataRow dataRow in dsGroups.Tables[0].Select("CompanyID is not null and  OrganizationType='Company'"))
            {
                if (dataRow.IsNull("GroupId") == false)
                {
                    ViewState["previousSelectedIem"] = dataRow["GroupId"];
                    ddlGroupAccess.SelectedValue = dataRow["GroupId"].ToString();
                }
            }
        }

    }
コード例 #3
0
ファイル: CompanyGeneral.aspx.cs プロジェクト: PulseCRM/Pulse
    /// <summary>
    /// Saves the group access.
    /// </summary>
    /// <returns></returns>
    private bool SaveGroupAccess()
    {
        int prevId = 0;

        try
        {
            prevId = Convert.ToInt32(ViewState["previousSelectedIem"]);
        }
        catch (Exception exception)
        {
            LPLog.LogMessage(exception.Message);
        }


        LPWeb.BLL.Groups bllGroup = new LPWeb.BLL.Groups();
        int newId = 0;
        string strNewID = ddlGroupAccess.SelectedValue;
        if (int.TryParse(strNewID, out  newId))
        {
            int companyId = 5;//todo:check hard code
            string orgType = "Company";//todo:check hard code
            if (prevId == 0)
            {
                prevId = newId;
            }
            try
            {
                bllGroup.UpdateGroupAccess(prevId, newId, companyId, orgType);

                //Save group folder info
                LPWeb.BLL.GroupFolder groupFolder = new LPWeb.BLL.GroupFolder();
                if (newId != 0)
                {
                    groupFolder.DoSaveGroupFolder(newId, 5, "company", this.iOldGroupID);
                }

                return true;
            }
            catch (Exception exception)
            {
                LPLog.LogMessage(exception.Message);
            }
        }
        return false;
    }