Ejemplo n.º 1
0
        void txtTmpName_Validating(object sender, CancelEventArgs e)
        {
            if (BsfGlobal.FindPermission("Template Documents-Modify") == false)
            {
                MessageBox.Show("You don't have Rights to Template Documents-Modify");
                return;
            }
            TextEdit editor = (TextEdit)sender;

            if (CommFun.IsNullCheck(editor.EditValue.ToString(), CommFun.datatypes.vartypestring).ToString().Trim() == "")
            {
                grdViewTemp.CancelUpdateCurrentRow();
                return;
            }

            //if (BankBL.CheckListFound(oChkLstBo.CheckListId, oChkLstBo.CheckListName, m_sType) == true)
            //{
            //    MessageBox.Show("CheckListName Already Found");
            //    return;
            //}

            if (grdViewTemp.IsNewItemRow(grdViewTemp.FocusedRowHandle) == true)
            {
                if (CompetitorBL.TemplateFound(editor.EditValue.ToString(), m_iCompId) == true)
                {
                    MessageBox.Show("TemplateName Already Found");
                    editor.EditValue = "";
                    return;
                }
                int iTempId = CompetitorBL.InsertTempName(editor.EditValue.ToString(), m_iCompId);
                grdViewTemp.SetRowCellValue(grdViewTemp.FocusedRowHandle, "TemplateName", editor.EditValue.ToString());
                grdViewTemp.SetRowCellValue(grdViewTemp.FocusedRowHandle, "TemplateId", iTempId);
                grdViewTemp.UpdateCurrentRow();
            }
            else
            {
                int iTempId = Convert.ToInt32(grdViewTemp.GetRowCellValue(grdViewTemp.FocusedRowHandle, "TemplateId").ToString());
                CompetitorBL.UpdateTemplate(iTempId, editor.EditValue.ToString());
            }
        }