public InputItemCollectin GetItemInfos(int MainID) { InputItemCollectin costSubjectInfos = new InputItemCollectin(); if (this.SubjectMoveToItem(MainID)) { costSubjectInfos = this.GetCostSubjectInfos(MainID); } return(costSubjectInfos); }
private InputItemCollectin GetDataFromGrid() { InputItemCollectin inputItemCollectin = new InputItemCollectin(); foreach (DataGridItem dataGridItem in this.dgList.Items) { inputItemCollectin.Add(new InputItemInfo { ChildMainId = int.Parse(this.dgList.DataKeys[dataGridItem.ItemIndex].ToString()), MainID = int.Parse(this.hidMainId.Value), Remark = ((TextBox)dataGridItem.FindControl("txtRemark") == null) ? "" : ((TextBox)dataGridItem.FindControl("txtRemark")).Text, DevotionMoney = decimal.Parse(((TextBox)dataGridItem.FindControl("txtDevotionMoney") == null) ? "0" : ((TextBox)dataGridItem.FindControl("txtDevotionMoney")).Text), SubjectID = int.Parse(((HtmlInputHidden)dataGridItem.FindControl("SubjectId")).Value) }); } return(inputItemCollectin); }
public static bool SaveItems(InputItemCollectin objInfos) { string sqlString = ""; decimal num = 0M; for (int i = 0; i < objInfos.Count; i++) { string str2 = sqlString + " update Prj_ScienceEmpolderDevotionChild set DevotionMoney=" + objInfos[i].DevotionMoney.ToString(); sqlString = str2 + ",Remark='" + objInfos[i].Remark + "' where ChildMainID=" + objInfos[i].ChildMainId.ToString(); num += objInfos[i].DevotionMoney; if (i == (objInfos.Count - 1)) { string str3 = sqlString; sqlString = str3 + " update Prj_ScienceEmpolderDevotion set ScienceEmpolderMoney=" + num.ToString() + " where MainID=" + objInfos[0].MainID.ToString(); } } return((sqlString != "") && publicDbOpClass.NonQuerySqlString(sqlString)); }
public InputItemCollectin GetCostSubjectInfos(int MainID) { InputItemCollectin collectin = new InputItemCollectin(); foreach (DataRow row in publicDbOpClass.DataTableQuary("select * from prj_V_CostInputItem where SecNum=0 and MainID=" + MainID.ToString()).Rows) { InputItemInfo info = new InputItemInfo { SubjectID = int.Parse(row["SubjectID"].ToString()), FirstNum = int.Parse(row["FirstNum"].ToString()), SubjectName = row["SubjectName"].ToString(), MainID = int.Parse(row["MainID"].ToString()), ChildMainId = int.Parse(row["ChildMainId"].ToString()), Remark = row["Remark"].ToString(), DevotionMoney = decimal.Parse(row["DevotionMoney"].ToString()) }; if (int.Parse(publicDbOpClass.ExecuteScalar(string.Format("select isNull(Count(*),0) from prj_V_CostInputItem where firstNum={0} and secNum<>0 and MainID={1}", info.FirstNum, MainID)).ToString()) > 0) { info.IsHaveChild = true; } collectin.Add(info); DataTable table = publicDbOpClass.DataTableQuary(string.Format("select * from prj_V_CostInputItem where FirstNum={0} and secnum>0 and MainID={1} order by secNum", info.FirstNum, MainID)); for (int i = 0; i < table.Rows.Count; i++) { InputItemInfo info2 = new InputItemInfo { SubjectID = int.Parse(table.Rows[i]["SubjectID"].ToString()), FirstNum = int.Parse(table.Rows[i]["FirstNum"].ToString()), SubjectName = table.Rows[i]["SubjectName"].ToString(), SecNum = int.Parse(table.Rows[i]["SecNum"].ToString()), MainID = int.Parse(table.Rows[i]["MainID"].ToString()), ChildMainId = int.Parse(table.Rows[i]["ChildMainID"].ToString()), Remark = table.Rows[i]["Remark"].ToString(), DevotionMoney = decimal.Parse(table.Rows[i]["DevotionMoney"].ToString()) }; collectin.Add(info2); } table.Dispose(); } return(collectin); }