111,093
社区成员




for (int i = ds.Tables[0].Rows.Count; i <= dataGridView1.Rows.Count;i++ )
{
if(ds.Tables[0].Rows.Count+1==dataGridView1.Rows.Count)
{
label3.Text = "没有输入任何数据!";
}
try
{
string unitNumber = txtUnitno.Text.Trim();
string Serialno = dataGridView1.Rows[i].Cells["SerialNumber"].Value.ToString();
string BCode = dataGridView1.Rows[i].Cells["BarCode"].Value.ToString();
string ICode = dataGridView1.Rows[i].Cells["ItemCode"].Value.ToString();
string IType = dataGridView1.Rows[i].Cells["ItemType"].Value.ToString();
string SDate = dataGridView1.Rows[i].Cells["SetDate"].Value.ToString();
string ODate = dataGridView1.Rows[i].Cells["OutDate"].Value.ToString();
string Statu = dataGridView1.Rows[i].Cells["Status"].Value.ToString();
string DeliveryNumber = dataGridView1.Rows[i].Cells["DeliveryNo"].Value.ToString();
string ReturnNo = dataGridView1.Rows[i].Cells["ReturnNo"].Value.ToString();
string DocType = dataGridView1.Rows[i].Cells["DocType"].Value.ToString();
AddSerialNo(unitNumber, Serialno, BCode, ICode, IType, SDate, ODate, Statu, DeliveryNumber, ReturnNo, DocType);
}
catch (Exception ex)
{
}
}
label3.Text = "";
BindGridCiew(unitno,DataName);
string jscript = string.Empty;
DataSet myDS = new DataSet();
myDS.Tables.Add("CheckInfo");
myDS.Tables[0].Columns.Add("NoteID");
myDS.Tables[0].Columns.Add("GiftsID");
myDS.Tables[0].Columns.Add("StoreID");
myDS.Tables[0].Columns.Add("Count");
myDS.Tables[0].Columns.Add("CreateDate");
myDS.Tables[0].Columns.Add("CreateUser");
myDS.Tables[0].Columns.Add("CheckType");//0为未盘点 1为已盘点
for (int i = 0; i < gvCheck.Rows.Count; i++)
{
CheckBox ck = (CheckBox)gvCheck.Rows[i].FindControl("chkSel");
if (ck.Checked)
{
if (((TextBox)gvCheck.Rows[i].Cells[3].FindControl("txtNum")).Text.Trim() == string.Empty)
{
jscript = "alert('请填写盘点数量!');";
ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "onclick", jscript, true);
return;
}
try
{
int Count = int.Parse(((TextBox)gvCheck.Rows[i].Cells[3].FindControl("txtNum")).Text);
int GiftsID = Util.GetInt(((Label)gvCheck.Rows[i].FindControl("lbGiftsID")).Text);
DataRow myRow = myDS.Tables[0].NewRow();
myRow["NoteID"] = DateTime.Now.ToString("yyyyMMdd"); ;
myRow["GiftsID"] = GiftsID;
myRow["StoreID"] = FreeHouse.Shop.Util.GetCookie("StoreID");
myRow["Count"] = Count;
myRow["CreateDate"] = DateTime.Now;
myRow["CreateUser"] = FreeHouse.Shop.Util.GetCookie("StaffID");
myRow["CheckType"] = 1;
myDS.Tables[0].Rows.Add(myRow);
}
catch (Exception ee)
{
jscript = "alert('" + ee.Message.ToString() + "');";
ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "onclick", jscript, true);
return;
}
}
}
if (myDS.Tables[0].Rows.Count == 0)
{
jscript = "alert('请正确勾选!');";
ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "onclick", jscript, true);
return;
}
if (AddCheckStore(myDS))
{
jscript = "alert('成功提交了 " + myDS.Tables[0].Rows.Count + " 条记录!');";
ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "onclick", jscript, true);
Fill();
}
else
{
jscript = "alert('失败!');";
ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "onclick", jscript, true);
}
}