Пример #1
0
        /*
         * 方法名称:DataGrilViedAddRow()
         * 方法功能描述:向table中增加一行;
         *
         * 创建人:冯雪
         * 创建时间:2009-03-07
         *
         * 修改人:
         * 修改时间:
         * 修改内容:
         *
         */
        public void DataGrilViedAddRow(sellPlanDetailClass sPDclass, DataTable dt, string pKind, string pName, string pModel)
        {
            DataRow dr = dt.NewRow();

            dr["id"]  = sPDclass.Id;
            dr["pId"] = sPDclass.PId;

            dr["sort"]  = pKind;
            dr["name"]  = pName;
            dr["model"] = pModel;

            dr["january"]   = sPDclass.January;
            dr["february"]  = sPDclass.February;
            dr["march"]     = sPDclass.March;
            dr["april"]     = sPDclass.April;
            dr["may"]       = sPDclass.May;
            dr["june"]      = sPDclass.June;
            dr["july"]      = sPDclass.July;
            dr["august"]    = sPDclass.August;
            dr["september"] = sPDclass.September;
            dr["october"]   = sPDclass.October;
            dr["november"]  = sPDclass.November;
            dr["december"]  = sPDclass.December;
            dr["quantity"]  = sPDclass.Quantity;
            dr["inputDate"] = sPDclass.InputDate;
            dr["spId"]      = sPDclass.SpId;

            dt.Rows.Add(dr);
        }
Пример #2
0
        private List <sellPlanDetailClass> getSellPlanDetail()
        {
            sellPlanDetailClass        sPDclass = null;
            List <sellPlanDetailClass> list     = new List <sellPlanDetailClass>();

            foreach (DataGridViewRow dgvr in dgvSPDetail.Rows)
            {
                sPDclass     = new sellPlanDetailClass();
                sPDclass.PId = int.Parse(dgvr.Cells["PId"].Value.ToString());
                // 2009-4-17 修改人:付中华
                // 对于所有DataGridView中的单格进行校验
                if (dgvr.Cells["january"].FormattedValue.ToString() != "")
                {
                    sPDclass.January = decimal.Parse(dgvr.Cells["january"].Value.ToString());
                }
                if (dgvr.Cells["february"].FormattedValue.ToString() != "")
                {
                    sPDclass.February = decimal.Parse(dgvr.Cells["february"].Value.ToString());
                }
                if (dgvr.Cells["march"].FormattedValue.ToString() != "")
                {
                    sPDclass.March = decimal.Parse(dgvr.Cells["march"].Value.ToString());
                }
                if (dgvr.Cells["april"].FormattedValue.ToString() != "")
                {
                    sPDclass.April = decimal.Parse(dgvr.Cells["april"].Value.ToString());
                }
                if (dgvr.Cells["may"].FormattedValue.ToString() != "")
                {
                    sPDclass.May = decimal.Parse(dgvr.Cells["may"].Value.ToString());
                }
                if (dgvr.Cells["june"].FormattedValue.ToString() != "")
                {
                    sPDclass.June = decimal.Parse(dgvr.Cells["june"].Value.ToString());
                }
                if (dgvr.Cells["july"].FormattedValue.ToString() != "")
                {
                    sPDclass.July = decimal.Parse(dgvr.Cells["july"].Value.ToString());
                }
                if (dgvr.Cells["august"].FormattedValue.ToString() != "")
                {
                    sPDclass.August = decimal.Parse(dgvr.Cells["august"].Value.ToString());
                }
                if (dgvr.Cells["september"].FormattedValue.ToString() != "")
                {
                    sPDclass.September = decimal.Parse(dgvr.Cells["september"].Value.ToString());
                }
                if (dgvr.Cells["october"].FormattedValue.ToString() != "")
                {
                    sPDclass.October = decimal.Parse(dgvr.Cells["october"].Value.ToString());
                }
                if (dgvr.Cells["november"].FormattedValue.ToString() != "")
                {
                    sPDclass.November = decimal.Parse(dgvr.Cells["november"].Value.ToString());
                }
                if (dgvr.Cells["december"].FormattedValue.ToString() != "")
                {
                    sPDclass.December = decimal.Parse(dgvr.Cells["december"].Value.ToString());
                }
                if (dgvr.Cells["quantity"].FormattedValue.ToString() != "")
                {
                    sPDclass.Quantity = decimal.Parse(dgvr.Cells["quantity"].Value.ToString());
                }
                //sPDclass.January = decimal.Parse(dgvr.Cells["january"].Value.ToString());
                //sPDclass.February = decimal.Parse(dgvr.Cells["february"].Value.ToString());
                //sPDclass.March = decimal.Parse(dgvr.Cells["march"].Value.ToString());
                //sPDclass.April = decimal.Parse(dgvr.Cells["april"].Value.ToString());
                //sPDclass.May = decimal.Parse(dgvr.Cells["may"].Value.ToString());
                //sPDclass.June = decimal.Parse(dgvr.Cells["june"].Value.ToString());
                //sPDclass.July = decimal.Parse(dgvr.Cells["july"].Value.ToString());
                //sPDclass.August = decimal.Parse(dgvr.Cells["august"].Value.ToString());
                //sPDclass.September = decimal.Parse(dgvr.Cells["september"].Value.ToString());
                //sPDclass.October = decimal.Parse(dgvr.Cells["october"].Value.ToString());
                //sPDclass.November = decimal.Parse(dgvr.Cells["november"].Value.ToString());
                //sPDclass.December = decimal.Parse(dgvr.Cells["december"].Value.ToString());
                //sPDclass.Quantity = decimal.Parse(dgvr.Cells["quantity"].Value.ToString());
                sPDclass.InputDate = DateTime.Now;

                list.Add(sPDclass);
            }
            return(list);
        }