Ejemplo n.º 1
0
        protected void Button_SO_Update_Click(object sender, EventArgs e)
        {
            String  sectionTnC = Label_TNC_flag_SO.Text;
            Boolean insertFlag = sectionTnC.Equals("Y");
            Boolean updateStat = true;

            ArrayList docFormatList = new ArrayList();
            DocFormat sectionTnCObj = new DocFormat();
            String    docFormatId   = "";

            if (sectionTnC.Equals("Y"))
            {
                if (!TextBox_SO_format_name.Text.Equals("") && !TextBox_SO_TnC.Text.Equals(""))
                {
                    docFormatId = new BackEndObjects.Id().getNewId(BackEndObjects.Id.ID_TYPE_DOCFORMAT_ID_STRING);


                    sectionTnCObj.setCmp_id(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
                    sectionTnCObj.setDoc_type(BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_SALES_ORDER);
                    sectionTnCObj.setDocformat_id(docFormatId);
                    sectionTnCObj.setDocformat_name(TextBox_SO_format_name.Text);
                    sectionTnCObj.setSection_type(BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_SALES_ORDER_SECTION_TYPE_TNC);
                    sectionTnCObj.setText(TextBox_SO_TnC.Text);

                    docFormatList.Add(sectionTnCObj);
                }
            }
            else
            {
                Dictionary <String, String> whereCls = new Dictionary <string, string>();
                whereCls.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_CMP_ID, Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
                whereCls.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_DOC_TYPE, BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_SALES_ORDER);
                whereCls.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_SECTION_TYPE, BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_SALES_ORDER_SECTION_TYPE_TNC);

                Dictionary <String, String> targetVals = new Dictionary <string, string>();
                targetVals.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_TEXT, TextBox_SO_TnC.Text);
                targetVals.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_DOCFORMAT_NAME, TextBox_SO_format_name.Text);

                BackEndObjects.DocFormat.updateDocFormatObjsDB(whereCls, targetVals, DBConn.Connections.OPERATION_UPDATE);
                updateStat = true;
            }

            try
            {
                if (insertFlag)
                {
                    BackEndObjects.DocFormat.insertDocFormatDB(docFormatList);
                }
                Label_SO_update_stat.Visible   = true;
                Label_SO_update_stat.ForeColor = System.Drawing.Color.Green;
                Label_SO_update_stat.Text      = "Updated Successfully";
            }
            catch (Exception ex)
            {
                Label_SO_update_stat.Visible   = true;
                Label_SO_update_stat.ForeColor = System.Drawing.Color.Red;
                Label_SO_update_stat.Text      = "Update Failed";
            }
        }
Ejemplo n.º 2
0
        protected void Button_Inv_Update_Click(object sender, EventArgs e)
        {
            String sectionTnC = Label_TNC_flag_Inv.Text;
            //The sectionTnC label helps to determinte whethere the sections need an insert or update
            Boolean insertFlag = sectionTnC.Equals("Y");
            Boolean updateStat = true;

            ArrayList docFormatList     = new ArrayList();
            DocFormat sectionTnCObj     = new DocFormat();
            DocFormat sectionTaxCompObj = new DocFormat();

            String docFormatId = "";

            if (sectionTnC.Equals("Y"))
            {
                if (!TextBox_INV_format_name.Text.Equals("") && !TextBox_INV_TnC.Text.Equals(""))
                {
                    docFormatId = new BackEndObjects.Id().getNewId(BackEndObjects.Id.ID_TYPE_DOCFORMAT_ID_STRING);


                    sectionTnCObj.setCmp_id(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
                    sectionTnCObj.setDoc_type(BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_INVOICE);
                    sectionTnCObj.setDocformat_id(docFormatId);
                    sectionTnCObj.setDocformat_name(TextBox_INV_format_name.Text);
                    sectionTnCObj.setSection_type(BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_INVOICE_SECTION_TYPE_TNC);
                    sectionTnCObj.setText(TextBox_INV_TnC.Text);

                    docFormatList.Add(sectionTnCObj);
                }
            }
            else
            {
                Dictionary <String, String> whereCls = new Dictionary <string, string>();
                whereCls.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_CMP_ID, Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
                whereCls.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_DOC_TYPE, BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_INVOICE);
                whereCls.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_SECTION_TYPE, BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_INVOICE_SECTION_TYPE_TNC);

                Dictionary <String, String> targetVals = new Dictionary <string, string>();
                targetVals.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_TEXT, TextBox_INV_TnC.Text);
                targetVals.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_DOCFORMAT_NAME, TextBox_INV_format_name.Text);

                BackEndObjects.DocFormat.updateDocFormatObjsDB(whereCls, targetVals, DBConn.Connections.OPERATION_UPDATE);
                updateStat = true;
            }

            try
            {
                Boolean refreshTaxCompGrid = false;

                if (!TextBox_Inv_Tax_Comp_Name.Text.Equals("") && !TextBox_Inv_Tax_Comp_Value.Text.Equals(""))
                {
                    sectionTaxCompObj.setCmp_id(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
                    sectionTaxCompObj.setDoc_type(BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_INVOICE);

                    docFormatId = docFormatId.Equals("") ? new BackEndObjects.Id().getNewId(BackEndObjects.Id.ID_TYPE_DOCFORMAT_ID_STRING) : docFormatId;

                    sectionTaxCompObj.setDocformat_id(docFormatId);
                    sectionTaxCompObj.setDocformat_name(TextBox_INV_format_name.Text);
                    sectionTaxCompObj.setSection_type(BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_INVOICE_SECTION_TYPE_TAX);
                    sectionTaxCompObj.setSectionTypeName(TextBox_Inv_Tax_Comp_Name.Text);
                    sectionTaxCompObj.setText(TextBox_Inv_Tax_Comp_Value.Text);

                    docFormatList.Add(sectionTaxCompObj);
                    refreshTaxCompGrid = true;
                }
                if (docFormatList.Count > 0)
                {
                    BackEndObjects.DocFormat.insertDocFormatDB(docFormatList);
                }
                if (refreshTaxCompGrid)
                {
                    loadInvTaxCompGrid();
                }

                Label_Inv_Update_stat.Visible   = true;
                Label_Inv_Update_stat.ForeColor = System.Drawing.Color.Green;
                Label_Inv_Update_stat.Text      = "Updated Successfully";
            }
            catch (Exception ex)
            {
                Label_Inv_Update_stat.Visible   = true;
                Label_Inv_Update_stat.ForeColor = System.Drawing.Color.Red;
                Label_Inv_Update_stat.Text      = "Update Failed";
            }
        }