62,046
社区成员
发帖
与我相关
我的任务
分享
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
try
{
//MsgInfo.UID = UserInfo.ID;
MsgInfo.EMail = Mail;
MsgInfo.Title = BJMsgInfo_Title.Text.Trim();
MsgInfo.CompanyName = BJMsgInfo_CompanyName.Text.Trim();
Category.ID = Convert.ToInt32(dropCategoryID.SelectedValue);
WebManager.GetInfo(Category);
string DType = Category.Title;
BJProductCategory cc = new BJProductCategory();
cc.ID = Convert.ToInt32(DropChild.SelectedValue);
WebManager.GetInfo(cc);
string XType = cc.Title;
MsgInfo.Category = DType + "-->" + XType;
MsgInfo.BusinessType = BJMsgInfo_BusinessType.SelectedItem.Text;
MsgInfo.MsgInfo = BJMsgInfo_MsgInfo.Text.Trim();
MsgInfo.CategoryProvince = Convert.ToInt32(BJMsgInfo_CategoryProvince.SelectedValue);
//MsgInfo.BigCategory = BJMsgInfo_CategoryProvince.SelectedItem.Text;
MsgInfo.Province = BJMsgInfo_CategoryProvince.SelectedItem.Text;
MsgInfo.CategoryFrom = Convert.ToInt32(BJMsgInfo_CategoryFrom.SelectedValue);
int d1 = SumType1() + SumType2() + SumType3() + SumType4();
MsgInfo.Comments = MsgStatus(d1);
MsgInfo.PictureUrl = ReturnPic(MsgInfo.Comments);
MsgInfo.yzfd = DropDownList1.SelectedValue;
MsgInfo.yzfw = DropDownList2.SelectedValue;
MsgInfo.yzpl = DropDownList3.SelectedValue;
MsgInfo.yzzl = DropDownList4.SelectedValue;
WebManager.Insert(MsgInfo);
ShowMessage(Consts.Save_AddSuccess);
}
catch (Exception ex)
{
this.ShowMessage(ex.Message);
}
}
public void BindPic()
{
int d1 = SumType1() + SumType2() + SumType3() + SumType4();
Image1.Visible = true;
Image1.ImageUrl = ReturnPic(MsgStatus(d1));
}
protected void DropDownList4_SelectedIndexChanged(object sender, EventArgs e)
{
BindPic();
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
BindPic();
}
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
{
BindPic();
}
protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
{
BindPic();
}
public string MsgStatus(int i)
{
string Result = "";
int j = i / 4;
switch(j)
//double j = Math.Ceiling(i / 4.0);
//switch (Convert.ToInt32(j))
{
case 0:
Result = "差(1)";
break;
case 1:
Result = "一般(2)";
break;
case 2:
Result = "好(3)";
break;
case 3:
Result = "很好(4)";
break;
case 4:
Result = "非常好(5)";
break;
default:
Result = "差(1)";
break;
}
return Result;
}
public int SumType1()
{
int i=0;
string Drop1 = DropDownList1.SelectedValue;
switch (Drop1)
{
case "差(1)":
i = 0;
break;
case "一般(2)":
i = 1;
break;
case "好(3)":
i = 2;
break;
case "很好(4)":
i = 3;
break;
case "非常好(5)":
i = 4;
break;
}
return i;
}
public int SumType2()
{
int i = 0;
string Drop2 = DropDownList2.SelectedValue;
switch (Drop2)
{
case "差(1)":
i = 0;
break;
case "一般(2)":
i = 1;
break;
case "好(3)":
i = 2;
break;
case "很好(4)":
i = 3;
break;
case "非常好(5)":
i = 4;
break;
}
return i;
}
public int SumType3()
{
int i = 0;
string Drop3 = DropDownList3.SelectedValue;
switch (Drop3)
{
case "差(1)":
i = 0;
break;
case "一般(2)":
i = 1;
break;
case "好(3)":
i = 2;
break;
case "很好(4)":
i = 3;
break;
case "非常好(5)":
i = 4;
break;
}
return i;
}
public int SumType4()
{
int i = 0;
string Drop4 = DropDownList4.SelectedValue;
switch (Drop4)
{
case "差(1)":
i = 0;
break;
case "一般(2)":
i = 1;
break;
case "好(3)":
i = 2;
break;
case "很好(4)":
i = 3;
break;
case "非常好(5)":
i = 4;
break;
}
return i;
}
public string ReturnPic(string Comments)
{
string pic = "";
switch (Comments)
{
case "差(1)":
pic = "imagedp/1.gif";
break;
case "一般(2)":
pic = "imagedp/2.gif";
break;
case "好(3)":
pic = "imagedp/3.gif";
break;
case "很好(4)":
pic = "imagedp/4.gif";
break;
case "非常好(5)":
pic = "imagedp/5.gif";
break;
}
//Image1.Visible = true;
//Image1.ImageUrl = pic;
return pic;
}