Exemplo n.º 1
0
        private void btn_OK_Click(object sender, System.EventArgs e)
        {
            UDS.Components.MyLinkman     mylinkman = new UDS.Components.MyLinkman();
            UDS.Components.CustomLinkman clinkman  = new UDS.Components.CustomLinkman();
            clinkman.Name            = tbx_Name.Text;
            clinkman.Age             = tbx_Age.Text;
            clinkman.Gender          = (ddl_Gender.Items[ddl_Gender.SelectedIndex].Value == "1")?true:false;
            clinkman.UnitAddress     = tbx_UnitAddress.Text;
            clinkman.UnitTelephone   = tbx_UnitTelephone.Text;
            clinkman.UnitZip         = tbx_UnitZip.Text;
            clinkman.FamilyAddress   = tbx_FamilyAddress.Text;
            clinkman.FamilyTelephone = tbx_FamilyTelephone.Text;
            clinkman.FamilyZip       = tbx_FamilyZip.Text;
            clinkman.Email           = tbx_Email.Text;
            clinkman.Mobile          = tbx_Mobile.Text;
            clinkman.Memo            = tbx_Memo.Text;

            for (int i = 0; i < dlt_Type.Items.Count; i++)
            {
                if (((CheckBox)dlt_Type.Items[i].Controls[1]).Checked == true)
                {
                    clinkman.Type += dlt_Type.DataKeys[i].ToString() + ",";
                }
            }

            mylinkman.AddCustomLinkman(clinkman, userid);

            Response.Write("<script>location.href='ListView.aspx?type=3'</script>");
        }
Exemplo n.º 2
0
 private void BindTypeList()
 {
     UDS.Components.MyLinkman mylinkman = new UDS.Components.MyLinkman();
     dlt_Type.DataSource   = mylinkman.GetCustomLinkmanType();
     dlt_Type.DataKeyField = "ID";
     dlt_Type.DataBind();
 }
Exemplo n.º 3
0
        private void GridCustomLinkmanByType(int type)
        {
            UDS.Components.MyLinkman linkman    = new UDS.Components.MyLinkman();
            SqlDataReader            dr_linkman = linkman.GetCustomLinkmanByType(type, userid);
            DataTable dt_linkman = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_linkman);

            dgrd_CustomLinkman.DataSource = dt_linkman.DefaultView;
            dgrd_CustomLinkman.DataBind();
        }
Exemplo n.º 4
0
 //bound to customlinkmantype
 private void BindTypeList()
 {
     UDS.Components.MyLinkman mylinkman = new UDS.Components.MyLinkman();
     ddl_CustomLinkmanType.DataSource     = mylinkman.GetCustomLinkmanType();
     ddl_CustomLinkmanType.DataValueField = "ID";
     ddl_CustomLinkmanType.DataTextField  = "type";
     ddl_CustomLinkmanType.DataBind();
     ddl_CustomLinkmanType.Items.Insert(0, new ListItem("全部", "all"));
 }
Exemplo n.º 5
0
 //bound to customlinkmantype
 private void BindTypeList()
 {
     UDS.Components.MyLinkman mylinkman = new UDS.Components.MyLinkman();
     ddl_CustomLinkmanType.DataSource = mylinkman.GetCustomLinkmanType();
     ddl_CustomLinkmanType.DataValueField = "ID";
     ddl_CustomLinkmanType.DataTextField = "type";
     ddl_CustomLinkmanType.DataBind();
     ddl_CustomLinkmanType.Items.Insert(0,new ListItem("ȫ��","all"));
 }
Exemplo n.º 6
0
        private void BindCutomTypeList()
        {
            UDS.Components.MyLinkman mylinkman = new UDS.Components.MyLinkman();
            ddl_CustomCatalog.DataSource     = mylinkman.GetCustomLinkmanType();
            ddl_CustomCatalog.DataTextField  = "Type";
            ddl_CustomCatalog.DataValueField = "ID";
            ddl_CustomCatalog.DataBind();

            ddl_CustomCatalog.Items.Insert(0, new ListItem("无限制", "0"));
        }
Exemplo n.º 7
0
        private void BindCutomTypeList()
        {
            UDS.Components.MyLinkman mylinkman = new UDS.Components.MyLinkman();
            ddl_CustomCatalog.DataSource = mylinkman.GetCustomLinkmanType();
            ddl_CustomCatalog.DataTextField = "Type";
            ddl_CustomCatalog.DataValueField = "ID";
            ddl_CustomCatalog.DataBind();

            ddl_CustomCatalog.Items.Insert(0,new ListItem("������","0"));
        }
Exemplo n.º 8
0
        private void GridBind(int type)
        {
            UDS.Components.MyLinkman linkman    = new UDS.Components.MyLinkman();
            SqlDataReader            dr_linkman = linkman.GetMyLinkman(type, userid);
            DataTable dt_linkman = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_linkman);

            dt_linkman.TableName = "Linkman";
            DataSet ds = new DataSet();

            ds.Tables.Add(dt_linkman);
            switch (type)
            {
            case 1:
                dgrd_StaffLinkman.Visible  = true;
                dgrd_ClientLinkman.Visible = false;
                dgrd_CustomLinkman.Visible = false;

                td_Staff.Attributes["background"]  = "../../images/maillistbutton2.gif";
                td_Client.Attributes["background"] = "../../images/maillistbutton1.gif";
                td_Custom.Attributes["background"] = "../../images/maillistbutton1.gif";

                dgrd_StaffLinkman.DataSource   = dt_linkman.DefaultView;
                dgrd_StaffLinkman.DataKeyField = "Staff_ID";
                dgrd_StaffLinkman.DataBind();
                break;

            case 2:
                dgrd_StaffLinkman.Visible  = false;
                dgrd_ClientLinkman.Visible = true;
                dgrd_CustomLinkman.Visible = false;

                td_Staff.Attributes["background"]  = "../../images/maillistbutton1.gif";
                td_Client.Attributes["background"] = "../../images/maillistbutton2.gif";
                td_Custom.Attributes["background"] = "../../images/maillistbutton1.gif";

                dgrd_ClientLinkman.DataSource   = dt_linkman.DefaultView;
                dgrd_ClientLinkman.DataKeyField = "ID";
                dgrd_ClientLinkman.DataBind();
                break;

            case 3:
                dgrd_StaffLinkman.Visible  = false;
                dgrd_ClientLinkman.Visible = false;
                dgrd_CustomLinkman.Visible = true;

                td_Staff.Attributes["background"]  = "../../images/maillistbutton1.gif";
                td_Client.Attributes["background"] = "../../images/maillistbutton1.gif";
                td_Custom.Attributes["background"] = "../../images/maillistbutton2.gif";

                dgrd_CustomLinkman.DataSource   = dt_linkman.DefaultView;
                dgrd_CustomLinkman.DataKeyField = "ID";
                dgrd_CustomLinkman.DataBind();
                break;
            }
        }
Exemplo n.º 9
0
        private void BindData()
        {
            UDS.Components.MyLinkman mlinkman = new UDS.Components.MyLinkman();
            SqlDataReader dr_mlinkman = mlinkman.GetCustomLinkman(id);
            BindTypeList();
            try
            {
                while (dr_mlinkman.Read())
                {
                    tbx_Name.Text = dr_mlinkman["Name"].ToString();
                    tbx_Age.Text = dr_mlinkman["Age"].ToString();
                    tbx_UnitAddress.Text = dr_mlinkman["UnitAddress"].ToString();
                    tbx_UnitTelephone.Text = dr_mlinkman["UnitTelephone"].ToString();
                    tbx_UnitZip.Text = dr_mlinkman["UnitZip"].ToString();
                    tbx_FamilyAddress.Text = dr_mlinkman["FamilyAddress"].ToString();
                    tbx_FamilyTelephone.Text = dr_mlinkman["FamilyTelephone"].ToString();
                    tbx_FamilyZip.Text = dr_mlinkman["FamilyZip"].ToString();
                    tbx_Mobile.Text = dr_mlinkman["Mobile"].ToString();
                    tbx_Email.Text = dr_mlinkman["Email"].ToString();
                    tbx_Memo.Text = dr_mlinkman["Memo"].ToString();

                    if (Convert.ToBoolean(dr_mlinkman["Gender"]) == true)
                    {
                        ddl_Gender.SelectedIndex = 0;
                    }
                    else
                    {
                        ddl_Gender.SelectedIndex = 1;
                    }

                    SqlDataReader dr_type = mlinkman.GetCustomLinkmanType(id);
                    try
                    {
                        while (dr_type.Read())
                        {
                            foreach (DataListItem dli in dlt_Type.Items)
                            {
                                if (((CheckBox)dli.FindControl("Checkbox1")).Text == dr_type["Type"].ToString())
                                    ((CheckBox)dli.FindControl("Checkbox1")).Checked = true;
                            }
                        }
                    }
                    finally
                    {
                        dr_type.Close();
                    }

                }
            }
            finally
            {
                dr_mlinkman.Close();
            }
        }
Exemplo n.º 10
0
        private void btn_AddList_Click(object sender, System.EventArgs e)
        {
            string selectedstring = "";
            int    type           = 0;

            //取得选中的id值
            if (dgrd_List.Visible == true)
            {
                type = 1;
                foreach (DataGridItem dgi in dgrd_List.Items)               //找到checkbox control
                {
                    for (int i = 0; i < dgi.Cells[0].Controls.Count; i++)
                    {
                        if ((dgi.Cells[0].Controls[i].GetType().ToString() == "System.Web.UI.WebControls.CheckBox") && ((CheckBox)dgi.Cells[0].Controls[i]).Checked == true)
                        {
                            selectedstring += dgrd_List.DataKeys[dgi.ItemIndex] + ",";
                        }
                    }
                }
            }
            else if (dgrd_Linkman.Visible == true)
            {
                type = 2;
                foreach (DataGridItem dgi in dgrd_Linkman.Items)               //找到checkbox control
                {
                    for (int i = 0; i < dgi.Cells[0].Controls.Count; i++)
                    {
                        if ((dgi.Cells[0].Controls[i].GetType().ToString() == "System.Web.UI.WebControls.CheckBox") && ((CheckBox)dgi.Cells[0].Controls[i]).Checked == true)
                        {
                            selectedstring += dgrd_Linkman.DataKeys[dgi.ItemIndex] + ",";
                        }
                    }
                }
            }

            if (selectedstring.IndexOf(",") != -1)
            {
                selectedstring = selectedstring.Substring(0, selectedstring.Length - 1);
                string[] arrids = selectedstring.Split(',');
                for (int i = 0; i < arrids.Length; i++)
                {
                    UDS.Components.MyLinkman mlinkman = new UDS.Components.MyLinkman();
                    mlinkman.AddLinkmanToList(type, Int32.Parse(arrids[i]), userid);
                }
            }
            Response.Write("<script>location.href='ListView.aspx?type=" + type + "';</script>");
        }
Exemplo n.º 11
0
 private void dgrd_Linkman_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
 {
     UDS.Components.MyLinkman mlinkman = new UDS.Components.MyLinkman();
     if (e.Item.ItemIndex != -1)
     {
         if (mlinkman.HaveInList(2, userid, Int32.Parse(((DataGrid)sender).DataKeys[e.Item.ItemIndex].ToString())))
         {
             for (int i = 0; i < e.Item.Cells[0].Controls.Count; i++)
             {
                 if (e.Item.Cells[0].Controls[i].GetType().ToString() == "System.Web.UI.WebControls.CheckBox")
                 {
                     ((CheckBox)(e.Item.Cells[0].Controls[i])).Enabled = false;
                 }
             }
         }
     }
 }
Exemplo n.º 12
0
        private void BindData()
        {
            UDS.Components.MyLinkman mlinkman    = new UDS.Components.MyLinkman();
            SqlDataReader            dr_mlinkman = mlinkman.GetCustomLinkman(id);

            BindTypeList();
            while (dr_mlinkman.Read())
            {
                tbx_Name.Text            = dr_mlinkman["Name"].ToString();
                tbx_Age.Text             = dr_mlinkman["Age"].ToString();
                tbx_UnitAddress.Text     = dr_mlinkman["UnitAddress"].ToString();
                tbx_UnitTelephone.Text   = dr_mlinkman["UnitTelephone"].ToString();
                tbx_UnitZip.Text         = dr_mlinkman["UnitZip"].ToString();
                tbx_FamilyAddress.Text   = dr_mlinkman["FamilyAddress"].ToString();
                tbx_FamilyTelephone.Text = dr_mlinkman["FamilyTelephone"].ToString();
                tbx_FamilyZip.Text       = dr_mlinkman["FamilyZip"].ToString();
                tbx_Mobile.Text          = dr_mlinkman["Mobile"].ToString();
                tbx_Email.Text           = dr_mlinkman["Email"].ToString();
                tbx_Memo.Text            = dr_mlinkman["Memo"].ToString();

                if (Convert.ToBoolean(dr_mlinkman["Gender"]) == true)
                {
                    ddl_Gender.SelectedIndex = 0;
                }
                else
                {
                    ddl_Gender.SelectedIndex = 1;
                }

                SqlDataReader dr_type = mlinkman.GetCustomLinkmanType(id);
                while (dr_type.Read())
                {
                    foreach (DataListItem dli in dlt_Type.Items)
                    {
                        if (((CheckBox)dli.FindControl("Checkbox1")).Text == dr_type["Type"].ToString())
                        {
                            ((CheckBox)dli.FindControl("Checkbox1")).Checked = true;
                        }
                    }
                }
                dr_type.Close();
            }
            dr_mlinkman.Close();
        }
Exemplo n.º 13
0
        private void btn_OK_Click(object sender, System.EventArgs e)
        {
            UDS.Components.MyLinkman     mlinkman = new UDS.Components.MyLinkman();
            UDS.Components.CustomLinkman clinkman = new UDS.Components.CustomLinkman();

            clinkman.Name            = tbx_Name.Text;
            clinkman.Age             = tbx_Age.Text;
            clinkman.Gender          = (ddl_Gender.Items[ddl_Gender.SelectedIndex].Value == "1")?true:false;
            clinkman.UnitAddress     = tbx_UnitAddress.Text;
            clinkman.UnitTelephone   = tbx_UnitTelephone.Text;
            clinkman.UnitZip         = tbx_UnitZip.Text;
            clinkman.FamilyAddress   = tbx_FamilyAddress.Text;
            clinkman.FamilyTelephone = tbx_FamilyTelephone.Text;
            clinkman.FamilyZip       = tbx_FamilyZip.Text;
            clinkman.Email           = tbx_Email.Text;
            clinkman.Mobile          = tbx_Mobile.Text;
            clinkman.Memo            = tbx_Memo.Text;
            clinkman.ID = id;

            for (int i = 0; i < dlt_Type.Items.Count; i++)
            {
                if (((CheckBox)dlt_Type.Items[i].Controls[1]).Checked == true)
                {
                    clinkman.Type += dlt_Type.DataKeys[i].ToString() + ",";
                }
            }

            mlinkman.UpdateCustomLinkman(clinkman);
            mlinkman.UpdateCustomLinkmanType(clinkman);

            BindData();

            if (id == 0)
            {
                Response.Write("<script>alert('添加成功!');</script>");
            }
            else
            {
                Response.Write("<script>alert('修改成功!');</script>");
            }
        }
Exemplo n.º 14
0
        private void btn_AddList_Click(object sender, System.EventArgs e)
        {
            string selectedstring = "";
            int type = 0;
            //ȡ��ѡ�е�idֵ
            if(dgrd_List.Visible==true)
            {
                type = 1;
                foreach(DataGridItem dgi in dgrd_List.Items)//�ҵ�checkbox control
                {
                    for(int i=0;i<dgi.Cells[0].Controls.Count;i++)
                    {
                        if((dgi.Cells[0].Controls[i].GetType().ToString()=="System.Web.UI.WebControls.CheckBox")&&((CheckBox)dgi.Cells[0].Controls[i]).Checked==true)
                        {
                            selectedstring += dgrd_List.DataKeys[dgi.ItemIndex] + ",";
                        }
                    }
                }
            }
            else if(dgrd_Linkman.Visible==true)
            {
                type = 2;
                foreach(DataGridItem dgi in dgrd_Linkman.Items)//�ҵ�checkbox control
                {
                    for(int i=0;i<dgi.Cells[0].Controls.Count;i++)
                    {
                        if((dgi.Cells[0].Controls[i].GetType().ToString()=="System.Web.UI.WebControls.CheckBox")&&((CheckBox)dgi.Cells[0].Controls[i]).Checked==true)
                        {
                            selectedstring += dgrd_Linkman.DataKeys[dgi.ItemIndex] + ",";
                        }
                    }
                }
            }

            if(selectedstring.IndexOf(",")!=-1)
            {
                selectedstring = selectedstring.Substring(0,selectedstring.Length-1);
                string[] arrids = selectedstring.Split(',');
                for(int i=0;i<arrids.Length;i++)
                {
                    UDS.Components.MyLinkman mlinkman = new UDS.Components.MyLinkman();
                    mlinkman.AddLinkmanToList(type,Int32.Parse(arrids[i]),userid);
                }
            }
            Response.Write("<script>location.href='ListView.aspx?type="+type+"';</script>");
        }
Exemplo n.º 15
0
        private void btn_Del_Click(object sender, System.EventArgs e)
        {
            string selectedstring = "";
            int type = 0;
            UDS.Components.MyLinkman mlinkman = new UDS.Components.MyLinkman();

            if(dgrd_StaffLinkman.Visible==true)
            {
                type = 1;
                //�õ�ѡ�е�checkbox��id
                foreach(DataGridItem dgi in dgrd_StaffLinkman.Items)//�ҵ�checkbox control
                {
                    for(int i=0;i<dgi.Cells[0].Controls.Count;i++)
                    {
                        if((dgi.Cells[0].Controls[i].GetType().ToString()=="System.Web.UI.WebControls.CheckBox")&&((CheckBox)dgi.Cells[0].Controls[i]).Checked==true)
                        {
                            selectedstring += dgrd_StaffLinkman.DataKeys[dgi.ItemIndex] + ",";
                        }
                    }
                }
            }
            else if(dgrd_ClientLinkman.Visible==true)
            {
                type = 2;
                foreach(DataGridItem dgi in dgrd_ClientLinkman.Items)//�ҵ�checkbox control
                {
                    for(int i=0;i<dgi.Cells[0].Controls.Count;i++)
                    {
                        if((dgi.Cells[0].Controls[i].GetType().ToString()=="System.Web.UI.WebControls.CheckBox")&&((CheckBox)dgi.Cells[0].Controls[i]).Checked==true)
                        {
                            selectedstring += dgrd_ClientLinkman.DataKeys[dgi.ItemIndex] + ",";
                        }
                    }
                }

            }
            else if(dgrd_CustomLinkman.Visible==true)
            {
                type = 3;
                foreach(DataGridItem dgi in dgrd_CustomLinkman.Items)//�ҵ�checkbox control
                {
                    for(int i=0;i<dgi.Cells[0].Controls.Count;i++)
                    {
                        if((dgi.Cells[0].Controls[i].GetType().ToString()=="System.Web.UI.WebControls.CheckBox")&&((CheckBox)dgi.Cells[0].Controls[i]).Checked==true)
                        {
                            selectedstring += dgrd_CustomLinkman.DataKeys[dgi.ItemIndex] + ",";
                        }
                    }
                }

            }

            if(selectedstring.IndexOf(",")!=-1)
            {
                selectedstring = selectedstring.Substring(0,selectedstring.Length-1);
                string[] arrselected = selectedstring.Split(',');
                for(int i=0;i<arrselected.Length;i++)
                {
                    if(arrselected[i].Trim()!="")
                    {
                        mlinkman.DelLinkmanFromList(type,Int32.Parse(arrselected[i]));
                    }
                }
                GridBind(type);
            }
        }
Exemplo n.º 16
0
        private void btn_OK_Click(object sender, System.EventArgs e)
        {
            UDS.Components.MyLinkman mylinkman = new UDS.Components.MyLinkman();
            UDS.Components.CustomLinkman clinkman = new UDS.Components.CustomLinkman();
            clinkman.Name = tbx_Name.Text;
            clinkman.Age = tbx_Age.Text;
            clinkman.Gender = (ddl_Gender.Items[ddl_Gender.SelectedIndex].Value=="1")?true:false;
            clinkman.UnitAddress = tbx_UnitAddress.Text;
            clinkman.UnitTelephone = tbx_UnitTelephone.Text;
            clinkman.UnitZip = tbx_UnitZip.Text;
            clinkman.FamilyAddress = tbx_FamilyAddress.Text;
            clinkman.FamilyTelephone = tbx_FamilyTelephone.Text;
            clinkman.FamilyZip = tbx_FamilyZip.Text;
            clinkman.Email = tbx_Email.Text;
            clinkman.Mobile = tbx_Mobile.Text;
            clinkman.Memo = tbx_Memo.Text;

            for(int i = 0;i<dlt_Type.Items.Count;i++)
            {
                if(((CheckBox)dlt_Type.Items[i].Controls[1]).Checked==true)
                {
                    clinkman.Type += dlt_Type.DataKeys[i].ToString() + ",";
                }
            }

            mylinkman.AddCustomLinkman(clinkman,userid);

            Response.Write("<script>location.href='ListView.aspx?type=3'</script>");
        }
Exemplo n.º 17
0
 private void GridCustomLinkmanByType(int type)
 {
     UDS.Components.MyLinkman linkman = new UDS.Components.MyLinkman();
     SqlDataReader dr_linkman = linkman.GetCustomLinkmanByType(type,userid);
     DataTable dt_linkman = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_linkman);
     dgrd_CustomLinkman.DataSource = dt_linkman.DefaultView;
     dgrd_CustomLinkman.DataBind();
 }
Exemplo n.º 18
0
        private void GridBind(int type)
        {
            UDS.Components.MyLinkman linkman = new UDS.Components.MyLinkman();
            SqlDataReader dr_linkman = linkman.GetMyLinkman(type,userid);
            DataTable dt_linkman = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_linkman);
            dt_linkman.TableName = "Linkman";
            DataSet ds = new DataSet();
            ds.Tables.Add(dt_linkman);
            switch(type)
            {
                case 1:
                    dgrd_StaffLinkman.Visible = true;
                    dgrd_ClientLinkman.Visible = false;
                    dgrd_CustomLinkman.Visible = false;

                    td_Staff.Attributes["background"]= "../../images/maillistbutton2.gif";
                    td_Client.Attributes["background"]= "../../images/maillistbutton1.gif";
                    td_Custom.Attributes["background"]= "../../images/maillistbutton1.gif";

                    dgrd_StaffLinkman.DataSource = dt_linkman.DefaultView;
                    dgrd_StaffLinkman.DataKeyField = "Staff_ID";
                    dgrd_StaffLinkman.DataBind();
                    break;
                case 2:
                    dgrd_StaffLinkman.Visible = false;
                    dgrd_ClientLinkman.Visible = true;
                    dgrd_CustomLinkman.Visible = false;

                    td_Staff.Attributes["background"]= "../../images/maillistbutton1.gif";
                    td_Client.Attributes["background"]= "../../images/maillistbutton2.gif";
                    td_Custom.Attributes["background"]= "../../images/maillistbutton1.gif";

                    dgrd_ClientLinkman.DataSource = dt_linkman.DefaultView;
                    dgrd_ClientLinkman.DataKeyField = "ID";
                    dgrd_ClientLinkman.DataBind();
                    break;
                case 3:
                    dgrd_StaffLinkman.Visible = false;
                    dgrd_ClientLinkman.Visible = false;
                    dgrd_CustomLinkman.Visible = true;

                    td_Staff.Attributes["background"]= "../../images/maillistbutton1.gif";
                    td_Client.Attributes["background"]= "../../images/maillistbutton1.gif";
                    td_Custom.Attributes["background"]= "../../images/maillistbutton2.gif";

                    dgrd_CustomLinkman.DataSource = dt_linkman.DefaultView;
                    dgrd_CustomLinkman.DataKeyField = "ID";
                    dgrd_CustomLinkman.DataBind();
                    break;
            }
        }
Exemplo n.º 19
0
        private void btn_Del_Click(object sender, System.EventArgs e)
        {
            string selectedstring = "";
            int    type           = 0;

            UDS.Components.MyLinkman mlinkman = new UDS.Components.MyLinkman();

            if (dgrd_StaffLinkman.Visible == true)
            {
                type = 1;
                //得到选中的checkbox的id
                foreach (DataGridItem dgi in dgrd_StaffLinkman.Items)               //找到checkbox control
                {
                    for (int i = 0; i < dgi.Cells[0].Controls.Count; i++)
                    {
                        if ((dgi.Cells[0].Controls[i].GetType().ToString() == "System.Web.UI.WebControls.CheckBox") && ((CheckBox)dgi.Cells[0].Controls[i]).Checked == true)
                        {
                            selectedstring += dgrd_StaffLinkman.DataKeys[dgi.ItemIndex] + ",";
                        }
                    }
                }
            }
            else if (dgrd_ClientLinkman.Visible == true)
            {
                type = 2;
                foreach (DataGridItem dgi in dgrd_ClientLinkman.Items)               //找到checkbox control
                {
                    for (int i = 0; i < dgi.Cells[0].Controls.Count; i++)
                    {
                        if ((dgi.Cells[0].Controls[i].GetType().ToString() == "System.Web.UI.WebControls.CheckBox") && ((CheckBox)dgi.Cells[0].Controls[i]).Checked == true)
                        {
                            selectedstring += dgrd_ClientLinkman.DataKeys[dgi.ItemIndex] + ",";
                        }
                    }
                }
            }
            else if (dgrd_CustomLinkman.Visible == true)
            {
                type = 3;
                foreach (DataGridItem dgi in dgrd_CustomLinkman.Items)               //找到checkbox control
                {
                    for (int i = 0; i < dgi.Cells[0].Controls.Count; i++)
                    {
                        if ((dgi.Cells[0].Controls[i].GetType().ToString() == "System.Web.UI.WebControls.CheckBox") && ((CheckBox)dgi.Cells[0].Controls[i]).Checked == true)
                        {
                            selectedstring += dgrd_CustomLinkman.DataKeys[dgi.ItemIndex] + ",";
                        }
                    }
                }
            }

            if (selectedstring.IndexOf(",") != -1)
            {
                selectedstring = selectedstring.Substring(0, selectedstring.Length - 1);
                string[] arrselected = selectedstring.Split(',');
                for (int i = 0; i < arrselected.Length; i++)
                {
                    if (arrselected[i].Trim() != "")
                    {
                        mlinkman.DelLinkmanFromList(type, Int32.Parse(arrselected[i]));
                    }
                }
                GridBind(type);
            }
        }
Exemplo n.º 20
0
        private void btn_OK_Click(object sender, System.EventArgs e)
        {
            UDS.Components.MyLinkman linkman = new UDS.Components.MyLinkman();
            SqlDataReader dr_linkman=null;
            DataTable dt_linkman = new DataTable();
            string filter = "";
            try
            {
                switch (ddl_SearchType.SelectedValue)
                {
                    case "staff":
                        dr_linkman = linkman.GetMyLinkman(1, Int32.Parse(Request.Cookies["UserID"].Value));

                        if (tbx_StaffName.Text.Trim() != "")
                        {
                            filter = (filter == "") ? ("RealName LIKE '*" + tbx_StaffName.Text.Trim() + "*'") : filter + " and RealName LIKE '*" + tbx_StaffName.Text.Trim() + "*'";
                        }
                        if (tbx_StaffMobile.Text.Trim() != "")
                        {
                            filter = (filter == "") ? ("Mobile LIKE '*" + tbx_StaffMobile.Text.Trim() + "*'") : filter + " and Mobile LIKE '*" + tbx_StaffMobile.Text.Trim() + "*'";
                        }
                        if (ddl_StaffGender.SelectedValue != "0")
                        {
                            if (ddl_StaffGender.SelectedValue == "male")
                            {
                                if (filter == "")
                                    filter = "Sex=True";
                                else
                                    filter += " and Sex=True";
                            }
                            else
                            {
                                if (filter == "")
                                    filter = "Sex=False";
                                else
                                    filter += " and Sex=False";
                            }
                        }
                        if (tbx_StaffEmail.Text.Trim() != "")
                        {
                            filter = (filter == "") ? ("Email LIKE '*" + tbx_StaffEmail.Text.Trim() + "'") : filter + " and Email LIKE '*" + tbx_StaffEmail.Text.Trim() + "*'";
                        }
                        if (ddl_StaffPosition.SelectedValue != "0")
                        {
                            filter = (filter == "") ? ("Position_ID=" + ddl_StaffPosition.SelectedValue) : filter + " and Position_ID=" + ddl_StaffPosition.SelectedValue;
                        }

                        dt_linkman = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_linkman);

                        try
                        {

                            dt_linkman.DefaultView.RowFilter = filter;
                            dgrd_Staff.DataSource = dt_linkman.DefaultView;
                            dgrd_Staff.DataBind();

                        }
                        catch (Exception ex)
                        {
                            Response.Write(filter + "   " + ex.Message);
                        }

                        dgrd_Staff.Visible = true;
                        dgrd_Linkman.Visible = false;
                        dgrd_Custom.Visible = false;
                        break;

                    case "linkman":
                        dr_linkman = linkman.GetMyLinkman(2, Int32.Parse(Request.Cookies["UserID"].Value));

                        if (tbx_LinkmanName.Text.Trim() != "")
                        {
                            filter = (filter == "") ? ("Name LIKE '*" + tbx_LinkmanName.Text.Trim() + "*'") : filter + " and Name LIKE '*" + tbx_LinkmanName.Text.Trim() + "*'";
                        }
                        if (tbx_Telephone.Text.Trim() != "")
                        {
                            filter = (filter == "") ? ("Telephone LIKE '*" + tbx_Telephone.Text.Trim() + "*'") : filter + " and Telephone LIKE '*" + tbx_Telephone.Text.Trim() + "*'";
                        }
                        if (ddl_LinkmanGender.SelectedValue != "0")
                        {
                            if (ddl_LinkmanGender.SelectedValue == "male")
                            {
                                if (filter == "")
                                    filter = "Gender=True";
                                else
                                    filter += " and Gender=True";
                            }
                            else
                            {
                                if (filter == "")
                                    filter = "Gender=False";
                                else
                                    filter += " and Gender=False";
                            }
                        }
                        if (tbx_LinkmanEmail.Text.Trim() != "")
                        {
                            filter = (filter == "") ? ("Email LIKE '*" + tbx_LinkmanEmail.Text.Trim() + "*'") : filter + " and Email LIKE '*" + tbx_LinkmanEmail.Text.Trim() + "*'";
                        }
                        if (tbx_LinkmanUnit.Text.Trim() != "")
                        {
                            filter = (filter == "") ? ("UnitName LIKE '*" + tbx_LinkmanUnit.Text.Trim() + "*'") : filter + " AND UnitName LIKE '*" + tbx_LinkmanUnit.Text.Trim() + "*'";
                        }
                        if (tbx_LinkmanPosition.Text.Trim() != "")
                        {
                            filter = (filter == "") ? ("Position LIKE '*" + tbx_LinkmanPosition.Text.Trim() + "*'") : filter + " AND Position LIKE '*" + tbx_LinkmanPosition.Text.Trim() + "*'";
                        }
                        if (tbx_LinkmanMobile.Text.Trim() != "")
                        {
                            filter = (filter == "") ? ("Mobile LIKE '*" + tbx_LinkmanMobile.Text.Trim() + "*'") : filter + " AND Mobile LIKE '*" + tbx_LinkmanMobile.Text.Trim() + "*'";
                        }

                        dt_linkman = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_linkman);

                        try
                        {

                            dt_linkman.DefaultView.RowFilter = filter;
                            dgrd_Linkman.DataSource = dt_linkman.DefaultView;
                            dgrd_Linkman.DataBind();

                        }
                        catch (Exception ex)
                        {
                            Response.Write(filter + "   " + ex.Message);
                        }

                        dgrd_Staff.Visible = false;
                        dgrd_Linkman.Visible = true;
                        dgrd_Custom.Visible = false;
                        break;

                    case "custom":
                        DataSet ds = new DataSet();
                        dr_linkman = linkman.GetMyLinkman(3, Int32.Parse(Request.Cookies["UserID"].Value));

                        if (tbx_CutomName.Text.Trim() != "")
                        {
                            filter = (filter == "") ? ("Name LIKE '*" + tbx_CutomName.Text.Trim() + "*'") : filter + " and Name LIKE '*" + tbx_CutomName.Text.Trim() + "*'";
                        }

                        if (ddl_CustomGender.SelectedValue != "0")
                        {
                            if (ddl_CustomGender.SelectedValue == "male")
                            {
                                if (filter == "")
                                    filter = "Gender=True";
                                else
                                    filter += " and Gender=True";
                            }
                            else
                            {
                                if (filter == "")
                                    filter = "Gender=False";
                                else
                                    filter += " and Gender=False";
                            }
                        }
                        if (tbx_CutomEmail.Text.Trim() != "")
                        {
                            filter = (filter == "") ? ("Email LIKE '*" + tbx_CutomEmail.Text.Trim() + "*'") : filter + " and Email LIKE '*" + tbx_CutomEmail.Text.Trim() + "*'";
                        }
                        if (tbx_CutomMobile.Text.Trim() != "")
                        {
                            filter = (filter == "") ? ("Mobile LIKE '*" + tbx_CutomMobile.Text.Trim() + "*'") : filter + " AND Mobile LIKE '*" + tbx_CutomMobile.Text.Trim() + "*'";
                        }
                        if (ddl_CustomCatalog.SelectedValue != "0")
                        {
                            SqlDataReader dr_linkmantype = linkman.GetLinkmanTypeRelation();
                            //DataTable dt_linkmantype = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_linkmantype);
                            //�õ�����������ϵ��id
                            string ids = "";
                            while (dr_linkmantype.Read())
                            {
                                if (Convert.ToInt32(dr_linkmantype["TypeID"]) == Int32.Parse(ddl_CustomCatalog.SelectedValue))
                                {
                                    ids += dr_linkmantype["CustomLinkmanID"].ToString() + ",";
                                }
                            }
                            if (ids != "")
                                ids = ids.Substring(0, ids.Length - 1);

                            filter = (filter == "") ? ("ID IN (" + ids + ")") : (filter + " AND ID IN (" + ids + ")");
                        }

                        dt_linkman = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_linkman);

                        try
                        {

                            dt_linkman.DefaultView.RowFilter = filter;
                            dgrd_Custom.DataSource = dt_linkman.DefaultView;
                            dgrd_Custom.DataBind();

                        }
                        catch (Exception ex)
                        {
                            Response.Write(filter + "   " + ex.Message);
                        }

                        dgrd_Staff.Visible = false;
                        dgrd_Linkman.Visible = false;
                        dgrd_Custom.Visible = true;
                        break;
                }
            }
            finally
            {
                dr_linkman.Close();
                dr_linkman.Dispose();
            }
        }
Exemplo n.º 21
0
 //bound to linkmantype
 private void BindTypeList()
 {
     UDS.Components.MyLinkman mylinkman = new UDS.Components.MyLinkman();
     dlt_Type.DataSource = mylinkman.GetCustomLinkmanType();
     dlt_Type.DataKeyField = "ID";
     dlt_Type.DataBind();
 }
Exemplo n.º 22
0
        private void dgrd_List_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
        {
            UDS.Components.MyLinkman mlinkman = new UDS.Components.MyLinkman();
            if(e.Item.ItemIndex!=-1)
            {
                if(mlinkman.HaveInList(1,userid,Int32.Parse(((DataGrid)sender).DataKeys[e.Item.ItemIndex].ToString())))
                {
                    for(int i=0;i<e.Item.Cells[0].Controls.Count;i++)
                    {
                        if(e.Item.Cells[0].Controls[i].GetType().ToString()=="System.Web.UI.WebControls.CheckBox")
                        {
                            ((CheckBox)(e.Item.Cells[0].Controls[i])).Enabled = false;
                        }
                    }

                }
            }
        }
Exemplo n.º 23
0
        private void btn_OK_Click(object sender, System.EventArgs e)
        {
            UDS.Components.MyLinkman mlinkman = new UDS.Components.MyLinkman();
            UDS.Components.CustomLinkman clinkman = new UDS.Components.CustomLinkman();

            clinkman.Name = tbx_Name.Text;
            clinkman.Age = tbx_Age.Text;
            clinkman.Gender = (ddl_Gender.Items[ddl_Gender.SelectedIndex].Value=="1")?true:false;
            clinkman.UnitAddress = tbx_UnitAddress.Text;
            clinkman.UnitTelephone = tbx_UnitTelephone.Text;
            clinkman.UnitZip = tbx_UnitZip.Text;
            clinkman.FamilyAddress = tbx_FamilyAddress.Text;
            clinkman.FamilyTelephone = tbx_FamilyTelephone.Text;
            clinkman.FamilyZip = tbx_FamilyZip.Text;
            clinkman.Email = tbx_Email.Text;
            clinkman.Mobile = tbx_Mobile.Text;
            clinkman.Memo = tbx_Memo.Text;
            clinkman.ID = id;

            for(int i = 0;i<dlt_Type.Items.Count;i++)
            {
                if(((CheckBox)dlt_Type.Items[i].Controls[1]).Checked==true)
                {
                    clinkman.Type += dlt_Type.DataKeys[i].ToString() + ",";
                }
            }

            mlinkman.UpdateCustomLinkman(clinkman);
            mlinkman.UpdateCustomLinkmanType(clinkman);

            BindData();

            if(id==0)
                Response.Write("<script>alert('��ӳɹ�!');</script>");
            else
                Response.Write("<script>alert('�޸ijɹ�!');</script>");
        }
Exemplo n.º 24
0
        private void btn_OK_Click(object sender, System.EventArgs e)
        {
            UDS.Components.MyLinkman linkman = new UDS.Components.MyLinkman();
            SqlDataReader            dr_linkman;
            DataTable dt_linkman = new DataTable();
            string    filter     = "";

            switch (ddl_SearchType.SelectedValue)
            {
            case "staff":
                dr_linkman = linkman.GetMyLinkman(1, Int32.Parse(Request.Cookies["UserID"].Value));

                if (tbx_StaffName.Text.Trim() != "")
                {
                    filter = (filter == "")?("RealName LIKE '*" + tbx_StaffName.Text.Trim() + "*'"):filter + " and RealName LIKE '*" + tbx_StaffName.Text.Trim() + "*'";
                }
                if (tbx_StaffMobile.Text.Trim() != "")
                {
                    filter = (filter == "")?("Mobile LIKE '*" + tbx_StaffMobile.Text.Trim() + "*'"):filter + " and Mobile LIKE '*" + tbx_StaffMobile.Text.Trim() + "*'";
                }
                if (ddl_StaffGender.SelectedValue != "0")
                {
                    if (ddl_StaffGender.SelectedValue == "male")
                    {
                        if (filter == "")
                        {
                            filter = "Sex=True";
                        }
                        else
                        {
                            filter += " and Sex=True";
                        }
                    }
                    else
                    {
                        if (filter == "")
                        {
                            filter = "Sex=False";
                        }
                        else
                        {
                            filter += " and Sex=False";
                        }
                    }
                }
                if (tbx_StaffEmail.Text.Trim() != "")
                {
                    filter = (filter == "")?("Email LIKE '*" + tbx_StaffEmail.Text.Trim() + "'"):filter + " and Email LIKE '*" + tbx_StaffEmail.Text.Trim() + "*'";
                }
                if (ddl_StaffPosition.SelectedValue != "0")
                {
                    filter = (filter == "")?("Position_ID=" + ddl_StaffPosition.SelectedValue):filter + " and Position_ID=" + ddl_StaffPosition.SelectedValue;
                }

                dt_linkman = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_linkman);

                try
                {
                    dt_linkman.DefaultView.RowFilter = filter;
                    dgrd_Staff.DataSource            = dt_linkman.DefaultView;
                    dgrd_Staff.DataBind();
                }
                catch (Exception ex)
                {
                    Response.Write(filter + "   " + ex.Message);
                }


                dgrd_Staff.Visible   = true;
                dgrd_Linkman.Visible = false;
                dgrd_Custom.Visible  = false;
                break;

            case "linkman":
                dr_linkman = linkman.GetMyLinkman(2, Int32.Parse(Request.Cookies["UserID"].Value));

                if (tbx_LinkmanName.Text.Trim() != "")
                {
                    filter = (filter == "")?("Name LIKE '*" + tbx_LinkmanName.Text.Trim() + "*'"):filter + " and Name LIKE '*" + tbx_LinkmanName.Text.Trim() + "*'";
                }
                if (tbx_Telephone.Text.Trim() != "")
                {
                    filter = (filter == "")?("Telephone LIKE '*" + tbx_Telephone.Text.Trim() + "*'"):filter + " and Telephone LIKE '*" + tbx_Telephone.Text.Trim() + "*'";
                }
                if (ddl_LinkmanGender.SelectedValue != "0")
                {
                    if (ddl_LinkmanGender.SelectedValue == "male")
                    {
                        if (filter == "")
                        {
                            filter = "Gender=True";
                        }
                        else
                        {
                            filter += " and Gender=True";
                        }
                    }
                    else
                    {
                        if (filter == "")
                        {
                            filter = "Gender=False";
                        }
                        else
                        {
                            filter += " and Gender=False";
                        }
                    }
                }
                if (tbx_LinkmanEmail.Text.Trim() != "")
                {
                    filter = (filter == "")?("Email LIKE '*" + tbx_LinkmanEmail.Text.Trim() + "*'"):filter + " and Email LIKE '*" + tbx_LinkmanEmail.Text.Trim() + "*'";
                }
                if (tbx_LinkmanUnit.Text.Trim() != "")
                {
                    filter = (filter == "")?("UnitName LIKE '*" + tbx_LinkmanUnit.Text.Trim() + "*'"):filter + " AND UnitName LIKE '*" + tbx_LinkmanUnit.Text.Trim() + "*'";
                }
                if (tbx_LinkmanPosition.Text.Trim() != "")
                {
                    filter = (filter == "")?("Position LIKE '*" + tbx_LinkmanPosition.Text.Trim() + "*'"):filter + " AND Position LIKE '*" + tbx_LinkmanPosition.Text.Trim() + "*'";
                }
                if (tbx_LinkmanMobile.Text.Trim() != "")
                {
                    filter = (filter == "")?("Mobile LIKE '*" + tbx_LinkmanMobile.Text.Trim() + "*'"):filter + " AND Mobile LIKE '*" + tbx_LinkmanMobile.Text.Trim() + "*'";
                }

                dt_linkman = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_linkman);

                try
                {
                    dt_linkman.DefaultView.RowFilter = filter;
                    dgrd_Linkman.DataSource          = dt_linkman.DefaultView;
                    dgrd_Linkman.DataBind();
                }
                catch (Exception ex)
                {
                    Response.Write(filter + "   " + ex.Message);
                }


                dgrd_Staff.Visible   = false;
                dgrd_Linkman.Visible = true;
                dgrd_Custom.Visible  = false;
                break;

            case "custom":
                DataSet ds = new DataSet();
                dr_linkman = linkman.GetMyLinkman(3, Int32.Parse(Request.Cookies["UserID"].Value));

                if (tbx_CutomName.Text.Trim() != "")
                {
                    filter = (filter == "")?("Name LIKE '*" + tbx_CutomName.Text.Trim() + "*'"):filter + " and Name LIKE '*" + tbx_CutomName.Text.Trim() + "*'";
                }

                if (ddl_CustomGender.SelectedValue != "0")
                {
                    if (ddl_CustomGender.SelectedValue == "male")
                    {
                        if (filter == "")
                        {
                            filter = "Gender=True";
                        }
                        else
                        {
                            filter += " and Gender=True";
                        }
                    }
                    else
                    {
                        if (filter == "")
                        {
                            filter = "Gender=False";
                        }
                        else
                        {
                            filter += " and Gender=False";
                        }
                    }
                }
                if (tbx_CutomEmail.Text.Trim() != "")
                {
                    filter = (filter == "")?("Email LIKE '*" + tbx_CutomEmail.Text.Trim() + "*'"):filter + " and Email LIKE '*" + tbx_CutomEmail.Text.Trim() + "*'";
                }
                if (tbx_CutomMobile.Text.Trim() != "")
                {
                    filter = (filter == "")?("Mobile LIKE '*" + tbx_CutomMobile.Text.Trim() + "*'"):filter + " AND Mobile LIKE '*" + tbx_CutomMobile.Text.Trim() + "*'";
                }
                if (ddl_CustomCatalog.SelectedValue != "0")
                {
                    SqlDataReader dr_linkmantype = linkman.GetLinkmanTypeRelation();
                    //DataTable dt_linkmantype = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_linkmantype);
                    //得到满足分类的联系人id
                    string ids = "";
                    while (dr_linkmantype.Read())
                    {
                        if (Convert.ToInt32(dr_linkmantype["TypeID"]) == Int32.Parse(ddl_CustomCatalog.SelectedValue))
                        {
                            ids += dr_linkmantype["CustomLinkmanID"].ToString() + ",";
                        }
                    }
                    if (ids != "")
                    {
                        ids = ids.Substring(0, ids.Length - 1);
                    }

                    filter = (filter == "")?("ID IN (" + ids + ")"):(filter + " AND ID IN (" + ids + ")");
                }


                dt_linkman = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_linkman);


                try
                {
                    dt_linkman.DefaultView.RowFilter = filter;
                    dgrd_Custom.DataSource           = dt_linkman.DefaultView;
                    dgrd_Custom.DataBind();
                }
                catch (Exception ex)
                {
                    Response.Write(filter + "   " + ex.Message);
                }


                dgrd_Staff.Visible   = false;
                dgrd_Linkman.Visible = false;
                dgrd_Custom.Visible  = true;
                break;
            }
        }