예제 #1
0
        public void BindData()
        {
            Activity ac = new Activity();

            activityList = ac.GetAllPlaces();

            GVActivity.Visible    = true;
            GVActivity.DataSource = activityList;
            GVActivity.DataBind();
        }
    public void BindGVActivity(string OrgID)
    {
        //con = DB.DynamicConnection();
        if (OrgID != "0" && OrgID != "" && OrgID != null)
        {
            //pnlActivity.Visible = true;
            SqlCommand cmdr = new SqlCommand("Select * from tbl_OrganisationMaster where orgid=" + OrgID, conn);
            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            SqlDataReader dr = cmdr.ExecuteReader();
            if (dr.Read())
            {
                //lblCompany.Text = dr["orgname"].ToString();
                Session["orgID"] = dr["orgid"];
            }
            dr.Close();
            SqlCommand cmdWitAssId = new SqlCommand("select *,convert(varchar(12),ActStartDate,106) as ActStartDateNew,(tbl_UserMaster.FirstName + ' ' + tbl_UserMaster.LastName) as fullname, OM.Orgname,convert(varchar(12),ActDueDate,106) as actduedatenew,(tbl_UserMaster.FirstName + ' ' + tbl_UserMaster.LastName) as fullname from  tbl_ActivityMaster join tbl_UserMaster on tbl_UserMaster.UserId=tbl_ActivityMaster.UserID join tbl_organisationmaster OM on tbl_Activitymaster.orgid=OM.orgid where tbl_ActivityMaster.activestatus =1 and tbl_ActivityMaster.OrgID=@OrgID order by tbl_Activitymaster.ID desc", conn);
            cmdWitAssId.Parameters.Add(new SqlParameter("@OrgID", SqlDbType.Int)).Value = OrgID;
            SqlDataAdapter DaOrgID = new SqlDataAdapter();
            DaOrgID.SelectCommand = cmdWitAssId;
            DataTable DtOrgID = new DataTable();
            DataSet   DsOrgID = new DataSet();
            DaOrgID.Fill(DsOrgID);
            DtOrgID = DsOrgID.Tables[0];
            GVActivity.DataSource = DtOrgID;
            GVActivity.DataBind();
        }
        else
        {
            //lblCompany.Text = "All Communication (Click on Company name in LEFT or RIGHT panel to do activity and see filter communication)";
            //pnlActivity.Visible = false;

            SqlCommand cmd = new SqlCommand("select *,convert(varchar(12),ActStartDate,106) as ActStartDateNew,convert(varchar(12),ActDueDate,106) as actduedatenew,(U.FirstName + ' ' + U.LastName) as fullname,  O.Orgname from  tbl_ActivityMaster A,  tbl_UserMaster U,tbl_organisationmaster O where U.UserId=A.UserID and  A.orgid=O.orgid  and A.activestatus =1  and  U.UserID=" + Session["ActiveUserID"] + "  order by A.ActCreateDate desc", conn);

            SqlDataAdapter DaAct = new SqlDataAdapter();
            DaAct.SelectCommand = cmd;
            DataTable DtAct = new DataTable();
            DataSet   DsAct = new DataSet();
            DaAct.Fill(DsAct);
            DtAct = DsAct.Tables[0];
            GVActivity.DataSource = DtAct;
            GVActivity.DataBind();
        }
    }
        public void GetActivityData()
        {
            DataTable dtGridViewActivity;

            dtGridViewActivity = objBSS.GetActivitySales(Session["UserID"].ToString());

            if (dtGridViewActivity.Rows.Count > 0)
            {
                DataTable dt1 = new DataTable();
                dt1.Columns.AddRange(new DataColumn[]
                {
                    new DataColumn("Subject"),
                    new DataColumn("Customer"),
                    new DataColumn("RefID"),
                    new DataColumn("POC"),
                    new DataColumn("POCName"),
                    new DataColumn("Address"),
                    new DataColumn("OppName"),
                    new DataColumn("SubRefID"),
                    new DataColumn("ActivityName"),
                    new DataColumn("ActivityTypeID"),
                    new DataColumn("Date"),
                    new DataColumn("Time"),
                    new DataColumn("ActivityStatus"),
                    new DataColumn("ActivityStatusID"),
                    new DataColumn("ActivityOwner"),
                    new DataColumn("ActivityOwnerID"),
                    new DataColumn("ClosureRemarks"),
                    new DataColumn("ClosureRemarksID"),
                    new DataColumn("Attachment"),
                    new DataColumn("Remarks"),
                    new DataColumn("ActivityID"),
                    new DataColumn("TransactionBy")
                });
                for (int i = 0; i <= dtGridViewActivity.Rows.Count - 1; i++)
                {
                    dt1.Rows.Add(dtGridViewActivity.Rows[i]["Subject"].ToString(),
                                 dtGridViewActivity.Rows[i]["Customer"].ToString(),
                                 dtGridViewActivity.Rows[i]["RefID"].ToString(),
                                 dtGridViewActivity.Rows[i]["POC"].ToString(),
                                 dtGridViewActivity.Rows[i]["POCName"].ToString(),
                                 dtGridViewActivity.Rows[i]["Address"].ToString(),
                                 dtGridViewActivity.Rows[i]["OppName"].ToString(),
                                 dtGridViewActivity.Rows[i]["SubRefID"].ToString(),
                                 dtGridViewActivity.Rows[i]["ActivityName"].ToString(),
                                 dtGridViewActivity.Rows[i]["ActivityTypeID"].ToString(),
                                 dtGridViewActivity.Rows[i]["Date"].ToString(),
                                 dtGridViewActivity.Rows[i]["Time"].ToString(),
                                 dtGridViewActivity.Rows[i]["ActivityStatus"].ToString(),
                                 dtGridViewActivity.Rows[i]["ActivityStatusID"].ToString(),
                                 dtGridViewActivity.Rows[i]["ActivityOwner"].ToString(),
                                 dtGridViewActivity.Rows[i]["ActivityOwnerID"].ToString(),
                                 dtGridViewActivity.Rows[i]["ClosureRemarks"].ToString(),
                                 dtGridViewActivity.Rows[i]["ClosureRemarksID"].ToString(),
                                 dtGridViewActivity.Rows[i]["Attachment"].ToString(),
                                 dtGridViewActivity.Rows[i]["Remarks"].ToString(),
                                 dtGridViewActivity.Rows[i]["ActivityID"].ToString(),
                                 dtGridViewActivity.Rows[i]["TransactionBy"].ToString()
                                 );
                }
                GVActivity.DataSource = dt1;
                GVActivity.DataBind();
                GVActivity.MasterTableView.GetColumn("RefID").Visible            = false;
                GVActivity.MasterTableView.GetColumn("POC").Visible              = false;
                GVActivity.MasterTableView.GetColumn("Address").Visible          = false;
                GVActivity.MasterTableView.GetColumn("SubRefID").Visible         = false;
                GVActivity.MasterTableView.GetColumn("ActivityTypeID").Visible   = false;
                GVActivity.MasterTableView.GetColumn("Time").Visible             = false;
                GVActivity.MasterTableView.GetColumn("ActivityStatusID").Visible = false;
                GVActivity.MasterTableView.GetColumn("ActivityOwner").Visible    = false;
                GVActivity.MasterTableView.GetColumn("ActivityOwnerID").Visible  = false;
                GVActivity.MasterTableView.GetColumn("ClosureRemarksID").Visible = false;
                GVActivity.MasterTableView.GetColumn("Attachment").Visible       = false;
                GVActivity.MasterTableView.GetColumn("Remarks").Visible          = false;
                GVActivity.MasterTableView.GetColumn("ActivityID").Visible       = false;
            }
        }