Ejemplo n.º 1
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            string name                 = parent.fixForSQL(txtName.Text);
            string description          = parent.fixForSQL(txtDescription.Text);
            string largeAreaDescription = parent.fixForSQL(txtLargeAreaDescription1.Text);
            string sql = "";

            if (serviceID == "")
            {
                sql  = "Insert into [Service] (Name, Description, LargeAreaDescription) ";
                sql += "VALUES('" + name + "','" + description + "','" + largeAreaDescription + "')";
            }

            else
            {
                sql  = "update [Service] set ";
                sql += "Name='" + name + "', ";
                sql += "Description='" + description + "', ";
                sql += "LargeAreaDescription='" + largeAreaDescription + "' ";
                sql += "where ServiceID=" + serviceID;;
            }

            parent.executeSQL(sql);
            parent.loadItemData();
            Visibility = System.Windows.Visibility.Hidden;
        }
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            string name                 = parent.fixForSQL(txtName.Text);
            string buttonTitle          = parent.fixForSQL(txtButtonTitle.Text);
            string buttonText           = parent.fixForSQL(txtButtonText.Text);
            string pageDescription      = parent.fixForSQL(txtPageDescription.Text);
            string largeAreaDescription = parent.fixForSQL(txtLargeAreaDescription.Text);
            string buttonIcon           = "";

            if (dgIcons.SelectedIndex >= 0)
            {
                buttonIcon = ((System.Data.DataRowView)(dgIcons.SelectedItem))["Name"].ToString();
            }

            // Insert
            if (catalogID == "")
            {
                string sql = "Insert into [Catalog] (Name, ButtonTitle, ButtonIcon, ButtonText, PageDescription, LargeAreaDescription) ";
                sql += "VALUES('" + name + "','" + buttonTitle + "','" + buttonIcon + "','" + buttonText + "','" + pageDescription + "','" + largeAreaDescription + "')";

                parent.executeSQL(sql);
            }

            // Update
            else
            {
                string sql = "update [Catalog] set ";
                sql += "Name='" + name + "', ";
                sql += "ButtonTitle='" + buttonTitle + "', ";
                sql += "ButtonText='" + buttonText + "', ";
                sql += "PageDescription='" + pageDescription + "', ";
                sql += "LargeAreaDescription='" + largeAreaDescription + "', ";
                sql += "ButtonIcon ='" + buttonIcon + "' ";
                sql += "where CatalogID=" + catalogID;
                parent.executeSQL(sql);
            }

            parent.loadCatalogData();
            parent.updateCatalog();

            Visibility = System.Windows.Visibility.Hidden;
        }
Ejemplo n.º 3
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string cat = "", subcat = "", item = "", sla = "", sql = "";

                if (dgCat.SelectedIndex >= 0)
                {
                    cat = ((System.Data.DataRowView)(dgCat.SelectedItem))["Name"].ToString();
                }
                if (dgSubCat.SelectedIndex >= 0)
                {
                    subcat = ((System.Data.DataRowView)(dgSubCat.SelectedItem))["Name"].ToString();
                }
                if (dgItem.SelectedIndex >= 0)
                {
                    item = ((System.Data.DataRowView)(dgItem.SelectedItem))["Name"].ToString();
                }
                if (dgSLA.SelectedIndex >= 0)
                {
                    sla = ((System.Data.DataRowView)(dgSLA.SelectedItem))["ServiceLevelAgreementID"].ToString();
                }

                string name   = parent.fixForSQL(txtName.Text);
                string forBiz = (rectBiz.Opacity < 1) ? "0" : "1";
                string forOps = (rectOps.Opacity < 1) ? "0" : "1";
                string forIT  = (rectIT.Opacity < 1) ? "0" : "1";
                string desc   = parent.fixForSQL(txtDescription.Text);

                if (taskID == "")
                {
                    sql  = "Insert into [Task] (ServiceID, ServiceLevelAgreementID, Name, ForBusinessAssoc, ForOperationsAssoc, ForITAssoc, ServiceDeskCategory, ServiceDeskSubCategory, ServiceDeskItem, Description, Comment) ";
                    sql += "VALUES(" + serviceID + "," + sla + ",'" + name + "'," + forBiz + "," + forOps + "," + forIT + ",'" + cat + "','" + subcat + "','" + item + "','" + desc + "','')";
                }
                else
                {
                    sql  = "update [Task] set ";
                    sql += "Name='" + name + "', ";
                    sql += "Description='" + desc + "', ";
                    sql += "ServiceDeskCategory='" + parent.fixForSQL(cat) + "', ";
                    sql += "ServiceDeskSubCategory='" + parent.fixForSQL(subcat) + "', ";
                    sql += "ServiceDeskItem='" + parent.fixForSQL(item) + "', ";
                    if (sla != "")
                    {
                        sql += "ServiceLevelAgreementID=" + sla + ", ";
                    }
                    sql += "[ForBusinessAssoc] = " + forBiz + ", ";
                    sql += "[ForOperationsAssoc] = " + forOps + ", ";
                    sql += "[ForITAssoc] = " + forIT + " ";
                    sql += "where TaskID=" + taskID;
                }

                parent.executeSQL(sql);
                parent.loadTaskData();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Save Task field: " + Environment.NewLine + ex.ToString());
            }

            Visibility = System.Windows.Visibility.Hidden;
        }