Ejemplo n.º 1
0
        protected void TempRadGrid_UpdateCommand(object sender, GridCommandEventArgs e)
        {
            var editedItem = e.Item as GridEditableItem;

            if (editedItem != null)
            {
                var    tempId         = new Guid(editedItem.GetDataKeyValue("TempId").ToString());
                string templateName   = ((TextBox)editedItem.FindControl("TB_TemplateName")).Text;
                string shipper        = ((TextBox)editedItem.FindControl("TB_Shipper")).Text;
                string contactPerson  = ((TextBox)editedItem.FindControl("TB_ContactPerson")).Text;
                string contactAddress = ((TextBox)editedItem.FindControl("TB_ContactAddress")).Text;
                string remarks        = ((TextBox)editedItem.FindControl("TB_Remarks")).Text;
                string customer       = ((TextBox)editedItem.FindControl("TB_Customer")).Text;
                var    tempInfo       = new ExcelTemplateInfo
                {
                    TempId         = tempId,
                    TemplateName   = templateName,
                    Shipper        = shipper,
                    ContactPerson  = contactPerson,
                    ContactAddress = contactAddress,
                    Customer       = customer,
                    Remarks        = remarks,
                    WarehouseId    = new Guid(RCB_Stock.SelectedValue)
                };
                try
                {
                    _temp.Update(tempInfo);
                }
                catch (Exception ex)
                {
                    RAM.Alert("修改失败!可能修改的模板名存在相同的!" + ex.Message);
                }
            }
        }
Ejemplo n.º 2
0
        protected void TempRadGrid_InsertCommand(object sender, GridCommandEventArgs e)
        {
            var editedItem = e.Item as GridEditableItem;

            if (editedItem != null)
            {
                string templateName   = ((TextBox)editedItem.FindControl("TB_TemplateName")).Text;
                string shipper        = ((TextBox)editedItem.FindControl("TB_Shipper")).Text;
                string contactPerson  = ((TextBox)editedItem.FindControl("TB_ContactPerson")).Text;
                string contactAddress = ((TextBox)editedItem.FindControl("TB_ContactAddress")).Text;
                string remarks        = ((TextBox)editedItem.FindControl("TB_Remarks")).Text;
                string customer       = ((TextBox)editedItem.FindControl("TB_Customer")).Text;
                var    tempInfo       = new ExcelTemplateInfo
                {
                    TemplateName   = templateName,
                    Shipper        = shipper,
                    ContactPerson  = contactPerson,
                    ContactAddress = contactAddress,
                    Customer       = customer,
                    Remarks        = remarks
                };
                try
                {
                    _temp.Insert(tempInfo);
                }
                catch (Exception ex)
                {
                    RAM.Alert("添加失败 可能已经含有相同的模板名!" + ex.Message);
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 功   能:插入Excel模板
        /// 时   间:2010-11-18
        /// 作   者:蒋赛标
        /// </summary>
        /// <param name="tInfo">Excel模板实体</param>
        public int Insert(ExcelTemplateInfo tInfo)
        {
            const string SQL_EXCEL_TEMPATE_INSERT = @"Insert into lmshop_ExcelTemplate (TempId,Customer,TemplateName,Shipper,ContactPerson,ContactAddress,Remarks,WarehouseId)
                                             Values(@TempId,@Customer,@TemplateName,@Shipper,@ContactPerson,@ContactAddress,@Remarks,@WarehouseId)";

            using (SqlConnection conn = Databases.GetSqlConnection(GlobalConfig.ERP_DB_NAME, false))
            {
                return(conn.Execute(SQL_EXCEL_TEMPATE_INSERT, new
                {
                    TempId = Guid.NewGuid(),
                    Customer = tInfo.Customer,
                    TemplateName = tInfo.TemplateName,
                    Shipper = tInfo.Shipper,
                    ContactPerson = tInfo.ContactPerson,
                    ContactAddress = tInfo.ContactAddress,
                    Remarks = tInfo.Remarks,
                    WarehouseId = tInfo.WarehouseId,
                }));
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 功   能:修改Excel模板信息
        /// 时   间:2010-11-18
        /// 作   者:蒋赛标
        /// </summary>
        /// <param name="tInfo">Excel模板实体</param>
        public int Update(ExcelTemplateInfo tInfo)
        {
            const string SQL_EXCEL_TEMPLATE_UPDATE = @"Update lmshop_ExcelTemplate Set Customer=@Customer, TemplateName=@TemplateName,Shipper=@Shipper,
                                              ContactPerson=@ContactPerson,ContactAddress=@ContactAddress,Remarks=@Remarks ,WarehouseId=@WarehouseId
                                              Where TempId=@TempId ";

            using (SqlConnection conn = Databases.GetSqlConnection(GlobalConfig.ERP_DB_NAME, false))
            {
                return(conn.Execute(SQL_EXCEL_TEMPLATE_UPDATE, new
                {
                    TempId = Guid.NewGuid(),
                    Customer = tInfo.Customer,
                    TemplateName = tInfo.TemplateName,
                    Shipper = tInfo.Shipper,
                    ContactPerson = tInfo.ContactPerson,
                    ContactAddress = tInfo.ContactAddress,
                    Remarks = tInfo.Remarks,
                    WarehouseId = tInfo.WarehouseId,
                }));
            }
        }