示例#1
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            isReset = true;
            try
            {
                if (string.IsNullOrEmpty(this.txtServiceType.Text.Trim()))
                {
                    PageCommon.AlertMsg(this, "Service Type cannot be blank.");
                    return;
                }
                if (!serviceTypeMgr.IsSerivceTypeExsits(this.txtServiceType.Text.Trim()))
                {
                    ServiceTypes serviceType = new ServiceTypes();
                    serviceType.Name    = this.txtServiceType.Text.Trim();
                    serviceType.Enabled = true;
                    serviceTypeMgr.Add(serviceType);
                    this.txtServiceType.Text = "";

                    BindGrid();
                    PageCommon.AlertMsg(this, "Added service type successfully!");
                }
                else
                {
                    PageCommon.AlertMsg(this, "Failed to add service type, the Service Type already exsits.");
                }
            }
            catch (Exception ex)
            {
                PageCommon.AlertMsg(this, "Failed to add the Service Type.");
                LPLog.LogMessage(LogType.Logerror, "Failed to add the Service Type, exception: " + ex.Message);
            }
        }