?? serviceprovidermanage.cs
字號:
// txtAddr.Properties
//
this.txtAddr.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default;
this.txtAddr.Size = new System.Drawing.Size(624, 21);
this.txtAddr.TabIndex = 52;
//
// txtPosition
//
this.txtPosition.EditValue = "";
this.txtPosition.Location = new System.Drawing.Point(96, 96);
this.txtPosition.Name = "txtPosition";
//
// txtPosition.Properties
//
this.txtPosition.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default;
this.txtPosition.Size = new System.Drawing.Size(160, 21);
this.txtPosition.TabIndex = 51;
//
// txtFax
//
this.txtFax.EditValue = "";
this.txtFax.Location = new System.Drawing.Point(96, 72);
this.txtFax.Name = "txtFax";
//
// txtFax.Properties
//
this.txtFax.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default;
this.txtFax.Size = new System.Drawing.Size(160, 21);
this.txtFax.TabIndex = 50;
//
// txtTel
//
this.txtTel.EditValue = "";
this.txtTel.Location = new System.Drawing.Point(96, 48);
this.txtTel.Name = "txtTel";
//
// txtTel.Properties
//
this.txtTel.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default;
this.txtTel.Size = new System.Drawing.Size(160, 21);
this.txtTel.TabIndex = 49;
//
// txtname
//
this.txtname.EditValue = "";
this.txtname.Location = new System.Drawing.Point(96, 24);
this.txtname.Name = "txtname";
//
// txtname.Properties
//
this.txtname.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default;
this.txtname.Size = new System.Drawing.Size(160, 21);
this.txtname.TabIndex = 48;
//
// label7
//
this.label7.Font = new System.Drawing.Font("宋體", 9F);
this.label7.Location = new System.Drawing.Point(267, 24);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(72, 23);
this.label7.TabIndex = 40;
this.label7.Text = "服務商類別";
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// cbSType
//
this.cbSType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbSType.Location = new System.Drawing.Point(340, 24);
this.cbSType.Name = "cbSType";
this.cbSType.Size = new System.Drawing.Size(156, 20);
this.cbSType.TabIndex = 1;
//
// label10
//
this.label10.Font = new System.Drawing.Font("宋體", 9F);
this.label10.Location = new System.Drawing.Point(267, 48);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(69, 23);
this.label10.TabIndex = 31;
this.label10.Text = "聯系人";
this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label3
//
this.label3.Font = new System.Drawing.Font("宋體", 9F);
this.label3.Location = new System.Drawing.Point(27, 48);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(69, 23);
this.label3.TabIndex = 24;
this.label3.Text = "聯系電話";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label12
//
this.label12.Font = new System.Drawing.Font("宋體", 9F);
this.label12.Location = new System.Drawing.Point(27, 120);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(69, 23);
this.label12.TabIndex = 41;
this.label12.Text = "辦公地址";
this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label8
//
this.label8.Font = new System.Drawing.Font("宋體", 9F);
this.label8.Location = new System.Drawing.Point(27, 96);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(64, 23);
this.label8.TabIndex = 43;
this.label8.Text = "地圖位置";
this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label14
//
this.label14.Font = new System.Drawing.Font("宋體", 9F);
this.label14.Location = new System.Drawing.Point(507, 96);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(56, 23);
this.label14.TabIndex = 47;
this.label14.Text = "差評數";
this.label14.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label13
//
this.label13.Font = new System.Drawing.Font("宋體", 9F);
this.label13.Location = new System.Drawing.Point(267, 96);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(56, 23);
this.label13.TabIndex = 44;
this.label13.Text = "好評數";
this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label6
//
this.label6.Font = new System.Drawing.Font("宋體", 9F);
this.label6.Location = new System.Drawing.Point(27, 72);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(88, 23);
this.label6.TabIndex = 29;
this.label6.Text = "傳真號碼";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label4
//
this.label4.Font = new System.Drawing.Font("宋體", 9F);
this.label4.Location = new System.Drawing.Point(507, 48);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(72, 23);
this.label4.TabIndex = 26;
this.label4.Text = "服務商網址";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label11
//
this.label11.Font = new System.Drawing.Font("宋體", 9F);
this.label11.Location = new System.Drawing.Point(507, 72);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(56, 23);
this.label11.TabIndex = 38;
this.label11.Text = "服務內容";
this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label9
//
this.label9.Font = new System.Drawing.Font("宋體", 9F);
this.label9.Location = new System.Drawing.Point(507, 24);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(56, 23);
this.label9.TabIndex = 28;
this.label9.Text = "加盟時間";
this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label1
//
this.label1.Font = new System.Drawing.Font("宋體", 9F);
this.label1.Location = new System.Drawing.Point(27, 152);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(72, 23);
this.label1.TabIndex = 25;
this.label1.Text = "服務商簡介";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label5
//
this.label5.Font = new System.Drawing.Font("宋體", 9F);
this.label5.Location = new System.Drawing.Point(267, 72);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(88, 23);
this.label5.TabIndex = 27;
this.label5.Text = "郵件地址";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label2
//
this.label2.Font = new System.Drawing.Font("宋體", 9F);
this.label2.Location = new System.Drawing.Point(27, 24);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(88, 23);
this.label2.TabIndex = 23;
this.label2.Text = "服務商名稱";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// ServiceProviderManage
//
this.AutoScroll = true;
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
this.Name = "ServiceProviderManage";
this.Size = new System.Drawing.Size(848, 549);
this.Load += new System.EventHandler(this.ServiceProviderManage_Load);
((System.ComponentModel.ISupportInitialize)(this.panel2)).EndInit();
this.panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgPriver)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.panel1)).EndInit();
this.panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dateTimePicker1.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtBad.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtNeiRong.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtWeb.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtGood.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtEmail.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtRPerson.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtMemo.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtAddr.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtPosition.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtFax.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtTel.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtname.Properties)).EndInit();
this.ResumeLayout(false);
}
#endregion
private void ServiceProviderManage_Load(object sender, System.EventArgs e)
{
ServiceProviderBLL sbll=new ServiceProviderBLL();
DataSet ds=new DataSet();
ds=sbll.getSPType_DataSet("stype");
this.cbSType.DataSource=ds.Tables["stype"].DefaultView;
this.cbSType.DisplayMember=ds.Tables["stype"].Columns["stname"].ToString();
this.cbSType.ValueMember=ds.Tables["stype"].Columns["id"].ToString();
this.gridDataFilter1.checkbox=this.checkBox1;
ClearData();
getDataBind();
this.txtname.Focus();
}
private void btAdd_Click(object sender, System.EventArgs e)
{
try
{
insertData();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void insertData()
{
if(!this.checkValidate())
{
return ;
}
ServiceProviderInfo sinfo=new ServiceProviderInfo();
sinfo=setData("添加");
if(sinfo==null)
{
return;
}
ServiceProviderBLL sbll=new ServiceProviderBLL();
if(sbll.addServiceProvider(sinfo).ToString()!=null)
{
MessageBox.Show("添加成功","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
getDataBind();
ClearData();
}
else
{
MessageBox.Show("添加失敗!","警告",MessageBoxButtons.OK,MessageBoxIcon.Warning);
}
}
private ServiceProviderInfo setData(string tag)
{
ServiceProviderInfo sinfo=new ServiceProviderInfo();
if(tag=="修改")
{
sinfo.id=Convert.ToInt32(this.dgPriver[this.dgPriver.CurrentCell.RowNumber,1]);
}
sinfo.sname=this.txtname.Text;
sinfo.stelephone=this.txtTel.Text;
sinfo.sfax=this.txtFax.Text;
sinfo.saddress=this.txtAddr.Text;
sinfo.position=Convert.ToInt32(this.txtPosition.Text==""?"0":this.txtPosition.Text);
sinfo.sbrief=this.txtMemo.Text;
sinfo.stype=Convert.ToInt32(this.cbSType.SelectedValue);
sinfo.slinkname=this.txtRPerson.Text;
sinfo.semail=this.txtEmail.Text;
sinfo.sgood=Convert.ToInt32(this.txtGood.Text==""?"0":this.txtGood.Text);
sinfo.sdate=this.dateTimePicker1.Text.ToString();
sinfo.sweb=this.txtWeb.Text;
sinfo.ckeywords=this.txtNeiRong.Text;
sinfo.sbad=Convert.ToInt32(this.txtBad.Text==""?"0":this.txtBad.Text);
return sinfo;
}
private void getDataBind()
{
this.dgPriver.CaptionBackColor=Color.FromArgb(ShareClass.Rcolor,ShareClass.Gcolor,ShareClass.Bcolor);
this.dgPriver.BackgroundColor=Color.FromArgb(ShareClass.Rcolor,ShareClass.Gcolor,ShareClass.Bcolor);
this.checkBox1.BackColor=Color.FromArgb(ShareClass.Rcolor,ShareClass.Gcolor,ShareClass.Bcolor);
dsservice=new DataSet();
ServiceProviderBLL sbll=new ServiceProviderBLL();
ServiceProviderInfo sinfo=new ServiceProviderInfo();
dsservice=sbll.queryServiceProvider_DataSet(sinfo,"service");
System.Type myDataType;
myDataType = System.Type.GetType("System.Boolean");
System.Data.DataColumn myColumn = new System.Data.DataColumn("check");
// Set various properties.
myColumn.AutoIncrement = false;
myColumn.ReadOnly = false;
myColumn.ColumnMapping = System.Data.MappingType.Attribute;
myColumn.Caption = "check";
myColumn.DefaultValue = "false";
myColumn.DataType = myDataType;
dsservice.Tables["service"].Columns.Add(myColumn);
DataView dv=new DataView();
dv=dsservice.Tables["service"].DefaultView;
dv.AllowNew=false;
this.dgPriver.DataSource=dv;//dsservice.Tables["service"].DefaultView;
this.dgPriver.TableStyles.Clear();
DataGridTableStyle ts = new DataGridTableStyle();
ts.MappingName = dsservice.Tables["service"].TableName;
ts.GridLineColor=Color.FromArgb(ShareClass.Rcolor,ShareClass.Gcolor,ShareClass.Bcolor);
ts.HeaderBackColor=Color.FromArgb(ShareClass.Rcolor,ShareClass.Gcolor,ShareClass.Bcolor);
DataGridColumnStyle gsc = new DataGridBoolColumn();
gsc.MappingName = "check";
gsc.HeaderText = "選擇";
gsc.Width=40;
ts.GridColumnStyles.Add(gsc);
DataGridColumnStyle gs0 = new DataGridTextBoxColumn();
gs0.MappingName = "id";
gs0.HeaderText = "編號";
gs0.Width=40;
gs0.ReadOnly=true;
gs0.Alignment = HorizontalAlignment.Left;
ts.GridColumnStyles.Add(gs0);
DataGridColumnStyle gs1 = new DataGridTextBoxColumn();
gs1.MappingName = "sname";
gs1.HeaderText = "服務商名稱";
gs1.NullText = "";
gs1.Width=200;
gs1.ReadOnly=true;
gs1.Alignment = HorizontalAlignment.Left;
ts.GridColumnStyles.Add(gs1);
DataGridColumnStyle gs2 = new DataGridTextBoxColumn();
gs2.MappingName = "stname";
gs2.HeaderText = "服務商類別";
gs2.NullText = "";
gs2.Width=100;
gs2.ReadOnly=true;
gs2.Alignment = HorizontalAlignment.Left;
ts.GridColumnStyles.Add(gs2);
DataGridColumnStyle gst2 = new DataGridTextBoxColumn();
gst2.MappingName = "sdate";
gst2.HeaderText = "加盟時間";
gst2.NullText = "";
gst2.Width=80;
gst2.ReadOnly=true;
gst2.Alignment = HorizontalAlignment.Left;
ts.GridColumnStyles.Add(gst2);
DataGridColumnStyle gs3 = new DataGridTextBoxColumn();
gs3.MappingName = "slinkname";
gs3.HeaderText = "聯系人";
gs3.NullText = "";
gs3.Width=80;
gs3.ReadOnly=true;
gs3.Alignment = HorizontalAlignment.Left;
ts.GridColumnStyles.Add(gs3);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -