Esempio n. 1
0
        private void LoadMultiLineStrings()
        {
            // This query returns values that DO NOT EXIST in the MULTILINE GEOMETRY table
            // in case the user presses the Define MultiLine geometries button more than once.
            //string query = "SELECT * FROM NETWORK_DEFINITION WHERE ID_ NOT IN (SELECT DISTINCT FACILITY_ID AS ID_ FROM MULTILINE_GEOMETRIES_JOIN)";
            //DataSet doesNotExistInMultiLineGeometry = DBMgr.ExecuteQuery(query);
            string  query = "SELECT * FROM NETWORK_DEFINITION";
            DataSet doesNotExistInMultiLineGeometry = DBMgr.ExecuteQuery(query);

            string clearMSGTable = "DELETE FROM MULTILINE_GEOMETRIES_JOIN";

            DBMgr.ExecuteNonQuery(clearMSGTable);

            string     strOutFile = GlobalDatabaseOperations.CreateBulkLoaderPath("MULTILINE_GEOMS", "txt");
            TextWriter tw         = new StreamWriter(strOutFile);

            foreach (DataRow multiGeomRow in doesNotExistInMultiLineGeometry.Tables[0].Rows)
            {
                Geometry geo = Geometry.GeomFromText(multiGeomRow["GEOMETRY"].ToString());
                if (geo is MultiLineString)
                {
                    MultiLineString multiLineGeom = (MultiLineString)geo;
                    foreach (LineString ls in multiLineGeom.LineStrings)
                    {
                        tw.WriteLine("\t" + multiGeomRow["ID_"].ToString() + "\t" + ls.ToString() + "\t");
                    }
                }
            }
            tw.Close();
            DBMgr.SQLBulkLoad("MULTILINE_GEOMETRIES_JOIN", strOutFile, '\t');
        }
Esempio n. 2
0
 private void tsbUpdateJoinedLineStrings_Click(object sender, EventArgs e)
 {
     foreach (DataGridViewRow facilityRow in dgvJoinedLineStrings.Rows)
     {
         if (facilityRow.Cells["FACILITY_ID"].Value != null && facilityRow.Cells["FACILITY_ID"].Value.ToString() != "" &&
             facilityRow.Cells["LINESTRING"].Value != null && facilityRow.Cells["LINESTRING"].Value.ToString() != "")
         {
             string facilityID = facilityRow.Cells["FACILITY_ID"].Value.ToString();
             string lineString = facilityRow.Cells["LINESTRING"].Value.ToString();
             string update     = "UPDATE NETWORK_DEFINITION SET GEOMETRY = '"
                                 + lineString + "' "
                                 + "WHERE ID_ = " + facilityID;
             try
             {
                 DBMgr.ExecuteNonQuery(update);
             }
             catch (Exception exc)
             {
                 Global.WriteOutput("Error: Could not update NETWORK_DEFINITION table with new LineStrings. " + exc.Message);
             }
         }
     }
     if (dgvMultiLineString.Rows.Count > 1)
     {
         LoadMultiLineStrings();
         LoadMultiLineDGV();
     }
 }
Esempio n. 3
0
        /// <summary>
        /// 保存更新数据
        /// </summary>
        /// <param name="formdata"></param>
        public void save(string formdata)
        {
            parentid = Request["parentid"];
            string  response         = "";
            string  repeat           = "";
            JObject json             = (JObject)JsonConvert.DeserializeObject(formdata);
            WEB_PAGECONFIG_DETAIL en = JsonToEntity(json);

            if (!string.IsNullOrEmpty(parentid))
            {
                en.PARENTID = Convert.ToInt32(parentid);
            }

            if (en != null)
            {
                if (en.ID < 0)
                {
                    //新增
                    string sqlStr = @"insert into web_pageconfig_detail (id,parentid,orderno,name,controltype,isselect,selectcontent,configtype,tablecode,fieldcode,tablename,fieldname,createtime,userid,username,enabled)
                                                 values (web_pageconfig_detail_id.nextval,'{0}','{1}','{2}','{3}','0','{4}','{5}','{6}','{7}','{8}','{9}',
                                                 sysdate,'{10}','{11}','{12}')";
                    sqlStr = string.Format(sqlStr, en.PARENTID, en.ORDERNO, en.NAME, en.CONTROLTYPE, en.SELECTCONTENT,
                                           en.CONFIGTYPE, en.TABLECODE, en.FIELDCODE, en.TABLENAME, en.FIELDNAME, en.USERID, en.USERNAME, en.ENABLED);
                    int i = DBMgr.ExecuteNonQuery(sqlStr);
                    if (i > 0)
                    {
                        repeat = "5";
                    }
                    else
                    {
                        repeat = "新增配置失败";
                    }
                }
                else
                {
                    //更新
                    string sqlStr = @"update web_pageconfig_detail set name='{0}',controltype='{1}',selectcontent='{2}',configtype='{3}',tablecode='{4}',fieldcode='{5}',tablename='{6}',fieldname='{7}',
                                                 userid='{8}',username='******',enabled='{10}' where id='{11}'";
                    sqlStr = string.Format(sqlStr, en.NAME, en.CONTROLTYPE, en.SELECTCONTENT, en.CONFIGTYPE, en.TABLECODE, en.FIELDCODE,
                                           en.TABLENAME, en.FIELDNAME, en.USERID, en.USERNAME, en.ENABLED, en.ID);
                    int i = DBMgr.ExecuteNonQuery(sqlStr);
                    if (i > 0)
                    {
                        repeat = "5";
                    }
                    else
                    {
                        repeat = "更新配置失败";
                    }
                }
            }
            else
            {
                repeat = "json转换出错";
            }

            response = "{\"success\":\"" + repeat + "\"}";
            Response.Write(response);
            Response.End();
        }
Esempio n. 4
0
        public void MoveUp()
        {
            string repeat   = "";
            string response = "";
            string id       = Request["deleterecord"];

            parentid = Request["parentid"];
            string sqlStr = "select * from web_pageconfig_detail t1 where t1.parentid='{0}' and t1.id='{1}'";

            sqlStr = string.Format(sqlStr, parentid, id);
            DataTable dt = DBMgr.GetDataTable(sqlStr);

            if (dt != null && dt.Rows.Count > 0)
            {
                string orderNo      = dt.Rows[0]["orderno"].ToString();
                string updateMinStr = "update web_pageconfig_detail set orderno='" + orderNo + "' where parentid='" + parentid + "' and orderno='" + (Convert.ToInt32(orderNo) - 1) + "'";
                DBMgr.ExecuteNonQuery(updateMinStr);
                string updateStr = "update web_pageconfig_detail set orderno='" + (Convert.ToInt32(orderNo) - 1) + "' where id='" + id + "'";
                DBMgr.ExecuteNonQuery(updateStr);
                repeat = "5";
            }
            else
            {
                repeat = "异常,无法上移";
            }
            response = "{\"success\":\"" + repeat + "\"}";
            Response.Write(response);
            Response.End();
        }
Esempio n. 5
0
        private void buttonAddAttribute_Click(object sender, EventArgs e)
        {
            FormAddAssetToAttribute form = new FormAddAssetToAttribute();

            if (form.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    int nIndex = dataGridViewAssetToAttribute.Rows.Add("", "", form.Attribute);
                    DataGridViewComboBoxCell dgvComboAsset;
                    dgvComboAsset = (DataGridViewComboBoxCell)dataGridViewAssetToAttribute[0, nIndex];
                    dataGridViewAssetToAttribute[2, nIndex].ReadOnly = true;
                    foreach (AssetObject assetTable in m_listAsset)
                    {
                        dgvComboAsset.Items.Add(assetTable.Asset);
                    }

                    String strInsert = "INSERT INTO ATTRIBUTES_ (ATTRIBUTE_,NATIVE_,PROVIDER,CALCULATED) VALUES('" + form.Attribute + "','True','MSSQL','True')";
                    DBMgr.ExecuteNonQuery(strInsert);
                }
                catch (Exception exception)
                {
                    Global.WriteOutput("Error: Creating new Asset to Attribute. " + exception.Message);
                }
            }
        }
Esempio n. 6
0
        private void textBoxDiscount_Validated(object sender, EventArgs e)
        {
            if (!m_bUpdate)
            {
                return;
            }
            String strDiscount = textBoxDiscount.Text;

            strDiscount = strDiscount.Replace("%", "");


            String strUpdate = "UPDATE INVESTMENTS SET DISCOUNTRATE='" + strDiscount + "' WHERE SIMULATIONID='" + m_strSimID + "'";

            try
            {
                DBMgr.ExecuteNonQuery(strUpdate);
            }
            catch (Exception except)
            {
                m_bUpdate            = false;
                textBoxDiscount.Text = m_strDiscout;
                m_bUpdate            = true;
                Global.WriteOutput("Error updating discount: " + except.Message);
            }
        }
Esempio n. 7
0
        public string create_save(string name, string originalname)
        {
            string sql = ""; string resultmsg = "{success:false}";

            try
            {
                JObject json_user = Extension.Get_UserInfo(HttpContext.User.Identity.Name);

                sql = @"INSERT INTO LIST_FILERECOGINZE (ID
                        ,FILEPATH,FILENAME,USERID,USERNAME,TIMES,STATUS,CUSTOMERCODE
                        ,CUSTOMERNAME                                           
                        ) VALUES (LIST_FILERECOGINZE_ID.Nextval
                            ,'{0}','{1}','{2}','{3}',sysdate,'{4}','{5}'
                            ,'{6}'
                            )";
                sql = string.Format(sql, "/FileUpload/filereconginze/" + name, originalname, json_user.Value <string>("ID"), json_user.Value <string>("REALNAME"), "未关联", json_user.Value <string>("CUSTOMERCODE")
                                    , json_user.Value <string>("CUSTOMERNAME"));

                int i = DBMgr.ExecuteNonQuery(sql);
                if (i > 0)
                {
                    resultmsg = "{success:true}";
                }
            }
            catch (Exception ex)
            {
            }

            return(resultmsg);
        }
Esempio n. 8
0
 private void GetRecursive(TreeNode treeNode)
 {
     if (treeNode.Nodes.Count > 0)
     {
         foreach (TreeNode tn in treeNode.Nodes)
         {
             GetRecursive(tn);
         }
     }
     else
     {
         // For nodes iterate until no parents.
         String   strNodes = treeNode.Text;
         TreeNode parent   = treeNode.Parent;
         while (parent != null)
         {
             strNodes = strNodes.Insert(0, parent.Text + "|");
             parent   = parent.Parent;
         }
         String strInsert = "INSERT INTO NETWORK_TREE (NETWORKID,NODES) VALUES ('" + m_strNetworkID + "','" + strNodes + "')";
         try
         {
             DBMgr.ExecuteNonQuery(strInsert);
         }
         catch (Exception exception)
         {
             String strError = "Error: Inserting network tree on edit tree with SQL exception -" + exception.Message;
             Global.WriteOutput(strError);
             MessageBox.Show(strError);
             return;
         }
     }
 }
Esempio n. 9
0
        private void textBoxInflation_Validated(object sender, EventArgs e)
        {
            if (!m_bUpdate)
            {
                return;
            }

            String strInflation = textBoxInflation.Text;

            strInflation = strInflation.Replace("%", "");


            String strUpdate = "UPDATE INVESTMENTS SET INFLATIONRATE='" + strInflation + "' WHERE SIMULATIONID='" + m_strSimID + "'";

            try
            {
                DBMgr.ExecuteNonQuery(strUpdate);
            }
            catch (Exception except)
            {
                m_bUpdate             = false;
                textBoxInflation.Text = m_strInflation;
                m_bUpdate             = true;
                Global.WriteOutput("Error updating Inflation rate: " + except.Message);
            }
        }
Esempio n. 10
0
        private void SaveNetworkTree()
        {
            this.Cursor = Cursors.WaitCursor;
            //Delete existing information;
            String strDelete = "DELETE FROM NETWORK_TREE WHERE NETWORKID='" + m_strNetworkID + "'";

            try
            {
                DBMgr.ExecuteNonQuery(strDelete);
            }
            catch (Exception exception)
            {
                String strError = "Error: Deleting existing network tree on save with SQL exception -" + exception.Message;
                Global.WriteOutput(strError);
                MessageBox.Show(strError);
                return;
            }

            //Save tree information.
            //Iterate through tree.


            foreach (TreeNode tn in tvNetwork.Nodes)
            {
                GetRecursive(tn);
            }
            this.Cursor = Cursors.Default;
        }
        public string DeleteOrderM()
        {
            string ordercodes = Request["ordercodes"]; string result = "{success:true}";

            string    sql = @"select SUBMITTIME from list_order where code in(" + ordercodes + ")";
            DataTable dt  = DBMgr.GetDataTable(sql);
            bool      bf  = false;

            foreach (DataRow dr in dt.Rows)
            {
                if (dr["SUBMITTIME"].ToString() != "")
                {
                    bf = true;
                    break;
                }
            }

            if (bf)
            {
                return("{success:false,flag:'E'}");
            }

            sql = @"delete list_order where code in(" + ordercodes + ")";
            DBMgr.ExecuteNonQuery(sql);

            return(result);
        }
Esempio n. 12
0
        public string ManageNews()
        {
            string  sql       = string.Empty;
            string  action    = Request["act"] + "";
            JObject json_user = Extension.Get_UserInfo(HttpContext.User.Identity.Name);
            string  rid       = Request["RID"] + "";

            if (action == "add")
            {
                string    sql_query = "select * from list_collect_infor_BYUSER where TYPE='news' and  RID='" + rid + "'";
                DataTable dt        = DBMgr.GetDataTable(sql_query);
                if (dt.Rows.Count != 0)
                {
                    return("{success:false}");
                }
                sql = "insert into list_collect_infor_BYUSER(ID,SYSUSERID,TYPE,CREATEID,CREATEDATE,RID) values(LIST_COLLECT_INFOR_BYUSER_ID.Nextval,'{0}','news','{1}',sysdate,'{2}')";
                sql = string.Format(sql, json_user.Value <string>("ID"), json_user.Value <string>("ID"), rid);
            }
            else
            {
                sql = "delete from  list_collect_infor_BYUSER where TYPE='news' and  RID in (" + rid + ") and SYSUSERID='" + json_user.Value <string>("ID") + "'";
            }
            DBMgr.ExecuteNonQuery(sql);
            return("{success:true}");
        }
Esempio n. 13
0
        public string Save()
        {
            JObject   json_user     = Extension.Get_UserInfo(HttpContext.User.Identity.Name);
            string    sql           = string.Empty;
            string    formdata      = Request["json"];
            JObject   json          = (JObject)JsonConvert.DeserializeObject(formdata);
            DataTable dt_valid_name = new DataTable();

            if (string.IsNullOrEmpty(Request["ID"]))
            {
                sql = @"insert into sys_user (ID,NAME,PASSWORD,REALNAME,EMAIL,TELEPHONE,MOBILEPHONE,ENABLED,SEX,PARENTID,REMARK,CREATETIME,CUSTOMERID,TYPE)
                        values(sys_user_id.nextval,'{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}',sysdate,'{10}',2)";
                sql = string.Format(sql, json.Value <string>("NAME"), json.Value <string>("NAME").ToSHA1(), json.Value <string>("REALNAME"), json.Value <string>("EMAIL"), json.Value <string>("TELEPHONE"), json.Value <string>("MOBILEPHONE"), json.Value <string>("ENABLED"), json.Value <string>("SEX"), json_user.GetValue("ID"), json.Value <string>("REMARK"), json_user.GetValue("CUSTOMERID"));

                dt_valid_name = DBMgr.GetDataTable("select * from sys_user where  NAME='" + json.Value <string>("NAME") + "'");
            }
            else
            {
                sql = @"update sys_user set REALNAME = '{0}',EMAIL = '{1}',TELEPHONE = '{2}',MOBILEPHONE = '{3}',ENABLED = '{4}',SEX = '{5}',REMARK = '{6}' where id = '{7}'";
                sql = string.Format(sql, json.Value <string>("REALNAME"), json.Value <string>("EMAIL"), json.Value <string>("TELEPHONE"), json.Value <string>("MOBILEPHONE"), json.Value <string>("ENABLED"), json.Value <string>("SEX"), json.Value <string>("REMARK"), Request["ID"]);
            }
            //验证用户是否重复
            if (dt_valid_name != null && dt_valid_name.Rows.Count != 0)
            {
                return("{result:false}");
            }
            else
            {
                DBMgr.ExecuteNonQuery(sql);
                return("{result:true}");
            }
        }
Esempio n. 14
0
        private void save(JObject json, string id)
        {
            string str = "false";
            string enabled = "1", position = "0";

            if (json.Value <string>("ENABLED") == "否" || json.Value <string>("ENABLED") == "0")
            {
                enabled = "1";
            }
            if (json.Value <string>("POSITIONID") == "前端管理" || json.Value <string>("POSITIONID") == "1")
            {
                position = "1";
            }
            else if (json.Value <string>("POSITIONID") == "后台管理" || json.Value <string>("POSITIONID") == "2")
            {
                position = "2";
            }
            if (string.IsNullOrEmpty(id))
            {
                string sql = @"insert into sys_user(id,name,realname,telephone,mobilephone,email,customerid,companyids,positionid,enabled,remark,createtime,type,password) 
                values(sys_user_id.nextval,'{0}','{1}','{2}', '{3}','{4}',{5},{6},'{7}','{8}','{9}',sysdate,1,'{10}')";
                sql = string.Format(sql,
                                    json.Value <string>("NAME"),
                                    json.Value <string>("REALNAME"),
                                    json.Value <string>("TELEPHONE"),
                                    json.Value <string>("MOBILEPHONE"),
                                    json.Value <string>("EMAIL"),
                                    json.Value <string>("CUSTOMERID"),
                                    "(select NAME from cusdoc.sys_customer where code='" + json.Value <string>("CUSTOMERID") + "')",
                                    position,
                                    enabled,
                                    json.Value <string>("REMARK"),
                                    "000000".ToSHA1());
                int i = DBMgr.ExecuteNonQuery(sql);
                str = i > 0 ? "true" : "false";
            }
            else
            {
                string sql = @"update sys_user set name='{0}',realname='{1}',telephone='{2}',mobilephone='{3}',email='{4}',customerid={5},companyids='{6}',
            positionid='{7}',enabled='{8}',remark='{9}' where id={10}";
                sql = string.Format(sql,
                                    json.Value <string>("NAME"),
                                    json.Value <string>("REALNAME"),
                                    json.Value <string>("TELEPHONE"),
                                    json.Value <string>("MOBILEPHONE"),
                                    json.Value <string>("EMAIL"),
                                    json.Value <string>("CUSTOMERID"),
                                    "(select id from cusdoc.sys_customer where code='" + json.Value <string>("CUSTOMERID") + "')",
                                    position,
                                    enabled,
                                    json.Value <string>("REMARK"),
                                    id);
                int i = DBMgr.ExecuteNonQuery(sql);
                str = i > 0 ? "true" : "false";
            }
            string response = "{\"success\":" + str + "}";

            Response.Write(response);
            Response.End();
        }
Esempio n. 15
0
        private void saveMenuConfig()
        {
            string companyid = Request["roleid"];
            string moduleids = Request["moduleids"];
            string sql       = "delete from t_rolemenu where companyid='" + companyid + "'";

            DBMgr.ExecuteNonQuery(sql);
            string flag = "true";

            if (!string.IsNullOrEmpty(moduleids))
            {
                string[]      ids  = moduleids.Split(',');
                List <string> sqls = new List <string>();
                foreach (string id in ids)
                {
                    if (!string.IsNullOrEmpty(id) && id != "-1")
                    {
                        sql = "insert into t_rolemenu(menuid,companyid) values('{0}','{1}')";
                        sqls.Add(string.Format(sql, id, companyid));
                    }
                }
                flag = DBMgr.ExecuteNonQuery(sqls) > 0 ? "true" : "false";
            }
            Response.Write("{\"success\":" + flag + "}");
            Response.End();
        }
Esempio n. 16
0
        public void DeleteFromImageView()
        {
            // First call the FormManager and have it close all open tabs, except NETWORK_DEFINITION, ASSETS, CONSTRUCTION_HISTORY
            // other ATTRIBUTE (RAW) tabs and Calculated fields.
            ConnectionParameters cp = DBMgr.GetAttributeConnectionObject(m_strAttributeToDelete);
            List <String>        listCommandText = new List <String>();

            m_strAttributeToDelete = m_strAttributeToDelete.Replace("_", "!_");

            String strDelete = "DELETE FROM ATTRIBUTES_ WHERE ATTRIBUTE_ = '" + m_strAttributeToDelete + "'";

            listCommandText.Add(strDelete);
            DeleteFromNetworks(listCommandText);
            DBMgr.ExecuteBatchNonQuery(listCommandText);
            if (cp.IsNative)
            {
                strDelete = "DROP TABLE " + m_strAttributeToDelete;
                DBMgr.ExecuteNonQuery(strDelete);
            }
            else
            {
                String dropView = "DROP VIEW " + m_strAttributeToDelete;
                DBMgr.ExecuteNonQuery(dropView, cp);
            }
        }
Esempio n. 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string    sql    = "";
            string    action = Request["action"];
            DataTable dt;

            switch (action)
            {
            case "select":
                sql = @"select ID,IMGURL,LINKURL,DESCRIPTION,STATUS,FILENAME,SORTINDEX from web_banner order by SORTINDEX";
                dt  = DBMgr.GetDataTable(sql);
                string json = JsonConvert.SerializeObject(dt);
                Response.Write("{rows:" + json + "}");
                Response.End();
                break;

            case "delete":
                //先删除对应的本地文件
                sql = "select * from web_banner where id='" + Request["id"] + "'";
                dt  = DBMgr.GetDataTable(sql);
                string path = Server.MapPath(dt.Rows[0]["IMGURL"] + "");
                if (File.Exists(path))
                {
                    File.Delete(path);
                }
                sql = @"delete from web_banner where id = '" + Request["id"] + "'";
                DBMgr.ExecuteNonQuery(sql);
                break;

            case "save":
                save(Request["formdata"]);
                break;
            }
        }
        public string save_MANIFEST(string ORDERCODE, string MANIFEST)
        {
            string msg = "{success:false,msg:'未知错误'}";

            try
            {
                if (MANIFEST == "on" || MANIFEST == "true" || MANIFEST == "1")
                {
                    MANIFEST = "1";
                }
                else
                {
                    MANIFEST = "0";
                }
                string strSql = "update RESIDENT_ORDER set MANIFEST='" + MANIFEST + "'  where code='" + ORDERCODE + "'";
                DBMgr.ExecuteNonQuery(strSql);

                msg = "{success:true}";
            }
            catch (Exception ex)
            {
                msg = "{success:false,msg:'保存失败:" + ex.Message + "'}";
            }
            return(msg);
        }
Esempio n. 19
0
        /// <summary>
        /// Updates the database each time a user completes a row in a property grid.
        /// </summary>
        public void UpdateDatabase(String strProperty, String strValue)
        {
            String strUpdate;

            switch (DBMgr.NativeConnectionParameters.Provider)
            {
            case "MSSQL":
                if (strValue.Trim() == "" || strValue.Trim().ToUpper() == "NULL")
                {
                    strUpdate = "Update ATTRIBUTES_ Set " + Global.m_htFieldMapping[strProperty].ToString() + " = NULL Where ATTRIBUTE_ = '" + m_strPropertyName + "'";
                }
                else
                {
                    strUpdate = "Update ATTRIBUTES_ Set " + Global.m_htFieldMapping[strProperty].ToString() + " = '" + strValue + "' Where ATTRIBUTE_ = '" + m_strPropertyName + "'";
                }
                break;

            case "ORACLE":
                if (strValue.Trim() == "" || strValue.Trim().ToUpper() == "NULL")
                {
                    strUpdate = "Update ATTRIBUTES_ Set \"" + Global.m_htFieldMapping[strProperty].ToString() + "\" = NULL Where ATTRIBUTE_ = '" + m_strPropertyName + "'";
                }
                else
                {
                    if (strProperty.Trim().ToUpper() != "ASCENDING")
                    {
                        strUpdate = "Update ATTRIBUTES_ Set \"" + Global.m_htFieldMapping[strProperty].ToString() + "\" = '" + strValue + "' Where ATTRIBUTE_ = '" + m_strPropertyName + "'";
                    }
                    else
                    {
                        if (strValue.Trim().ToUpper() == "TRUE")
                        {
                            strUpdate = "Update ATTRIBUTES_ Set \"" + Global.m_htFieldMapping[strProperty].ToString() + "\" = '1' Where ATTRIBUTE_ = '" + m_strPropertyName + "'";
                        }
                        else if (strValue.Trim().ToUpper() == "FALSE")
                        {
                            strUpdate = "Update ATTRIBUTES_ Set \"" + Global.m_htFieldMapping[strProperty].ToString() + "\" = '0' Where ATTRIBUTE_ = '" + m_strPropertyName + "'";
                        }
                        else
                        {
                            throw new Exception("Ascending set to unknown value.");
                        }
                    }
                }
                break;

            default:
                throw new NotImplementedException("TODO: Create ANSI implementation for XXXXXXXXXXXX");
                //break;
            }
            try
            {
                DBMgr.ExecuteNonQuery(strUpdate);
            }
            catch (Exception sqlE)
            {
                Global.WriteOutput("Error: Unable to update ATTRIBUTES_ table with new properties. " + sqlE.Message);
            }
        }
Esempio n. 20
0
        private void deleteData()
        {
            string ids = Request["ids"];
            string sql = "delete from config_filesplit where id in({0})";
            string str = DBMgr.ExecuteNonQuery(string.Format(sql, ids)) > 0 ? "true" : "false";

            Response.Write("{\"success\":" + str + "}");
            Response.End();
        }
        public int AddConfig(WEB_CUSTOMSCONFIG en)
        {
            string sqlStr = @"insert into web_customsconfig (ID,busitypecode,busitypename,busiitemcode,busiitemname,createuserid,createusername,enable,starttime)
                                         values (web_customsconfig_id.nextval,'{0}','{1}','{2}','{3}','{4}','{5}','{6}',sysdate)";

            sqlStr = string.Format(sqlStr, en.BUSITYPECODE, en.BUSITYPENAME, en.BUSIITEMCODE, en.BUSIITEMNAME, en.CREATEUSERID,
                                   en.CREATEUSERNAME, en.ENABLE);
            return(DBMgr.ExecuteNonQuery(sqlStr));
        }
Esempio n. 22
0
        private void save(string formdata)
        {
            JObject json = (JObject)JsonConvert.DeserializeObject(formdata);

            string sql = ""; DataTable dt_valid_name = new DataTable();

            if (string.IsNullOrEmpty(json.Value <string>("ID")))
            {
                sql = @"insert into cusdoc.sys_customer(id
                                    ,code,name,chineseabbreviation,chineseaddress,hscode,ciqcode
                                    ,englishname,englishaddress,iscustomer,isshipper,iscompany
                                    ,logicauditflag,docservicecompany,enabled,remark,SOCIALCREDITNO
                                    ,TOOLVERSION,isreceiver
                                ) values(cusdoc.sys_customer_id.nextval
                                    ,'{0}','{1}','{2}', '{3}','{4}','{5}'
                                    ,'{6}','{7}','{8}','{9}','{10}'
                                    ,'{11}','{12}','{13}','{14}','{15}'
                                    ,'{16}','{17}')";
                sql = string.Format(sql
                                    , json.Value <string>("CODE").ToUpper(), json.Value <string>("NAME"), json.Value <string>("CHINESEABBREVIATION"), json.Value <string>("CHINESEADDRESS"), json.Value <string>("HSCODE"), json.Value <string>("CIQCODE")
                                    , json.Value <string>("ENGLISHNAME"), json.Value <string>("ENGLISHADDRESS"), GetChk(json.Value <string>("ISCUSTOMER")), GetChk(json.Value <string>("ISSHIPPER")), GetChk(json.Value <string>("ISCOMPANY"))
                                    , GetChk(json.Value <string>("LOGICAUDITFLAG")), GetChk(json.Value <string>("DOCSERVICECOMPANY")), json.Value <string>("ENABLED"), json.Value <string>("REMARK"), json.Value <string>("SOCIALCREDITNO")
                                    , json.Value <string>("TOOLVERSION"), GetChk(json.Value <string>("ISRECEIVER"))
                                    );

                dt_valid_name = DBMgr.GetDataTable("select * from cusdoc.sys_customer where lower(code)='" + json.Value <string>("CODE").ToLower() + "'");
            }
            else
            {
                sql = @"update cusdoc.sys_customer set code='{0}',name='{1}',chineseabbreviation='{2}',chineseaddress='{3}',hscode='{4}',ciqcode='{5}'
                                    ,englishname='{6}',englishaddress='{7}',iscustomer='{8}',isshipper='{9}',iscompany='{10}'
                                    ,logicauditflag='{11}',docservicecompany='{12}',enabled='{13}',remark='{14}',SOCIALCREDITNO='{15}' 
                                    ,TOOLVERSION='{16}',isreceiver='{17}' 
                                where id={18}";
                sql = string.Format(sql
                                    , json.Value <string>("CODE").ToUpper(), json.Value <string>("NAME"), json.Value <string>("CHINESEABBREVIATION"), json.Value <string>("CHINESEADDRESS"), json.Value <string>("HSCODE"), json.Value <string>("CIQCODE")
                                    , json.Value <string>("ENGLISHNAME"), json.Value <string>("ENGLISHADDRESS"), GetChk(json.Value <string>("ISCUSTOMER")), GetChk(json.Value <string>("ISSHIPPER")), GetChk(json.Value <string>("ISCOMPANY"))
                                    , GetChk(json.Value <string>("LOGICAUDITFLAG")), GetChk(json.Value <string>("DOCSERVICECOMPANY")), json.Value <int>("ENABLED"), json.Value <string>("REMARK"), json.Value <string>("SOCIALCREDITNO")
                                    , json.Value <string>("TOOLVERSION"), GetChk(json.Value <string>("ISRECEIVER")), json.Value <string>("ID")
                                    );
                dt_valid_name = DBMgr.GetDataTable("select * from cusdoc.sys_customer where lower(code)='" + json.Value <string>("CODE").ToLower() + "' and id!=" + json.Value <string>("ID"));
            }
            string response = "";

            //验证用户是否重复
            if (dt_valid_name != null && dt_valid_name.Rows.Count != 0)
            {
                response = "{\"success\":false,\"flag\":1}";
            }
            else
            {
                int i = DBMgr.ExecuteNonQuery(sql);
                response = "{\"success\":" + (i > 0 ? "true" : "false") + "}";
            }
            Response.Write(response);
            Response.End();
        }
Esempio n. 23
0
        /// <summary>
        /// Delete all Segmentation Criteria for a given NETWORK.  For image view.  (USE TRY/CATCH)
        /// </summary>
        /// <param name="strNetworkID">NETWORKID for which to delete Dynamic Segmentation Criteria</param>
        public static void DeleteCriteriaSegmentForNetwork(String strNetworkID)
        {
            String strDelete = "DELETE FROM CRITERIA_SEGMENT WHERE NETWORKID ='" + strNetworkID + "'";

            DBMgr.ExecuteNonQuery(strDelete);

            strDelete = "DELETE FROM NETWORK_TREE WHERE NETWORKID='" + strNetworkID + "'";
            DBMgr.ExecuteNonQuery(strDelete);
        }
Esempio n. 24
0
        public int UpdateConfig(WEB_CUSTOMSCOST en)
        {
            string sqlStr = @"update WEB_CUSTOMSCOST  set Busitypecode='{0}',Busitypename='{1}',Busiitemcode='{2}',Busiitemname='{3}',Originname='{4}',Configname='{5}',Createuserid='{6}',Createusername='******' where id='{8}'";

            sqlStr = string.Format(sqlStr, en.BUSITYPECODE, en.BUSITYPENAME, en.BUSIITEMCODE, en.BUSIITEMNAME, en.ORIGINNAME, en.CONFIGNAME, en.CREATEUSERID, en.CREATEUSERNAME, en.ID);
            int i = DBMgr.ExecuteNonQuery(sqlStr);

            return(i);
        }
Esempio n. 25
0
        /// <summary>
        /// 删除数据
        /// </summary>
        /// <param name="id"></param>
        private void deleteData()
        {
            string id  = Request["ID"];
            string sql = "delete from cusdoc.sys_customer where id='{0}'";
            string str = DBMgr.ExecuteNonQuery(string.Format(sql, id)) > 0 ? "true" : "false";

            Response.Write("{\"success\":" + str + "}");
            Response.End();
        }
Esempio n. 26
0
        public String SavePropertiesToDatabase(PropertyGridEx.PropertyGridEx pgProperties)
        {
            m_strNetworkName = pgProperties.Item[0].Value.ToString();
            String strInsert;

            switch (DBMgr.NativeConnectionParameters.Provider)
            {
            case "MSSQL":
                //strInsert = "INSERT INTO NETWORKS (NETWORK_NAME,DESCRIPTION,DESIGNER_USERID,DESIGNER_NAME,DATE_CREATED,DATE_LAST_EDIT,NUMBER_SECTIONS,LOCK_,PRIVATE_) VALUES ('"
                strInsert = "INSERT INTO NETWORKS (NETWORK_NAME, DESCRIPTION, DESIGNER_USERID, DESIGNER_NAME, DATE_CREATED, DATE_LAST_EDIT, NUMBER_SECTIONS) VALUES ('"
                            + pgProperties.Item[0].Value + "', '"
                            + pgProperties.Item[1].Value + "', '"
                            + pgProperties.Item[2].Value + "', '"
                            + pgProperties.Item[3].Value + "', '"
                            + pgProperties.Item[4].Value + "', '"
                            + pgProperties.Item[5].Value + "', '"
                            + pgProperties.Item[6].Value + "')";
                break;

            case "ORACLE":
                //strInsert = "INSERT INTO NETWORKS (NETWORK_NAME,DESCRIPTION,DESIGNER_USERID,DESIGNER_NAME,DATE_CREATED,DATE_LAST_EDIT,NUMBER_SECTIONS,LOCK_,PRIVATE_) VALUES (";
                strInsert = "INSERT INTO NETWORKS (NETWORK_NAME,DESCRIPTION,DESIGNER_USERID,DESIGNER_NAME,DATE_CREATED,DATE_LAST_EDIT,NUMBER_SECTIONS) VALUES (";
                foreach (PropertyGridEx.CustomProperty networkProperty in pgProperties.Item)
                {
                    if (networkProperty.Value.ToString().ToLower() == "true")
                    {
                        strInsert += "'1', ";
                    }
                    else if (networkProperty.Value.ToString().ToLower() == "false")
                    {
                        strInsert += "'0', ";
                    }
                    else
                    {
                        strInsert += "'" + networkProperty.Value.ToString() + "', ";
                    }
                }
                strInsert  = strInsert.Remove(strInsert.Length - 2);
                strInsert += ")";
                break;

            default:
                throw new NotImplementedException("TODO: Create ANSI implementation for XXXXXXXXXXXX");
                //break;
            }
            try
            {
                DBMgr.ExecuteNonQuery(strInsert);
            }
            catch (Exception sqlE)
            {
                Global.WriteOutput("Error: Insert new network into database failed with, " + sqlE.Message);
                return("");
            }
            return(m_strNetworkName);
        }
Esempio n. 27
0
        //强制压缩
        public string ForcedCompress(string fileid)
        {
            string msg = "{success:false}";//失败
            string sql = "";

            try
            {
                sql = "select * from list_attachment where id='" + fileid + "'";
                DataTable dt = DBMgr.GetDataTable(sql);
                if (dt.Rows.Count > 0)
                {
                    string filename     = (dt.Rows[0]["FILENAME"] + "").Replace("/", @"\");
                    string filename_txt = @"d:\ftpserver\" + filename.Replace(".pdf", "").Replace(".PDF", "") + ".txt";

                    string dir           = @"d:\ftpserver\" + filename.Substring(0, filename.LastIndexOf(@"\"));
                    string SearchPattern = filename.Substring(filename.LastIndexOf(@"\") + 1).Replace(".pdf", "").Replace(".PDF", "") + "-web*";

                    var files = Directory.GetFiles(dir, SearchPattern);
                    for (int i = 0; i < files.Length; i++)
                    {
                        File.Delete(files[i]);
                    }

                    //DirectoryInfo dif = new DirectoryInfo(dir);
                    //FileInfo[] files2 = dif.GetFiles(SearchPattern);

                    //foreach (FileInfo fi in dif.GetFiles(SearchPattern))
                    //{
                    //    File.Delete(fi.FullName);
                    //}


                    //string pressfilename_pdf = @"d:\ftpserver\" + filename.Replace(".pdf", "").Replace(".PDF", "") + "-web.pdf";
                    //if (File.Exists(pressfilename_pdf))//删除压缩文件
                    //{
                    //    File.Delete(pressfilename_pdf);
                    //}

                    if (!File.Exists(filename_txt))//保留TXT标记文件
                    {
                        File.Create(filename_txt);
                    }

                    sql = "insert into pdfshrinklog (id,attachmentid) values (pdfshrinklog_id.nextval,'" + fileid + "')";
                    DBMgr.ExecuteNonQuery(sql);

                    msg = "{success:true}";
                }
            }
            catch (Exception ex)
            {
                return(msg);
            }

            return(msg);
        }
Esempio n. 28
0
        private void inipsd()
        {
            string id   = Request["id"];
            string name = Request["name"];
            string sql  = "update sys_user set points=0,PASSWORD='******' where id='{1}'";

            sql = string.Format(sql, Extension.ToSHA1(name), id);
            Response.Write(DBMgr.ExecuteNonQuery(sql));
            Response.End();
        }
Esempio n. 29
0
        /// <summary>
        /// 启禁用
        /// </summary>
        private void enabled()
        {
            string id   = Request["id"];
            string flag = Request["flag"];
            string sql  = "update sys_user set enabled='{0}' where id='{1}'";
            string str  = DBMgr.ExecuteNonQuery(string.Format(sql, flag, id)) > 0 ? "true" : "false";

            Response.Write("{\"success\":" + str + "}");
            Response.End();
        }
Esempio n. 30
0
        /// <summary>
        /// 新增一笔记录
        /// </summary>
        /// <param name="en"></param>
        /// <returns></returns>
        public int AddConfig(WEB_CUSTOMSCOST en)
        {
            string sqlStr = @"insert into WEB_CUSTOMSCOST (Id,Busitypecode,Busitypename,Busiitemcode,Busiitemname,Originname,Configname,Createuserid,Createusername)
                                         values(web_customsconfig_id.nextval,'{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')";

            sqlStr = string.Format(sqlStr, en.BUSITYPECODE, en.BUSITYPENAME, en.BUSIITEMCODE, en.BUSIITEMNAME, en.ORIGINNAME, en.CONFIGNAME, en.CREATEUSERID, en.CREATEUSERNAME);
            int i = DBMgr.ExecuteNonQuery(sqlStr);

            return(i);
        }