网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
07月24日漏签0天
代码吧 关注:136,106贴子:369,314
  • 看贴

  • 图片

  • 吧主推荐

  • 游戏

  • 0回复贴,共1页
<<返回代码吧
>0< 加载中...

大神进来帮我翻译一下代码,小弟写过

  • 只看楼主
  • 收藏

  • 回复
  • 璐村惂鐢ㄦ埛_0GSEt6E馃惥
  • 初级粉丝
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CHEXC.ClassInfo;
using CHEXC.GoodMenhod;
using System.Data.SqlClient;
namespace CHEXC
{
public partial class frmJhGoodsInfo : Form
{
public frmJhGoodsInfo()
{
InitializeComponent();//初始化组件
}
public frmJhGoodsInfo(int intCdo)
{
InitializeComponent();
}
tb_JhGoodsInfo jhGood=new tb_JhGoodsInfo();
tb_JhGoodsInfoMenthod jhMenthod=new tb_JhGoodsInfoMenthod();
public static int intFalg = 0;
private void ControlStatus()
{
this.toolSave.Enabled = !this.toolSave.Enabled;
this.toolAdd.Enabled = !this.toolAdd.Enabled;
this.toolCancel.Enabled = !this.toolCancel.Enabled;
this.toolAmend.Enabled = !this.toolAmend.Enabled;
this.tollDelete.Enabled = !this.tollDelete.Enabled;
}
public void ClearContorl()
{
txtGoodsNum.Text = "";
txtGoodsRemark.Text = "";
txtGoodsSellPrice.Text = "";
txtJhCompName.Text = "";
txtGoodsNoPrice.Text = "";
txtGoodsNeedPrice.Text = "";
txtGoodsName.Text = "";
txtGoodsJhPrice.Text = "";
txtGoodsID.Text = "";
txtEmpId.Text = "";
cmbDepotName.Text = "";
}
public int getIntCount()
{
int intReslut = 0;
if (intFalg == 1)
{
if (txtGoodsID.Text == "")
{
MessageBox.Show("商品编号不能为空!");
return intReslut;
}
if (txtGoodsName.Text == "")
{
MessageBox.Show("商品名称不能为空!");
return intReslut;
}
if (txtJhCompName.Text == "")
{
MessageBox.Show("供应商名称不能为空!");
return intReslut;
}
if (txtEmpId.Text == "")
{
MessageBox.Show("进货人姓名不能为空!");
return intReslut;
}
if (txtGoodsNum.Text == "")
{
MessageBox.Show("数量不能为空!");
return intReslut;
}
if (txtGoodsName.Text == "")
{
MessageBox.Show("进货单价不能为空!");
return intReslut;
}
}
if (intFalg == 2)
{
if (txtGoodsID.Text == "")
{
MessageBox.Show("商品编号不能为空!,选择要修改记录","提示");
return intReslut;
}
}
if (intFalg == 3)
{
if (txtGoodsID.Text == "")
{
MessageBox.Show("商品编号不能为空!,选择要删除记录", "提示");
return intReslut;
}
}
jhGood.strGoodsID = txtGoodsID.Text;
jhGood.strEmpId = txtEmpId.Text;
jhGood.strJhCompName = txtGoodsName.Text;
jhGood.strDepotName = cmbDepotName.Text;
jhGood.strGoodsNum = Convert.ToInt32(txtGoodsNum.Text);
jhGood.strGoodsName = txtGoodsName.Text;
jhGood.strGoodsUnit = cmbGoodsUnit.Text;
jhGood.deGoodsJhPrice = txtGoodsJhPrice.Text;
jhGood.deGoodsNeedPrice = txtGoodsNeedPrice.Text;
jhGood.deGoodsNoPrice = txtGoodsNoPrice.Text;
jhGood.deGoodsSellPrice = txtGoodsSellPrice.Text;
jhGood.strGoodsRemark = txtGoodsRemark.Text;
jhGood.DaGoodTime = dateTimePicker1.Value;
if (intFalg != 3)
{
jhGood.Falg = 0;
}
else
{
jhGood.Falg = 1;
}
intReslut = 1;
return intReslut;
}
private void frmJhGoodsInfo_Load(object sender, EventArgs e)
{
jhMenthod.tb_JhGoodsInfoFind("", 5, dataGridView1); //调用公共类中的方法
}
private void FillControls()
{
try
{
SqlDataReader sqldr = jhMenthod.tb_JhGoodsInfoFind(this.dataGridView1[0, this.dataGridView1.CurrentCell.RowIndex].Value.ToString(),1);
sqldr.Read();
if (sqldr.HasRows)
{
txtEmpId.Text=sqldr[1].ToString();
txtGoodsName.Text=sqldr[4].ToString();
cmbDepotName.Text = sqldr[3].ToString();
txtGoodsNum.Text=sqldr[5].ToString();
cmbGoodsUnit.Text=sqldr[6].ToString();
txtGoodsJhPrice.Text=sqldr[7].ToString();
txtGoodsNeedPrice.Text=sqldr[9].ToString();
 txtGoodsNoPrice.Text=sqldr[10].ToString();
txtGoodsSellPrice.Text=sqldr[8].ToString();
txtGoodsRemark.Text=sqldr[11].ToString();
txtJhCompName.Text = sqldr[2].ToString();
txtGoodsID.Text = sqldr[0].ToString();
 txtGoodsID.Enabled = false;
}
}
catch (Exception ee)
{
MessageBox.Show(ee.ToString());
}
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void toolAdd_Click(object sender, EventArgs e)
{
ControlStatus();
ClearContorl();
intFalg = 1;//添加标记
txtGoodsID.Text = jhMenthod.JhGoodsID();
txtGoodsID.Enabled = false;
}
private void toolAmend_Click(object sender, EventArgs e)
{
ControlStatus();
ClearContorl();
intFalg = 2;//添加标记
}
private void toolrefulsh_Click(object sender, EventArgs e)
{
ControlStatus();
ClearContorl();
}
private void toolExit_Click(object sender, EventArgs e)
{
this.Close();
}
private void toolCancel_Click(object sender, EventArgs e)
{
ControlStatus();
ClearContorl();
}
private void toolSave_Click(object sender, EventArgs e)
{
if (getIntCount() == 1)
{
if (intFalg == 1)
{
if (jhMenthod.tb_JhGoodsInfoMenthodAdd(jhGood)==2)
{
MessageBox.Show("添加成功","提示");
intFalg = 0;
jhMenthod.tb_JhGoodsInfoFind("",5,dataGridView1);
ControlStatus();
ClearContorl();
}
else
{
MessageBox.Show("添加失败", "提示");
intFalg = 0;
jhMenthod.tb_JhGoodsInfoFind("", 5, dataGridView1);
ControlStatus();
ClearContorl();
}
}
if (intFalg == 2)
{
if (jhMenthod.tb_JhGoodsInfoMenthodUpdate(jhGood)==1)
{
MessageBox.Show("修改成功", "提示");
intFalg = 0;
jhMenthod.tb_JhGoodsInfoFind("", 5, dataGridView1);
ControlStatus();
ClearContorl();
}
else
{
MessageBox.Show("修改失败", "提示");
intFalg = 0;
jhMenthod.tb_JhGoodsInfoFind("", 5, dataGridView1);
ControlStatus();
ClearContorl();
}
}
if (intFalg == 3)
{
if (jhMenthod.tb_JhGoodsInfoMenthodDelete(jhGood)==1)
{
MessageBox.Show("删除成功", "提示");
intFalg = 0;
jhMenthod.tb_JhGoodsInfoFind("", 5, dataGridView1);
ControlStatus();
ClearContorl();
}
else
{
MessageBox.Show("删除失败", "提示");
intFalg = 0;
jhMenthod.tb_JhGoodsInfoFind("", 5, dataGridView1);
ControlStatus();
ClearContorl();
}
}
}
}
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (intFalg == 2 || intFalg == 3)
{
FillControls();
}
}
private void txtGoodsJhPrice_TextChanged(object sender, EventArgs e)
{
if (txtGoodsNum.Text != "")
{
txtGoodsNeedPrice.Text = Convert.ToString(Convert.ToInt32(txtGoodsJhPrice.Text)*Convert.ToInt32(txtGoodsNum.Text));
}
}
private void txtGoodsSellPrice_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar != 8 && !char.IsDigit(e.KeyChar)&&e.KeyChar!='.')
{
MessageBox.Show("请输入数字");
e.Handled = true;
}
}
private void txtGoodsNum_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar != 8 && !char.IsDigit(e.KeyChar))
{
MessageBox.Show("请输入数字");
e.Handled = true;
}
}
private void txtGoodsJhPrice_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar != 8 && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
{
MessageBox.Show("请输入数字");
e.Handled = true;
}
}
private void txtGoodsNoPrice_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar != 8 && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
{
MessageBox.Show("请输入数字");
e.Handled = true;
}
}
//供应商信息
private void button1_Click(object sender, EventArgs e)
{
frmGonYingShang frmgong = new frmGonYingShang();
frmgong.Owner = this;
frmgong.ShowDialog();
}
private void tollDelete_Click(object sender, EventArgs e)
{
ControlStatus();
ClearContorl();
intFalg = 3;//添加标记
}
}
}


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 0回复贴,共1页
<<返回代码吧
分享到:
©2025 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示