Example #1
0
        /// <summary>
        /// 重置指定批次下所有数据状态为 未提交
        /// </summary>
        /// <param name="type">类型<para>1:计划</para><para>2:专项</para></param>
        /// <param name="batchIds">批次ID</param>
        private void SetStateToUnsubmit(int type, object[] batchIds)
        {
            string        updateSQL  = string.Empty;
            List <object> projectIds = new List <object>();

            if (type == 1)
            {
                object[] planIds     = SqlHelper.ExecuteSingleColumnQuery($"SELECT pi_id FROM project_info WHERE pi_categor=1 AND pi_obj_id IN ({ToolHelper.GetStringBySplit(batchIds, ",", "'")})");
                string   proQuerySql = "SELECT A.pi_id FROM project_info p LEFT JOIN ( " +
                                       "SELECT pi_id, pi_obj_id FROM project_info WHERE pi_categor=2 UNION ALL " +
                                       "SELECT ti_id, ti_obj_id FROM topic_info WHERE ti_categor=-3)A ON A.pi_obj_id=p.pi_id " +
                                       $"WHERE p.pi_id IN ({ToolHelper.GetStringBySplit(planIds, ",", "'")})";
                object[] proIds = SqlHelper.ExecuteSingleColumnQuery(proQuerySql);
                projectIds.AddRange(proIds);
            }
            else if (type == 2)
            {
                string querySQL = "SELECT idi.imp_id FROM imp_dev_info idi INNER JOIN imp_info ii ON idi.imp_obj_id = ii.imp_id INNER JOIN transfer_registration_pc trp ON ii.imp_obj_id = trp.trp_id " +
                                  $"WHERE trp.trp_id IN({ToolHelper.GetStringBySplit(batchIds, ",", "'")})";
                object[] specialIds  = SqlHelper.ExecuteSingleColumnQuery(querySQL);
                string   proQuerySql = "SELECT A.pi_id FROM imp_dev_info idi LEFT JOIN ( " +
                                       "SELECT pi_id, pi_obj_id FROM project_info WHERE pi_categor=2 UNION ALL " +
                                       "SELECT ti_id, ti_obj_id FROM topic_info WHERE ti_categor=-3)A ON A.pi_obj_id=idi.imp_id " +
                                       $"WHERE idi.imp_id IN ({ToolHelper.GetStringBySplit(specialIds, ",", "'")})";
                object[] proIds = SqlHelper.ExecuteSingleColumnQuery(proQuerySql);
                projectIds.AddRange(proIds);
            }
            if (projectIds.Count > 0)
            {
                string pids = ToolHelper.GetStringBySplit(projectIds.ToArray(), ",", "'");
                updateSQL +=
                    $"UPDATE project_info SET pi_submit_status=1, pi_worker_id=null, pi_checker_id=null WHERE pi_id IN ({pids});" +
                    $"UPDATE topic_info SET ti_submit_status=1, ti_worker_id=null, ti_checker_id=null WHERE ti_id IN ({pids});";

                string topQuerySql = "SELECT A.ti_id FROM( " +
                                     "SELECT ti_id, ti_obj_id FROM topic_info WHERE ti_categor = 3 UNION ALL " +
                                     "SELECT si_id, si_obj_id FROM subject_info )A " +
                                     $"WHERE A.ti_obj_id IN({pids})";
                object[] topIds = SqlHelper.ExecuteSingleColumnQuery(topQuerySql);
                if (topIds.Length > 0)
                {
                    string tids = ToolHelper.GetStringBySplit(topIds, ",", "'");
                    updateSQL +=
                        $"UPDATE subject_info SET si_submit_status=1, si_worker_id=null, si_checker_id=null WHERE si_id IN ({tids});" +
                        $"UPDATE topic_info SET ti_submit_status=1, ti_worker_id=null, ti_checker_id=null WHERE ti_id IN ({tids});" +
                        $"UPDATE subject_info SET si_submit_status=1, si_worker_id=null, si_checker_id=null WHERE si_obj_id IN ({tids});";
                }
            }
            SqlHelper.ExecuteNonQuery(updateSQL);
        }
Example #2
0
        private void SimpleButton1_Click(object sender, System.EventArgs e)
        {
            List <object> list = new List <object>();

            for (int i = 0; i < chkl.CheckedItems.Count; i++)
            {
                ObjectEntity entity = chkl.CheckedItems[i] as ObjectEntity;
                list.Add(entity.ID);
            }
            if (list.Count > 0)
            {
                objectCode   = ToolHelper.GetStringBySplit(list.ToArray(), ",", "'");
                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
        }